(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)))