[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 54/77: Better control of message emission in an easy-kill session
From: |
Leo Liu |
Subject: |
[elpa] 54/77: Better control of message emission in an easy-kill session |
Date: |
Sat, 05 Apr 2014 04:08:23 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit c6ac63b8dae90f10695b3b36eec1d8946061f475
Author: Leo Liu <address@hidden>
Date: Wed Oct 16 10:20:43 2013 +0800
Better control of message emission in an easy-kill session
---
easy-kill.el | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/easy-kill.el b/easy-kill.el
index ce1e136..f5bc25f 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -83,10 +83,14 @@ CHAR is used immediately following `easy-kill' to select
THING."
(mapcar 'car easy-kill-alist))
map))
+(defvar easy-kill-inhibit-message nil)
+
(defun easy-kill-message-nolog (format-string &rest args)
- "Same as `message' except not writing to *Messages* buffer."
- (let (message-log-max)
- (apply 'message format-string args)))
+ "Same as `message' except not writing to *Messages* buffer.
+Do nothing if `easy-kill-inhibit-message' is non-nil."
+ (unless easy-kill-inhibit-message
+ (let (message-log-max)
+ (apply 'message format-string args))))
(defun easy-kill-strip-trailing (s)
(cond ((stringp s)
@@ -114,10 +118,11 @@ CHAR is used immediately following `easy-kill' to select
THING."
(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)
- (easy-kill-thing thing n 'nomsg)
- (or (string= (easy-kill-candidate) "")
- (return)))
+ (let ((easy-kill-inhibit-message t))
+ (dolist (thing easy-kill-try-things)
+ (easy-kill-thing thing n)
+ (or (string= (easy-kill-candidate) "")
+ (return))))
o))
(defun easy-kill-indicate-origin ()
@@ -227,7 +232,7 @@ candidate property instead."
(easy-kill-adjust-candidate thing nil new-end)
t)))))
-(defun easy-kill-thing (&optional thing n nomsg inhibit-handler)
+(defun easy-kill-thing (&optional thing n inhibit-handler)
;; N can be -, + and digits
(interactive
(list (cdr (assq last-command-event easy-kill-alist))
@@ -248,8 +253,7 @@ candidate property instead."
(n n))))
(t (let ((bounds (bounds-of-thing-at-point thing)))
(if (not bounds)
- (unless nomsg
- (easy-kill-message-nolog "No `%s'" thing))
+ (easy-kill-message-nolog "No `%s'" thing)
(easy-kill-adjust-candidate thing (car bounds) (cdr bounds))
(easy-kill-thing-forward (1- n))))))
(when easy-kill-mark
@@ -282,8 +286,7 @@ candidate property instead."
(let ((beg (overlay-start easy-kill-candidate))
(end (overlay-end easy-kill-candidate)))
(if (= beg end)
- (when (called-interactively-p 'interact)
- (easy-kill-message-nolog "Empty region"))
+ (easy-kill-message-nolog "Empty region")
(set-mark beg)
(goto-char end)
(activate-mark))))
@@ -377,7 +380,7 @@ party; +, full path."
Char properties `help-echo', `shr-url' and `w3m-href-anchor' are
inspected."
(if (or easy-kill-mark (bounds-of-thing-at-point 'url))
- (easy-kill-thing 'url nil t t)
+ (easy-kill-thing 'url nil t)
(let ((get-url (lambda (text)
(when (stringp text)
(with-temp-buffer
@@ -394,7 +397,7 @@ inspected."
(easy-kill-adjust-candidate 'url url)
(return url)))))))
-;;; Handler for `list'.
+;;; Handler for `sexp' and `list'.
(defvar up-list-fn) ; Dynamically bound
@@ -448,7 +451,7 @@ inspected."
(easy-kill-adjust-candidate 'list nil new-end))))
(t (save-excursion
(ignore-errors (easy-kill-backward-up))
- (easy-kill-thing 'sexp n nil t)
+ (easy-kill-thing 'sexp n t)
(overlay-put easy-kill-candidate 'thing 'list))))))
(defun easy-kill-on-list (n)
@@ -459,13 +462,13 @@ inspected."
(let ((bounds (easy-kill-bounds-of-list n)))
(when bounds
(easy-kill-adjust-candidate 'list (car bounds) (cdr bounds)))))
- (t (easy-kill-thing 'list n nil t))))
+ (t (easy-kill-thing 'list n t))))
(defun easy-kill-on-sexp (n)
(let ((nxml-sexp-element-flag t))
(if (memq n '(+ -))
(easy-kill-on-list n)
- (easy-kill-thing 'sexp n nil t))))
+ (easy-kill-thing 'sexp n t))))
(provide 'easy-kill)
;;; easy-kill.el ends here
- [elpa] 47/77: Doc fix and small tweaks, (continued)
- [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
- [elpa] 53/77: Destroy after-string before goto-char in easy-kill-abort, Leo Liu, 2014/04/05
- [elpa] 54/77: Better control of message emission in an easy-kill session,
Leo Liu <=
- [elpa] 63/77: Teach easy-kill-activate-keymap to handle command remapping, Leo Liu, 2014/04/05
- [elpa] 59/77: Doc fix, Leo Liu, 2014/04/05
- [elpa] 64/77: Teach easy-kill to handle rectangle-mark from Emacs trunk, Leo Liu, 2014/04/05
- [elpa] 56/77: Doc fix and release v0.9.0, Leo Liu, 2014/04/05
- [elpa] 61/77: Optimise easy-kill-thing-forward when n is 0, Leo Liu, 2014/04/05
- [elpa] 62/77: Small tweak to easy-kill-on-nxml-element, Leo Liu, 2014/04/05
- [elpa] 60/77: Make easy-kill-on-buffer-file-name do nothing in easy-mark, Leo Liu, 2014/04/05
- [elpa] 68/77: Fix easy-kill-append to update clipboard, Leo Liu, 2014/04/05
- [elpa] 65/77: Fix #8: Don't strip trailing blank chars, Leo Liu, 2014/04/05
- [elpa] 67/77: New handler for defun-name and bind it to `D', Leo Liu, 2014/04/05