From 7b3d06420b46ec37d6d0c033f04b0a9c50717fa8 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Fri, 29 Aug 2008 16:40:53 +0300 Subject: Prevent interactive yanking from messing up the playlist buffer. Usually, emms-playlist-mode tries not to alter the standard Emacs editing behavior, so that killing and yanking work exactly like they would everywhere else in Emacs. But having two Emms tracks in the emms-playlist-mode buffer on the same line doesn't make sense. This should stop yank commands from doing that. Signed-off-by: Yoni Rabkin --- lisp/emms-playlist-mode.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lisp') diff --git a/lisp/emms-playlist-mode.el b/lisp/emms-playlist-mode.el index e74010f..f5daa25 100644 --- a/lisp/emms-playlist-mode.el +++ b/lisp/emms-playlist-mode.el @@ -389,20 +389,28 @@ set it as current." (kill-region (region-beginning) (region-end)))) +(defun emms-playlist-mode-correct-previous-yank () + "Fix the previous yank if needed." + (when (and (< (point-at-bol) (point)) + (< (point) (point-at-eol))) + (newline))) + ;; C-y (defun emms-playlist-mode-yank () "Yank into the playlist buffer." (interactive) (emms-with-inhibit-read-only-t (goto-char (point-at-bol)) - (yank))) + (yank) + (emms-playlist-mode-correct-previous-yank))) ;; M-y (defun emms-playlist-mode-yank-pop () "Cycle through the kill-ring." (interactive) (emms-with-inhibit-read-only-t - (yank-pop nil))) + (yank-pop nil) + (emms-playlist-mode-correct-previous-yank))) ;;; -------------------------------------------------------- ;;; Overlay -- cgit v1.2.3