[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 44/77: Fix #7: Add new command easy-kill-abort for key C-g
From: |
Leo Liu |
Subject: |
[elpa] 44/77: Fix #7: Add new command easy-kill-abort for key C-g |
Date: |
Sat, 05 Apr 2014 04:08:20 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 1c7f946dfa83aba9fc18be603993e6e7790abb0c
Author: Leo Liu <address@hidden>
Date: Sun Oct 13 10:03:16 2013 +0800
Fix #7: Add new command easy-kill-abort for key C-g
---
easy-kill.el | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/easy-kill.el b/easy-kill.el
index 7523844..15059ee 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -67,6 +67,7 @@ CHAR is used immediately following `easy-kill' to select
THING."
(define-key map "@" 'easy-kill-append)
(define-key map " " 'easy-kill-mark-region)
(define-key map "\C-w" 'easy-kill-region)
+ (define-key map "\C-g" 'easy-kill-abort)
(mapc (lambda (d)
(define-key map (number-to-string d) 'easy-kill-digit-argument))
(number-sequence 0 9))
@@ -241,6 +242,14 @@ candidate property instead."
(when easy-kill-mark
(easy-kill-adjust-candidate (overlay-get easy-kill-candidate 'thing)))))
+(put 'easy-kill-abort 'easy-kill-exit t)
+(defun easy-kill-abort ()
+ (interactive)
+ (when easy-kill-mark
+ (goto-char (overlay-get easy-kill-candidate 'origin))
+ (setq deactivate-mark t))
+ (ding))
+
(put 'easy-kill-region 'easy-kill-exit t)
(defun easy-kill-region ()
"Kill current selection and exit."
@@ -285,8 +294,7 @@ candidate property instead."
(easy-kill-destroy-candidate)
(unless (and (symbolp this-command)
(get this-command 'easy-kill-exit))
- (easy-kill-save-candidate))
- (setq easy-kill-mark nil))))))))
+ (easy-kill-save-candidate)))))))))
;;;###autoload
(defun easy-kill (&optional n)
@@ -303,6 +311,7 @@ Temporally activate additional key bindings as follows:
(interactive "p")
(if (use-region-p)
(kill-ring-save (region-beginning) (region-end))
+ (setq easy-kill-mark nil)
(setq easy-kill-append (eq last-command 'kill-region))
(easy-kill-init-candidate n)
(when (zerop (buffer-size))
- [elpa] 34/77: Better support for defining commands that exit easy-kill, (continued)
- [elpa] 34/77: Better support for defining commands that exit easy-kill, Leo Liu, 2014/04/05
- [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 <=
- [elpa] 45/77: Better origin indicator by easy-kill-indicate-origin, Leo Liu, 2014/04/05
- [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