[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] lisp/emms-mark.el: Fix bug in `emms-mark-mode' when in empty buf

From: Kierin Bell
Subject: [PATCH] lisp/emms-mark.el: Fix bug in `emms-mark-mode' when in empty buffers
Date: Sun, 26 Mar 2023 04:28:52 +0000

lisp/emms-mark.el (emms-mark-mode): Do not set
`emms-playlist-buffer-p' to t before calling `emms-playlist-mode' in
`emms-mark-mode'.  Otherwise, when `emms-mark-mode' is called in an
empty buffer, `emms-playlist-mode-startup' will erroneously call
`emms-playlist-select-first', causing the error "No first track".
Specifically, this error happens when
`emms-playlist-default-major-mode' is set to `emms-mark-mode' in an
Emacs startup file, as per the Emms manual, and then the user runs a
command like `emms-add-directory'.
This patch fixes a bug that causes an error when following instructions in the 
Emms manual to set `emms-playlist-default-major-mode' to `emms-mark-mode'. To 

Run emacs -Q

(require 'emms-setup)
(setq emms-playlist-default-major-mode 'emms-mark-mode)

Run command `emms-add-directory-tree' as normal to get error.

The use of `emms-playlist-buffer-p' looks to be a bit inconsistent and 
confusing in the code, but as far as I can tell, my patch hasn't broken 

 emms-mark.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emms-mark.el b/emms-mark.el
index b640e12..a32760b 100644
--- a/emms-mark.el
+++ b/emms-mark.el
@@ -260,9 +260,9 @@ this function collects the result of FUNC."
     ;; start emms-playlist-mode exactly once
-    (setq emms-playlist-buffer-p t)
     (unless (eq major-mode 'emms-playlist-mode)
+    (setq emms-playlist-buffer-p t)
     ;; use inherited keymap
     (set-keymap-parent emms-mark-mode-map (current-local-map))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]