branch: externals/mpdired commit 8bf8e8f366b6c20e3d21922105cc10d04de3cdd4 Author: Manuel Giraud <man...@ledu-giraud.fr> Commit: Manuel Giraud <man...@ledu-giraud.fr>
playlist deletion Only one at a time for now. --- mpdired.el | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/mpdired.el b/mpdired.el index c75ac8a749..3784a0f2eb 100644 --- a/mpdired.el +++ b/mpdired.el @@ -660,6 +660,16 @@ an optional communication buffer." (process-send-string process "playlistid\n") (process-send-string process "command_list_end\n"))) +(defun mpdired-remove-playlist-internal (uri) + (mpdired--with-comm-buffer process nil + (setq mpdired--last-command 'remove-playlist) + (process-send-string process "command_list_begin\n") + (if (listp uri) + (dolist (u uri) + (process-send-string process (format "rm \"%s\"\n" u))) + (process-send-string process (format "rm \"%s\"\n" uri))) + (process-send-string process "command_list_end\n"))) + (defun mpdired-pause-internal (&optional buffer) "Toggle pause." (interactive) @@ -1034,11 +1044,23 @@ In the queue view, start playing the song at point." (get-text-property bol 'id))))) (mpdired-deleteid-internal id)))) +(defun mpdired-remove-playlist-at-point () + (let* ((bol (mpdired--bol)) + (uri (get-text-property bol 'uri)) + (type (get-text-property bol 'type))) + (when (and type uri + (eq type 'playlist)) + (mpdired--append-message (format "Removing \"%s\"..." uri)) + (mpdired-remove-playlist-internal uri)))) + (defun mpdired-delete () - "Remove song at point from the queue." + "Remove song at point from the queue or playlist at point from the +browser view." (interactive) (cond ((eq mpdired--view 'queue) - (mpdired-deleteid-at-point)))) + (mpdired-deleteid-at-point)) + ((eq mpdired--view 'browser) + (mpdired-remove-playlist-at-point)))) (defun mpdired--find-next-unmarked-id () (save-excursion