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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44093 in the body.
You can then email your comments to 44093 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#44093; Package emacs. (Tue, 20 Oct 2020 07:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to tsuucat <tsuucat <at> icloud.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 20 Oct 2020 07:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: tsuucat <tsuucat <at> icloud.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [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



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44093; Package emacs. (Tue, 20 Oct 2020 11:23:02 GMT) Full text and rfc822 format available.

Message #8 received at 44093 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: tsuucat <tsuucat <at> icloud.com>
Cc: 44093 <at> debbugs.gnu.org
Subject: Re: bug#44093: [PATCH] some patches for lisp/mpc.el
Date: Tue, 20 Oct 2020 13:22:03 +0200
tsuucat <tsuucat <at> icloud.com> writes:

> I made three small patches for lisp/mpc.el.

Thanks; looks good to me, so I've applied them to Emacs 28.

In the future, though, sending multiple small changes like this in a
single patch would be preferred, and if the patch could be accompanied
with a ChangeLog-style commit message, that would be nice.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 20 Oct 2020 11:23:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 44093 <at> debbugs.gnu.org and tsuucat <tsuucat <at> icloud.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 20 Oct 2020 11:23:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 17 Nov 2020 12:24:08 GMT) Full text and rfc822 format available.

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

Previous Next


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