emms-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emms-patches] [COMMIT] Prevent interactive yanking from messing up the


From: Yoni Rabkin
Subject: [Emms-patches] [COMMIT] Prevent interactive yanking from messing up the playlist buffer.
Date: Fri, 29 Aug 2008 16:40:53 +0300

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 <address@hidden>
---
 lisp/emms-playlist-mode.el |   12 ++++++++++--
 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
-- 
debian.1.5.6.1.19.ge6b2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]