Cleaned up centering behaviour.
authorTim Vaughan <timv@ughan.xyz>
Thu, 12 Dec 2019 12:18:40 +0000 (13:18 +0100)
committerTim Vaughan <timv@ughan.xyz>
Thu, 12 Dec 2019 12:18:40 +0000 (13:18 +0100)
emus.el

diff --git a/emus.el b/emus.el
index 12c57f1..e529697 100644 (file)
--- a/emus.el
+++ b/emus.el
@@ -511,16 +511,16 @@ Used to update browser display when `emus-current-track' and/or `emus-state' cha
 (defun emus-centre-current ()
   "Centre the current track in the browser buffer, if available."
   (interactive)
-  (when (get-buffer "*emus*")
-      (when emus-current-track
+  (when (and (eq (current-buffer) (get-buffer "*emus*"))
+             emus-current-track)
         (goto-char (emus-track-browser-pos emus-current-track))
-        (recenter))))
+        (recenter)))
 
 (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)))