branch: externals/listen
commit 5b000a476c28690a7877394f0c55a235164f0d1a
Author: Adam Porter <[email protected]>
Commit: Adam Porter <[email protected]>

    Change/Fix: (listen-queue-goto-current) Show the queue's buffer
    
    Also, the command now takes the queue as an argument.
---
 README.org      |  1 +
 docs/README.org |  1 +
 listen-queue.el | 23 ++++++++++++++---------
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/README.org b/README.org
index 38f3e00668..93e7c8720e 100644
--- a/README.org
+++ b/README.org
@@ -211,6 +211,7 @@ The ~listen-mode~ minor mode runs a timer which plays the 
next track in the curr
 
 *Fixes*
 - Playing next track in queue after current track has been removed.
+- Command ~listen-queue-goto-current~ automatically shows the queue's buffer.
 - Updating vtables for Emacs versions before 30.
 ** v0.9
 
diff --git a/docs/README.org b/docs/README.org
index 10ced3139e..cb12f709c7 100644
--- a/docs/README.org
+++ b/docs/README.org
@@ -248,6 +248,7 @@ The ~listen-mode~ minor mode runs a timer which plays the 
next track in the curr
 
 *Fixes*
 + Playing next track in queue after current track has been removed.
++ Command ~listen-queue-goto-current~ automatically shows the queue's buffer.
 + Updating vtables for Emacs versions before 30.
 
 ** v0.9
diff --git a/listen-queue.el b/listen-queue.el
index 189aaa7261..e409e34099 100644
--- a/listen-queue.el
+++ b/listen-queue.el
@@ -131,7 +131,7 @@ Useful for when `save-excursion' does not preserve point."
   (if-let ((buffer (listen-queue-buffer queue)))
       (progn
         (pop-to-buffer buffer)
-        (listen-queue-goto-current))
+        (listen-queue-goto-current queue))
     (with-current-buffer
         (setf buffer (get-buffer-create (format "*Listen Queue: %s*" 
(listen-queue-name queue))))
       (let ((inhibit-read-only t))
@@ -236,7 +236,7 @@ Useful for when `save-excursion' does not preserve point."
                                 (call-interactively 
#'listen-library-from-queue))
                           "!" (lambda (_) (call-interactively 
#'listen-queue-shell-command)))))
         (listen-queue--annotate-buffer)
-        (listen-queue-goto-current)))
+        (listen-queue-goto-current queue)))
     ;; NOTE: We pop to the buffer outside of `with-current-buffer' so
     ;; `listen-queue--bookmark-handler' works correctly.
     (pop-to-buffer buffer)))
@@ -324,7 +324,7 @@ If BACKWARDP, move it backward."
       (when (vtable-current-table)
         (vtable-revert-command))
       (listen-queue--annotate-buffer))
-    (listen-queue-goto-current)))
+    (listen-queue-goto-current queue)))
 
 (defun listen-queue-update-track (track queue)
   "Update TRACK in QUEUE.
@@ -376,13 +376,18 @@ select track as well."
     (listen-mode))
   queue)
 
-(defun listen-queue-goto-current ()
+(defun listen-queue-goto-current (queue)
   "Jump to current track."
-  (interactive)
-  (when-let ((current-track (listen-queue-current listen-queue)))
-    ;; Ensure point is within the vtable.
-    (goto-char (point-min))
-    (vtable-goto-object current-track)))
+  (interactive (list (listen-queue-complete)))
+  (unless (listen-queue-buffer queue)
+    (listen-queue queue))
+  (listen-queue-with-buffer queue
+    (when-let ((current-track (listen-queue-current queue)))
+      ;; Ensure point is within the vtable.
+      (goto-char (point-min))
+      (vtable-goto-object current-track))
+    (unless (get-buffer-window (current-buffer))
+      (display-buffer (current-buffer)))))
 
 (defun listen-queue-complete-track (queue)
   "Return track selected from QUEUE with completion."

Reply via email to