aboutsummaryrefslogtreecommitdiff
path: root/lisp/emms-playlist-mode.el
diff options
context:
space:
mode:
authorYoni Rabkin <yonirabkin@member.fsf.org>2008-08-29 16:40:53 +0300
committerYoni Rabkin <yonirabkin@member.fsf.org>2008-08-29 16:40:53 +0300
commit7b3d06420b46ec37d6d0c033f04b0a9c50717fa8 (patch)
tree9e383fe11ffb9c859d00763eb78876c4e5efab0a /lisp/emms-playlist-mode.el
parent36b3d963b1ff780914a7e690a34cd0ba3a65043a (diff)
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 <yonirabkin@member.fsf.org>
Diffstat (limited to 'lisp/emms-playlist-mode.el')
-rw-r--r--lisp/emms-playlist-mode.el12
1 files changed, 10 insertions, 2 deletions
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