I noticed a bug in emms-playlist-set-playlist-buffer today.  You may be able 
to replicate it with M-x emms-playlist-set-playlist-buffer when you have two or 
more playlists open.  When I do this, it only gives me the option of one of my 
two playlist buffers.  Upon further inspection, the problem seems to stem from 
"sort".  I couldn't tell you why, but sort destructively -- and unpredictably 
-- modifies its input to achieve its output.

  I took the liberty of fixing emms-playlist-set-playlist-buffer to use the 
output of sort, rather than relying on the original input.  The patch is 
attached.

diff --git a/lisp/emms.el b/lisp/emms.el
index e65e544..c00fcd0 100644
--- a/lisp/emms.el
+++ b/lisp/emms.el
@@ -738,17 +738,18 @@ for that purpose.")
    (list (let* ((buf-list (mapcar #'(lambda (buf)
                                       (list (buffer-name buf)))
                                   (emms-playlist-buffer-list)))
+                (sorted-buf-list (sort buf-list
+                                       #'(lambda (lbuf rbuf)
+                                           (< (length (car lbuf))
+                                              (length (car rbuf))))))
                 (default (or (and emms-playlist-buffer-p
                                   ;; default to current buffer
                                   (buffer-name))
                              ;; pick shortest buffer name, since it is
                              ;; likely to be a shared prefix
-                             (car (sort buf-list
-                                        #'(lambda (lbuf rbuf)
-                                            (< (length (car lbuf))
-                                               (length (car rbuf)))))))))
+                             (car sorted-buf-list))))
            (emms-completing-read "Playlist buffer to make current: "
-                                 buf-list nil t default))))
+                                 sorted-buf-list nil t default))))
   (let ((buf (if buffer
                  (get-buffer buffer)
                (current-buffer))))
-- 
Ian Dunn
_______________________________________________
Emms-help mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/emms-help

Reply via email to