diff options
author | Yoni Rabkin <yrk@gnu.org> | 2014-10-25 20:17:20 -0400 |
---|---|---|
committer | Yoni Rabkin <yrk@gnu.org> | 2014-10-25 20:17:20 -0400 |
commit | d67c1a10a62e81088d5a49cbf13f9247804cfe6e (patch) | |
tree | 97cda6b552cef57316412a0dc26470e457af533b | |
parent | 6b5fa99bbecaace60d0879f54b5e6fa74bbc84a1 (diff) |
Change the way lines are killed in emms-playlist-mode.
This change was requested by Rasmus and Michael Olson.
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | lisp/emms-playlist-mode.el | 29 |
2 files changed, 19 insertions, 14 deletions
@@ -1,3 +1,7 @@ +News since version 4.0: + + - Change the default behavior of C-k in emms-playlist-mode. + News since version 3.0: - Add GNU FM support. diff --git a/lisp/emms-playlist-mode.el b/lisp/emms-playlist-mode.el index 7f4d776..e8972c0 100644 --- a/lisp/emms-playlist-mode.el +++ b/lisp/emms-playlist-mode.el @@ -52,6 +52,9 @@ (defvar emms-playlist-mode-popup-enabled nil "True when the playlist was called as a popup window.") +(defvar emms-playlist-mode-kill-whole-line-p t + "When true line kills behave like a typical music player.") + (make-variable-buffer-local 'emms-playlist-mode-selected-overlay) @@ -129,7 +132,7 @@ This is true for every invocation of `emms-playlist-mode-go'." (define-key map (kbd "M-p") 'emms-playlist-mode-previous) (define-key map (kbd "a") 'emms-playlist-mode-add-contents) (define-key map (kbd "b") 'emms-playlist-set-playlist-buffer) - (define-key map (kbd "D") 'emms-playlist-mode-kill-entire-track) + (define-key map (kbd "D") 'emms-playlist-mode-kill-track) (define-key map (kbd "n") 'emms-next) (define-key map (kbd "p") 'emms-previous) (define-key map (kbd "SPC") 'scroll-up) @@ -346,7 +349,7 @@ set it as current." (and (<= a p) (<= p b))) -;; d +;; D (defun emms-playlist-mode-kill-entire-track () "Kill track at point, including newline." (interactive) @@ -354,23 +357,21 @@ set it as current." (emms-playlist-mode-kill-track))) ;; C-k -;; -;; Currently this kills as regular GNU/Emacs would and not like a -;; typical music player would. (defun emms-playlist-mode-kill-track () "Kill track at point." (interactive) (emms-with-inhibit-read-only-t (let ((track (emms-playlist-track-at))) - (if track - (let ((track-region (emms-property-region (point) - 'emms-track))) - (when (and emms-player-playing-p - (emms-playlist-selected-track-at-p)) - (emms-stop) - (delete-overlay emms-playlist-mode-selected-overlay) - (setq emms-playlist-mode-selected-overlay nil)) - (kill-line)) + (when track + (let ((track-region (emms-property-region (point) + 'emms-track))) + (when (and emms-player-playing-p + (emms-playlist-selected-track-at-p)) + (emms-stop) + (delete-overlay emms-playlist-mode-selected-overlay) + (setq emms-playlist-mode-selected-overlay nil)))) + (let ((kill-whole-line emms-playlist-mode-kill-whole-line-p)) + (goto-char (point-at-bol)) (kill-line))))) ;; C-w |