Track selection now moves point in brwoser buffer.
[emus.git] / emus.el
diff --git a/emus.el b/emus.el
index 12c57f1..2c879c4 100644 (file)
--- 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,22 +510,22 @@ 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 (get-buffer "*emus*")
-      (when emus-current-track
-        (goto-char (emus-track-browser-pos emus-current-track))
-        (recenter))))
+  (when (and (get-buffer "*emus*")
+             emus-current-track)
+    (with-current-buffer "*emus*"
+        (goto-char (emus-track-browser-pos emus-current-track)))))
 
 (defun emus-browse ()
   "Switch to *emus* audio library browser."
   (interactive)
   (emus--with-library
-   (switch-to-buffer "*emus*")
+   (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.")