leoliu pushed a commit to branch master
in repository elpa.
commit dae04fe6028196bb91b216b6a321d8a31549fcb3
Author: Leo Liu <[email protected]>
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)