From: Masahiro Nakamura Date: Tue, 20 Oct 2020 11:20:48 +0000 (+0200) Subject: Fix some mpc.el updating quirks X-Git-Tag: emacs-28.0.90~5528 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e3fa592899f6999fda9fdaaab3929f346ce67f66;p=emacs.git 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. --- 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." (defun mpc-cmd-status () (mpc-proc-cmd-to-alist "status")) -(defun mpc-cmd-play () - (mpc-proc-cmd "play") +(defun mpc-cmd-play (&optional sn) + (mpc-proc-cmd (if sn (list "play" sn) "play")) (mpc-status-refresh)) (defun mpc-cmd-seekcur (time) @@ -849,7 +849,7 @@ If PLAYLIST is t or nil or missing, use the main playlist." ;; Sort them from last to first, so the renumbering ;; caused by the earlier deletions don't affect ;; later ones. - (sort song-poss '>)))) + (sort (copy-sequence song-poss) '>)))) (if (stringp playlist) (puthash (cons 'Playlist playlist) nil mpc--find-memoize))) @@ -873,7 +873,7 @@ If PLAYLIST is t or nil or missing, use the main playlist." ;; Sort them from last to first, so the renumbering ;; caused by the earlier deletions affect ;; later ones a bit less. - (sort song-poss '>)))) + (sort (copy-sequence song-poss) '>)))) (if (stringp playlist) (puthash (cons 'Playlist playlist) nil mpc--find-memoize)))) @@ -2089,7 +2089,7 @@ This is used so that they can be compared with `eq', which is needed for ((null (with-current-buffer plbuf (re-search-forward re nil t))) ;; song-file only appears once in the playlist: no ambiguity, ;; we're good to go! - (mpc-proc-cmd (list "play" sn))) + (mpc-cmd-play sn)) (t ;; The song appears multiple times in the playlist. If the current ;; 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 (interactive) (mpc-cmd-stop) (mpc-cmd-clear) + (mpc-songs-refresh) (mpc-status-refresh)) (defun mpc-pause ()