[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 22/77: Handle the case when overlay has already been destroyed
From: |
Leo Liu |
Subject: |
[elpa] 22/77: Handle the case when overlay has already been destroyed |
Date: |
Sat, 05 Apr 2014 04:08:14 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit c1935fa3518ca48dc32d25b2a42230cab2a9a0b2
Author: Leo Liu <address@hidden>
Date: Tue Oct 8 19:03:42 2013 +0800
Handle the case when overlay has already been destroyed
---
easy-kill.el | 40 +++++++++++++++++++++++-----------------
1 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/easy-kill.el b/easy-kill.el
index 48319d6..8e56de4 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -79,7 +79,9 @@ CHAR is used immediately following `easy-kill' to select
THING."
(t "")))
(defvar easy-kill-exit nil
- "Tell `set-temporary-overlay-map' to exit if non-nil.")
+ "Tell `set-temporary-overlay-map' to exit if non-nil.
+Note: exit only happens right before next command per
+`set-temporary-overlay-map'.")
(defvar easy-kill-candidate nil)
@@ -177,25 +179,29 @@ candidate property instead."
(defun easy-kill-region ()
"Kill current selection and exit."
(interactive "*")
- (let ((beg (overlay-start easy-kill-candidate))
- (end (overlay-end easy-kill-candidate)))
- (if (= beg end)
- (easy-kill-message-nolog "Empty region")
- (setq easy-kill-exit t)
- (easy-kill-adjust-candidate nil "")
- (kill-region beg end))))
+ (if (not easy-kill-candidate) ; `easy-kill' has exited
+ (push last-input-event unread-command-events)
+ (let ((beg (overlay-start easy-kill-candidate))
+ (end (overlay-end easy-kill-candidate)))
+ (if (= beg end)
+ (easy-kill-message-nolog "Empty region")
+ (setq easy-kill-exit t)
+ (easy-kill-adjust-candidate nil "")
+ (kill-region beg end)))))
(defun easy-kill-mark-region ()
(interactive)
- (let ((beg (overlay-start easy-kill-candidate))
- (end (overlay-end easy-kill-candidate)))
- (if (= beg end)
- (easy-kill-message-nolog "Empty region")
- (setq easy-kill-exit t)
- (easy-kill-adjust-candidate nil "")
- (set-mark beg)
- (goto-char end)
- (activate-mark))))
+ (if (not easy-kill-candidate)
+ (push last-input-event unread-command-events)
+ (let ((beg (overlay-start easy-kill-candidate))
+ (end (overlay-end easy-kill-candidate)))
+ (if (= beg end)
+ (easy-kill-message-nolog "Empty region")
+ (setq easy-kill-exit t)
+ (easy-kill-adjust-candidate nil "")
+ (set-mark beg)
+ (goto-char end)
+ (activate-mark)))))
(defun easy-kill-activate-keymap ()
(let ((map (easy-kill-map)))
- [elpa] 12/77: Tweak the definition of thing `region', (continued)
- [elpa] 12/77: Tweak the definition of thing `region', Leo Liu, 2014/04/05
- [elpa] 13/77: New command easy-kill-region to kill current selection, Leo Liu, 2014/04/05
- [elpa] 10/77: New function easy-kill-adjust-candidate and doc fix, Leo Liu, 2014/04/05
- [elpa] 16/77: Make function easy-kill-candidate always return string, Leo Liu, 2014/04/05
- [elpa] 17/77: Fix error: (args-out-of-range 1009 1035), Leo Liu, 2014/04/05
- [elpa] 15/77: Some string and comment fixes, Leo Liu, 2014/04/05
- [elpa] 23/77: Use parse-partial-sexp in easy-kill-bounds-of-list, Leo Liu, 2014/04/05
- [elpa] 20/77: Replace `enlarge' with `expand' in strings and comments, Leo Liu, 2014/04/05
- [elpa] 19/77: Add lispy treatment for +/- on list and sexp, Leo Liu, 2014/04/05
- [elpa] 14/77: Doc fix and release v0.7.0, Leo Liu, 2014/04/05
- [elpa] 22/77: Handle the case when overlay has already been destroyed,
Leo Liu <=
- [elpa] 25/77: Fix thinko in easy-kill-backward-down, Leo Liu, 2014/04/05
- [elpa] 21/77: New command easy-kill-mark-region, Leo Liu, 2014/04/05
- [elpa] 24/77: Improve list expand/shrink support in smie-based modes, Leo Liu, 2014/04/05
- [elpa] 18/77: Consolidate all kill features in easy-kill-thing, Leo Liu, 2014/04/05
- [elpa] 26/77: Fix #2: just call kill-ring-save when region is active, Leo Liu, 2014/04/05
- [elpa] 27/77: Declare dependency on emacs 24, Leo Liu, 2014/04/05
- [elpa] 29/77: Merge pull request #4 from purcell/patch-1, Leo Liu, 2014/04/05
- [elpa] 31/77: Simplify the interactive form of easy-kill-thing, Leo Liu, 2014/04/05
- [elpa] 28/77: [remap kill-ring-save] should be a better key binding for this feature., Leo Liu, 2014/04/05
- [elpa] 35/77: Doc fix and release v0.8.0, Leo Liu, 2014/04/05