branch: externals/listen
commit 879e381070572a7ff5d735ffa99c519278fe4b1f
Author: Adam Porter <a...@alphapapa.net>
Commit: Adam Porter <a...@alphapapa.net>

    Fix: (listen-queue) for bookmark handler
    
    When the function returns, the current buffer must be the queue
    buffer.
---
 README.org      |  1 +
 listen-queue.el | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index a558636e05..5fbae10e8e 100644
--- a/README.org
+++ b/README.org
@@ -88,6 +88,7 @@ Use the command ~listen~ to show the Transient menu.  From 
there, it is--hopeful
 
 *Fixes*
 + When reverting a queue's tracks from disk, re-detect the currently playing 
track by filename.
++ Queue bookmark handler.
 
 ** v0.6
 
diff --git a/listen-queue.el b/listen-queue.el
index 7804c0fd52..e7df106308 100644
--- a/listen-queue.el
+++ b/listen-queue.el
@@ -127,7 +127,8 @@ Useful for when `save-excursion' does not preserve point."
       (progn
         (pop-to-buffer buffer)
         (listen-queue-goto-current))
-    (with-current-buffer (get-buffer-create (format "*Listen Queue: %s*" 
(listen-queue-name queue)))
+    (with-current-buffer
+        (setf buffer (get-buffer-create (format "*Listen Queue: %s*" 
(listen-queue-name queue))))
       (let ((inhibit-read-only t))
         (listen-queue-mode)
         (setf listen-queue queue)
@@ -225,9 +226,12 @@ Useful for when `save-excursion' does not preserve point."
                           "l" (lambda (_) "Show (selected) tracks in library 
view."
                                 (call-interactively 
#'listen-library-from-queue))
                           "!" (lambda (_) (call-interactively 
#'listen-queue-shell-command)))))
+        (setf (listen-queue-buffer queue) (current-buffer))
         (listen-queue--annotate-buffer)
-        (listen-queue-goto-current))
-      (pop-to-buffer (current-buffer)))))
+        (listen-queue-goto-current)))
+    ;; NOTE: We pop to the buffer outside of `with-current-buffer' so
+    ;; `listen-queue--bookmark-handler' works correctly.
+    (pop-to-buffer (current-buffer))))
 
 (defun listen-queue--annotate-buffer ()
   "Annotate current buffer.

Reply via email to