GNU bug report logs - #44093
[PATCH] some patches for lisp/mpc.el

Previous Next

Package: emacs;

Reported by: tsuucat <tsuucat <at> icloud.com>

Date: Tue, 20 Oct 2020 07:33:02 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: tsuucat <tsuucat <at> icloud.com>
To: 44093 <at> debbugs.gnu.org
Subject: bug#44093: [PATCH] some patches for lisp/mpc.el
Date: Tue, 20 Oct 2020 16:32:26 +0900
I made three small patches for lisp/mpc.el.

1.
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. (also fix mpc-cmd-move for
same reason)

diff --git a/lisp/mpc.el b/lisp/mpc.el
index d22b7ab450..e5f5984a33 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -849,7 +849,7 @@ mpc-cmd-delete
                          ;; 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 @@ mpc-cmd-move
               ;; 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))))

2.
M-x mpc-songs-jump-to doesn’t update *MPC-Status* buffer.
Use mpc-cmd-play.

diff --git a/lisp/mpc.el b/lisp/mpc.el
index d22b7ab450..a0f79e0492 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -819,8 +819,8 @@ mpc-cmd-pause
 (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)
@@ -2089,7 +2089,7 @@ mpc-songs-jump-to
      ((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
@@ -2125,7 +2125,7 @@ mpc-songs-jump-to

3.
M-x mpc-stop clears playlist queue. So updating *MPC-Songs* buffer
is useful.

diff --git a/lisp/mpc.el b/lisp/mpc.el
index d22b7ab450..405e669660 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -2391,6 +2391,7 @@ mpc-stop
   (interactive)
   (mpc-cmd-stop)
   (mpc-cmd-clear)
+  (mpc-songs-refresh)
   (mpc-status-refresh))

 (defun mpc-pause ()


Please review these patches.

Do I have to squash these patches to one commit?

--
tsuucat



This bug report was last modified 4 years and 212 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.