1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

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.
This commit is contained in:
Masahiro Nakamura 2020-10-20 13:20:48 +02:00 committed by Lars Ingebrigtsen
parent 2e2a8e5491
commit e3fa592899

View File

@ -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 ()