aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Nakamura2020-10-20 13:20:48 +0200
committerLars Ingebrigtsen2020-10-20 13:20:48 +0200
commite3fa592899f6999fda9fdaaab3929f346ce67f66 (patch)
tree738182d0d662aa5a663c803636e3dc51868cb442
parent2e2a8e5491bc6259a9ebe8c703c1c501307953e2 (diff)
downloademacs-e3fa592899f6999fda9fdaaab3929f346ce67f66.tar.gz
emacs-e3fa592899f6999fda9fdaaab3929f346ce67f66.zip
Fix some mpc.el updating quirks
* lisp/mpc.el (mpc-songs-jump-to): Update the status buffer. * lisp/mpc.el (mpc-stop): M-x mpc-stop clears playlist queue. So updating *MPC-Songs* buffer is useful. * lisp/mpc.el (mpc-cmd-delete): I noticed M-x mpc-playlist-delete always messages “Deleted 1 songs” even if playlist queue has more than one songs. This is because mpc-cmd-delete’s sort modifies songs-poss by side effect. Using copy-sequence fixes this (bug#44093). * lisp/mpc.el (mpc-cmd-move): Ditto.
-rw-r--r--lisp/mpc.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/mpc.el b/lisp/mpc.el
index d22b7ab4506..fade23e3cc2 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -819,8 +819,8 @@ The songs are returned as alists."
819(defun mpc-cmd-status () 819(defun mpc-cmd-status ()
820 (mpc-proc-cmd-to-alist "status")) 820 (mpc-proc-cmd-to-alist "status"))
821 821
822(defun mpc-cmd-play () 822(defun mpc-cmd-play (&optional sn)
823 (mpc-proc-cmd "play") 823 (mpc-proc-cmd (if sn (list "play" sn) "play"))
824 (mpc-status-refresh)) 824 (mpc-status-refresh))
825 825
826(defun mpc-cmd-seekcur (time) 826(defun mpc-cmd-seekcur (time)
@@ -849,7 +849,7 @@ If PLAYLIST is t or nil or missing, use the main playlist."
849 ;; Sort them from last to first, so the renumbering 849 ;; Sort them from last to first, so the renumbering
850 ;; caused by the earlier deletions don't affect 850 ;; caused by the earlier deletions don't affect
851 ;; later ones. 851 ;; later ones.
852 (sort song-poss '>)))) 852 (sort (copy-sequence song-poss) '>))))
853 (if (stringp playlist) 853 (if (stringp playlist)
854 (puthash (cons 'Playlist playlist) nil mpc--find-memoize))) 854 (puthash (cons 'Playlist playlist) nil mpc--find-memoize)))
855 855
@@ -873,7 +873,7 @@ If PLAYLIST is t or nil or missing, use the main playlist."
873 ;; Sort them from last to first, so the renumbering 873 ;; Sort them from last to first, so the renumbering
874 ;; caused by the earlier deletions affect 874 ;; caused by the earlier deletions affect
875 ;; later ones a bit less. 875 ;; later ones a bit less.
876 (sort song-poss '>)))) 876 (sort (copy-sequence song-poss) '>))))
877 (if (stringp playlist) 877 (if (stringp playlist)
878 (puthash (cons 'Playlist playlist) nil mpc--find-memoize)))) 878 (puthash (cons 'Playlist playlist) nil mpc--find-memoize))))
879 879
@@ -2089,7 +2089,7 @@ This is used so that they can be compared with `eq', which is needed for
2089 ((null (with-current-buffer plbuf (re-search-forward re nil t))) 2089 ((null (with-current-buffer plbuf (re-search-forward re nil t)))
2090 ;; song-file only appears once in the playlist: no ambiguity, 2090 ;; song-file only appears once in the playlist: no ambiguity,
2091 ;; we're good to go! 2091 ;; we're good to go!
2092 (mpc-proc-cmd (list "play" sn))) 2092 (mpc-cmd-play sn))
2093 (t 2093 (t
2094 ;; The song appears multiple times in the playlist. If the current 2094 ;; The song appears multiple times in the playlist. If the current
2095 ;; buffer holds not only the destination song but also the current 2095 ;; buffer holds not only the destination song but also the current
@@ -2391,6 +2391,7 @@ This is used so that they can be compared with `eq', which is needed for
2391 (interactive) 2391 (interactive)
2392 (mpc-cmd-stop) 2392 (mpc-cmd-stop)
2393 (mpc-cmd-clear) 2393 (mpc-cmd-clear)
2394 (mpc-songs-refresh)
2394 (mpc-status-refresh)) 2395 (mpc-status-refresh))
2395 2396
2396(defun mpc-pause () 2397(defun mpc-pause ()