[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] lisp/emms-mark.el: Fix bug in `emms-mark-mode' when in empty
From: |
Yoni Rabkin |
Subject: |
Re: [PATCH] lisp/emms-mark.el: Fix bug in `emms-mark-mode' when in empty buffers |
Date: |
Tue, 28 Mar 2023 16:23:00 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Kierin Bell <fernseed@posteo.net> writes:
> 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 reproduce:
>
> Run emacs -Q
>
> (require 'emms-setup)
> (emms-all)
> (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
> anything!
>
> 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."
> nil
>
> ;; start emms-playlist-mode exactly once
> - (setq emms-playlist-buffer-p t)
> (unless (eq major-mode 'emms-playlist-mode)
> (emms-playlist-mode))
> + (setq emms-playlist-buffer-p t)
>
> ;; use inherited keymap
> (set-keymap-parent emms-mark-mode-map (current-local-map))
Patched; thank you
--
"Cut your own wood and it will warm you twice"