[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e3fa592: Fix some mpc.el updating quirks
From: |
Lars Ingebrigtsen |
Subject: |
master e3fa592: Fix some mpc.el updating quirks |
Date: |
Tue, 20 Oct 2020 07:20:56 -0400 (EDT) |
branch: master
commit e3fa592899f6999fda9fdaaab3929f346ce67f66
Author: Masahiro Nakamura <tsuucat@icloud.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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.
---
lisp/mpc.el | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/lisp/mpc.el b/lisp/mpc.el
index d22b7ab..fade23e 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 ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master e3fa592: Fix some mpc.el updating quirks,
Lars Ingebrigtsen <=