summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-12-14 15:16:44 +0800
committerJSDurand <mmemmew@gmail.com>2021-12-14 15:16:44 +0800
commit3057cdcd5090e0ee82de5335e01d8c3620bbb7bc (patch)
treef7412d2a4c02c1befccfb8848806f203a42a037c
parent90770f14eea105f7f1609b49309e25e151296650 (diff)
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.
-rw-r--r--bongo.el16
1 files changed, 16 insertions, 0 deletions
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