From 3057cdcd5090e0ee82de5335e01d8c3620bbb7bc Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 14 Dec 2021 15:16:44 +0800 Subject: bongo: bind x to stop and kill the buffer * bongo.el ("bongo-playlist-mode-map"): Bind x to the following command. (durand-bongo-stop-and-exit): Stop playing, and stop the player, and then kill the buffer. --- bongo.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bongo.el b/bongo.el index 09919e5..7aa33ec 100644 --- a/bongo.el +++ b/bongo.el @@ -78,6 +78,7 @@ This is used since my music directories used to contain symbolic links.") (define-key bongo-dired-library-mode-map [?\C-c ?n] #'durand-bongo-play-next-or-first) (define-key bongo-dired-library-mode-map [?\C-c ?p] #'durand-bongo-play-previous-or-last) (define-key bongo-playlist-mode-map [?\C-d] #'prot/bongo-clear-playlist-and-stop) + (define-key bongo-playlist-mode-map [?x] #'durand-bongo-stop-and-exit) (define-key bongo-playlist-mode-map [?I] #'durand-bongo-insert-delete-playlist) (define-key bongo-dired-library-mode-map [C-return] #'prot/bongo-library-insert-and-play-random) @@ -144,6 +145,8 @@ buffer." (bongo-stop) (bongo-erase-buffer))) + + ;;;###autoload (defun prot/bongo-play-random () "Play a random track with `bongo' and set random playback." @@ -615,6 +618,19 @@ Modified by Durand." (advice-add #'bongo-default-playlist-buffer :override #'durand-bongo-default-playlist-buffer-a) ) +;;; Stop playing and exit and kill the buffer + +(defun durand-bongo-stop-and-exit () + "Stop playing and exit and kill the buffer." + (interactive) + (bongo-stop) + (bongo-erase-buffer) + (cond + (bongo-player + (bongo-player-stop bongo-player) + (setq bongo-player nil))) + (kill-buffer)) + ;;; Improved bongo-mpv backend ;;;; Disable the tick timer as soon as possible -- cgit v1.2.3-18-g5258