branch: externals/easy-kill commit de7d66c3c864a4722a973ee9bc228a14be49ba0c Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Leo Liu <sdl....@gmail.com>
Fix an obsolete form of with-demoted-errors and #' functions --- easy-kill.el | 54 ++++++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/easy-kill.el b/easy-kill.el index d68b4dd4c1..12c2d2cedc 100644 --- a/easy-kill.el +++ b/easy-kill.el @@ -27,13 +27,13 @@ ;; `easy-kill' aims to be a drop-in replacement for `kill-ring-save'. ;; -;; To use: (global-set-key [remap kill-ring-save] 'easy-kill) +;; To use: (global-set-key [remap kill-ring-save] #'easy-kill) ;; `easy-mark' is similar to `easy-kill' but marks the region ;; immediately. It can be a handy replacement for `mark-sexp' allowing ;; `+'/`-' to do list-wise expanding/shrinking. ;; -;; To use: (global-set-key [remap mark-sexp] 'easy-mark) +;; To use: (global-set-key [remap mark-sexp] #'easy-mark) ;; Please send bug reports or feature requests to: ;; https://github.com/leoliu/easy-kill/issues @@ -89,21 +89,21 @@ string) for appending current selection to previous kill." (defvar easy-kill-base-map (let ((map (make-sparse-keymap))) - (define-key map "-" 'easy-kill-shrink) - (define-key map "+" 'easy-kill-expand) - (define-key map "=" 'easy-kill-expand) - (define-key map " " 'easy-kill-cycle) - (define-key map "@" 'easy-kill-append) + (define-key map "-" #'easy-kill-shrink) + (define-key map "+" #'easy-kill-expand) + (define-key map "=" #'easy-kill-expand) + (define-key map " " #'easy-kill-cycle) + (define-key map "@" #'easy-kill-append) ;; Note: didn't pick C-h because it is a very useful prefix key. - (define-key map "?" 'easy-kill-help) - (define-key map [remap set-mark-command] 'easy-kill-mark-region) - (define-key map [remap kill-region] 'easy-kill-region) - (define-key map [remap delete-region] 'easy-kill-delete-region) - (define-key map [remap keyboard-quit] 'easy-kill-abort) + (define-key map "?" #'easy-kill-help) + (define-key map [remap set-mark-command] #'easy-kill-mark-region) + (define-key map [remap kill-region] #'easy-kill-region) + (define-key map [remap delete-region] #'easy-kill-delete-region) + (define-key map [remap keyboard-quit] #'easy-kill-abort) (define-key map [remap exchange-point-and-mark] - 'easy-kill-exchange-point-and-mark) + #'easy-kill-exchange-point-and-mark) (mapc (lambda (d) - (define-key map (number-to-string d) 'easy-kill-digit-argument)) + (define-key map (number-to-string d) #'easy-kill-digit-argument)) (number-sequence 0 9)) map)) @@ -121,7 +121,7 @@ string) for appending current selection to previous kill." Do nothing if `easy-kill-inhibit-message' is non-nil." (unless easy-kill-inhibit-message (let (message-log-max) - (apply 'message format-string args)))) + (apply #'message format-string args)))) (defun easy-kill-trim (s &optional how) (let ((wchars "[ \t\n\r\f\v]*")) @@ -163,11 +163,10 @@ The value is the function's symbol if non-nil." (set-keymap-parent map easy-kill-base-map) (when easy-kill-unhighlight-key (with-demoted-errors "easy-kill-unhighlight-key: %S" - (define-key map easy-kill-unhighlight-key 'easy-kill-unhighlight))) - (mapc (lambda (c) - ;; (define-key map (vector meta-prefix-char c) 'easy-kill-select) - (define-key map (char-to-string c) 'easy-kill-thing)) - (mapcar 'car easy-kill-alist)) + (define-key map easy-kill-unhighlight-key #'easy-kill-unhighlight))) + (dolist (c easy-kill-alist) + ;; (define-key map (vector meta-prefix-char (car c)) #'easy-kill-select) + (define-key map (char-to-string (car c)) #'easy-kill-thing)) map)) (defun easy-kill--fmt (x y &optional z) @@ -272,7 +271,7 @@ non-zero length, it is the string covered by the overlay. Otherwise, it is the value of the overlay's candidate property." (with-current-buffer (easy-kill-get buffer) (or (pcase (easy-kill-get bounds) - (`(,_x . ,_x) (easy-kill-get candidate)) + (`(,x . ,x) (ignore x) (easy-kill-get candidate)) (`(,beg . ,end) (filter-buffer-substring beg end))) ""))) @@ -444,7 +443,7 @@ checked." (`1 end)))) (new-front (save-excursion (goto-char front) - (with-demoted-errors + (with-demoted-errors "%S" (dotimes (_ (abs n)) (easy-kill-thing-forward-1 thing step))) (point)))) @@ -497,14 +496,13 @@ checked." "Kill current selection and exit." (interactive "*") (pcase (easy-kill-get bounds) - (`(,_x . ,_x) (easy-kill-echo "Empty region")) + (`(,x . ,x) (ignore x) (easy-kill-echo "Empty region")) (`(,beg . ,end) (kill-region beg end)))) (easy-kill-defun easy-kill-mark-region () (interactive) (pcase (easy-kill-get bounds) - (`(,_x . ,_x) - (easy-kill-echo "Empty region")) + (`(,x . ,x) (ignore x) (easy-kill-echo "Empty region")) (`(,beg . ,end) (pcase (if (eq (easy-kill-get mark) 'end) (list end beg) (list beg end)) @@ -591,7 +589,7 @@ Temporally activate additional key bindings as follows: (easy-kill-activate-keymap))) ;;;###autoload -(defalias 'easy-mark-sexp 'easy-mark +(defalias 'easy-mark-sexp #'easy-mark "Use `easy-mark' instead. The alias may be removed in future.") ;;;###autoload @@ -787,8 +785,8 @@ inspected." (n (ignore-errors (dotimes (_ (abs n)) (pcase (list (point) (easy-kill-bounds-of-thing-at-point 'list)) - (`(,_beg (,_beg . ,_)) (org-up-element)) - (`(,_ (,beg . ,_)) (goto-char beg))))) + (`(,beg (,beg . ,_)) (ignore beg) (org-up-element)) + (`(,_ (,beg . ,_)) (goto-char beg))))) (when (cl-plusp n) (goto-char (cdr (easy-kill-bounds-of-thing-at-point 'list)))))))