[Top][All Lists]

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

[emms-help] Avoid emms-playlist-current-kill kill the buffer if there're

From: Carlos Pita
Subject: [emms-help] Avoid emms-playlist-current-kill kill the buffer if there're remaining playlists
Date: Fri, 4 Jan 2019 20:52:47 -0300


(Sorry for so many emails, I feel a bit embarrassed indeed, but I
started using emms yesterday and I like it very much but, as with
everything I like, I tend to become obsessed with details [1] :) )

Maybe I'm not quite understanding the rationale behind this, but I
find the behavior of K a bit annoying. I would have expected that once
you have more than one playlist, killing one would remain in the
playlist mode buffer, but showing another (the next) playlist. That
is, a workflow like: do M-n to reach some playlist, kill it with K,
perhaps bury the buffer with q afterwards. Indeed
emms-playlist-current-kill does something like that:

(defun emms-playlist-current-kill ()
  "Kill the current EMMS playlist buffer and switch to the next one."

But it has one quirk: despite the documented behavior (or due to? it's
ambiguous what to do when "the next one" doesn't exist) the last
playlist is never killed because emms-playlist-current-kill always
wants some other playlist to switch to. This could be a bug or could
have been designed so, I don't know.

In any case, K is bound to emms-playlist-mode-current-kill instead:

(defun emms-playlist-mode-current-kill ()
  "If the current buffer is an EMMS playlist buffer, kill it.
Otherwise, kill the current EMMS playlist buffer."
  (if (and emms-playlist-buffer-p
           (not (eq (current-buffer) emms-playlist-buffer)))
      (kill-buffer (current-buffer))

This will always kill the playlist buffer when it's current. Now, why
not call emms-playlist-current-kill in all cases (current or not) and
then kill the current buffer only if it's a playlist buffer and there
is only one remaining playlist? I think that would be a less
surprising behavior. Also more convenient if you're editing/cleaning
up your playlists: M-p/n, K, q, is a good alternative to meta playlist

Best regards

[1] https://en.wikipedia.org/wiki/Law_of_triviality

reply via email to

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