emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] 45/77: Better origin indicator by easy-kill-indicate-origin


From: Leo Liu
Subject: [elpa] 45/77: Better origin indicator by easy-kill-indicate-origin
Date: Sat, 05 Apr 2014 04:08:20 +0000

leoliu pushed a commit to branch master
in repository elpa.

commit fcec04c90db9ba4efda6355c2c0defd31c65499c
Author: Leo Liu <address@hidden>
Date:   Sun Oct 13 16:58:00 2013 +0800

    Better origin indicator by easy-kill-indicate-origin
---
 easy-kill.el |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/easy-kill.el b/easy-kill.el
index 15059ee..d422e9b 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -108,10 +108,10 @@ CHAR is used immediately following `easy-kill' to select 
THING."
     ;; `hl-line-mode'.
     (overlay-put o 'priority 999)
     (when easy-kill-mark
-      (let ((i (make-overlay (point)
-                             (funcall (if (eolp) #'1- #'1+) (point)))))
+      (let ((i (make-overlay (point) (point))))
         (overlay-put i 'priority (1+ (overlay-get o 'priority)))
         (overlay-put i 'face 'easy-kill-origin)
+        (overlay-put i 'as (propertize " " 'face 'easy-kill-origin))
         (overlay-put o 'origin-indicator i)))
     (setq easy-kill-candidate o)
     (dolist (thing easy-kill-try-things)
@@ -120,6 +120,18 @@ CHAR is used immediately following `easy-kill' to select 
THING."
           (return)))
     o))
 
+(defun easy-kill-indicate-origin ()
+  (let ((i (overlay-get easy-kill-candidate 'origin-indicator))
+        (origin (overlay-get easy-kill-candidate 'origin)))
+    (cond
+     ((not (overlayp i)) nil)
+     ((= origin (point))
+      (overlay-put i 'after-string nil))
+     ((memq (char-after origin) '(?\t ?\n))
+      (overlay-put i 'after-string (overlay-get i 'as)))
+     (t (move-overlay i origin (1+ origin))
+        (overlay-put i 'after-string nil)))))
+
 (defun easy-kill-candidate ()
   "Get the kill candidate as a string.
 If the overlay specified by variable `easy-kill-candidate' has
@@ -147,7 +159,8 @@ candidate property instead."
           (overlay-put o 'candidate beg)
           (easy-kill-message-nolog "%s" beg))
       (move-overlay o beg end))
-    (cond (easy-kill-mark (easy-kill-mark-region))
+    (cond (easy-kill-mark (easy-kill-mark-region)
+                          (easy-kill-indicate-origin))
           ((and interprogram-cut-function
                 (not (string= (easy-kill-candidate) "")))
            (funcall interprogram-cut-function (easy-kill-candidate))))))



reply via email to

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