[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))))))
- [elpa] 30/77: Merge pull request #6 from knu/usage-remap, (continued)
- [elpa] 30/77: Merge pull request #6 from knu/usage-remap, Leo Liu, 2014/04/05
- [elpa] 32/77: Improve easy-kill-bounds-of-list, Leo Liu, 2014/04/05
- [elpa] 37/77: Make easy-kill-backward-up work better when in strings, Leo Liu, 2014/04/05
- [elpa] 38/77: Fix #3: Add command easy-mark for marking, Leo Liu, 2014/04/05
- [elpa] 39/77: Fix doc and buglets in last change, Leo Liu, 2014/04/05
- [elpa] 40/77: Some improvements based on comments in #3, Leo Liu, 2014/04/05
- [elpa] 42/77: Must reference the actual object in easy-kill-candidate, Leo Liu, 2014/04/05
- [elpa] 43/77: Add new command easy-mark-sexp, Leo Liu, 2014/04/05
- [elpa] 41/77: Tell easy-kill-append to deactivate-mark, Leo Liu, 2014/04/05
- [elpa] 44/77: Fix #7: Add new command easy-kill-abort for key C-g, Leo Liu, 2014/04/05
- [elpa] 45/77: Better origin indicator by easy-kill-indicate-origin,
Leo Liu <=
- [elpa] 46/77: Teach easy-kill-abort to deactivate mark immediately, Leo Liu, 2014/04/05
- [elpa] 47/77: Doc fix and small tweaks, Leo Liu, 2014/04/05
- [elpa] 49/77: Work with `sexp' and `list' in nxml mode, Leo Liu, 2014/04/05
- [elpa] 52/77: Use filter-buffer-substring, Leo Liu, 2014/04/05
- [elpa] 51/77: Fix quoting error in face definitions, Leo Liu, 2014/04/05
- [elpa] 50/77: Fix last change to easy-kill-backward-up, Leo Liu, 2014/04/05
- [elpa] 55/77: Fix easy-kill-backward-down to handle prefix chars, Leo Liu, 2014/04/05
- [elpa] 48/77: Make command easy-kill-append work for easy-mark, Leo Liu, 2014/04/05
- [elpa] 57/77: Fix to always display the string candidate, Leo Liu, 2014/04/05
- [elpa] 58/77: Emacs 24.x compatibility, Leo Liu, 2014/04/05