* bug#44093: [PATCH] some patches for lisp/mpc.el
@ 2020-10-20 7:32 tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-10-20 11:22 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-10-20 7:32 UTC (permalink / raw
To: 44093
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#44093: [PATCH] some patches for lisp/mpc.el
2020-10-20 7:32 bug#44093: [PATCH] some patches for lisp/mpc.el tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-10-20 11:22 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-20 11:22 UTC (permalink / raw
To: tsuucat; +Cc: 44093
tsuucat <tsuucat@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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-20 11:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-20 7:32 bug#44093: [PATCH] some patches for lisp/mpc.el tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-10-20 11:22 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.