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

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

[elpa] 05/77: Call interprogram-cut-function in easy-kill-forward


From: Leo Liu
Subject: [elpa] 05/77: Call interprogram-cut-function in easy-kill-forward
Date: Sat, 05 Apr 2014 04:08:10 +0000

leoliu pushed a commit to branch master
in repository elpa.

commit dae04fe6028196bb91b216b6a321d8a31549fcb3
Author: Leo Liu <address@hidden>
Date:   Sun Oct 6 11:49:15 2013 +0800

    Call interprogram-cut-function in easy-kill-forward
---
 easy-kill.el |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/easy-kill.el b/easy-kill.el
index dfd1456..a4922c2 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -61,6 +61,13 @@
       (buffer-substring (overlay-start easy-kill-candidate)
                         (overlay-end easy-kill-candidate)))))
 
+(defun easy-kill-select-text ()
+  "Make current kill candidate available to other programs."
+  (let ((candidate (easy-kill-candidate)))
+    (and candidate
+         interprogram-cut-function
+         (funcall interprogram-cut-function candidate))))
+
 (defun easy-kill-map ()
   (let ((map (make-sparse-keymap)))
     (define-key map "-" 'easy-kill-backward)
@@ -91,6 +98,7 @@
               (return))))
         (when (/= end (point))
           (move-overlay easy-kill-candidate start (point))
+          (easy-kill-select-text)
           t)))))
 
 (defun easy-kill-backward (n)
@@ -112,9 +120,7 @@
                        (overlay-put easy-kill-candidate 'thing thing)
                        (easy-kill-forward (1- n))
                        t))))))
-    ;; Immediately put it in clipboard for other applications.
-    (and interprogram-cut-function
-         (funcall interprogram-cut-function (or (easy-kill-candidate) "")))
+    (easy-kill-select-text)
     t))
 
 (defun easy-kill-select (n)



reply via email to

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