From: Tim Vaughan Date: Thu, 12 Dec 2019 12:29:41 +0000 (+0100) Subject: Track selection now moves point in brwoser buffer. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;ds=sidebyside;h=869c7b36b90740b4ac744270ef38d20226f2c391;hp=b1db216e7ebeb8f52138a0ec201b3aba6c6c5c31;p=emus.git Track selection now moves point in brwoser buffer. --- diff --git a/emus.el b/emus.el index e529697..2c879c4 100644 --- a/emus.el +++ b/emus.el @@ -269,7 +269,8 @@ by the filesystem." (setq emus-current-track track) (emus--update-track old-track) (emus--update-track track) - (emus--resume-cp)))) + (emus--resume-cp) + (emus-goto-current)))) (defun emus-select-track (track) "Set TRACK as current, but do not start playing." @@ -280,7 +281,8 @@ by the filesystem." (emus--update-track old-track) (emus--update-track track) (emus-send-cmd "o") - (emus--resume-cp)))) + (emus--resume-cp) + (emus-goto-current)))) (defun emus-stop () "Stop playback of the current track." @@ -508,13 +510,13 @@ Used to update browser display when `emus-current-track' and/or `emus-state' cha (emus-play-track (button-get button 'emus-track)) (emus-display-status)) -(defun emus-centre-current () - "Centre the current track in the browser buffer, if available." +(defun emus-goto-current () + "Move point to the current track in the browser buffer, if available." (interactive) - (when (and (eq (current-buffer) (get-buffer "*emus*")) + (when (and (get-buffer "*emus*") emus-current-track) - (goto-char (emus-track-browser-pos emus-current-track)) - (recenter))) + (with-current-buffer "*emus*" + (goto-char (emus-track-browser-pos emus-current-track))))) (defun emus-browse () "Switch to *emus* audio library browser." @@ -523,7 +525,7 @@ Used to update browser display when `emus-current-track' and/or `emus-state' cha (pop-to-buffer "*emus*") (emus-browser-mode) (emus--render-tracks) - (emus-centre-current))) + (emus-goto-current))) (defun emus-refresh () "Refresh the emus library." @@ -596,10 +598,10 @@ Used to update browser display when `emus-current-track' and/or `emus-state' cha (emus-jump-10s-backward) (emus-display-status)) -(defun emus-centre-current-status () - "Jump 10s backward in current track, then display the emus status in the minibuffer." +(defun emus-goto-current-status () + "Move point to the current track, then display the emus status in the minibuffer." (interactive) - (emus-centre-current) + (emus-goto-current) (emus-display-status)) (defun emus-refresh-status () @@ -625,7 +627,7 @@ Used to update browser display when `emus-current-track' and/or `emus-state' cha (define-key map (kbd "P") 'emus-play-prev-album-status) (define-key map (kbd ",") 'emus-jump-10s-backward-status) (define-key map (kbd ".") 'emus-jump-10s-forward-status) - (define-key map (kbd "c") 'emus-centre-current-status) + (define-key map (kbd "c") 'emus-goto-current-status) (when (fboundp 'evil-define-key*) (evil-define-key* 'motion map (kbd "SPC") 'emus-playpause-status @@ -640,7 +642,7 @@ Used to update browser display when `emus-current-track' and/or `emus-state' cha (kbd "P") 'emus-play-prev-album-status (kbd ",") 'emus-jump-10s-backward-status (kbd ".") 'emus-jump-10s-forward-status - (kbd "c") 'emus-centre-current-status)) + (kbd "c") 'emus-goto-current-status)) map) "Keymap for emus browser.")