From 81588748bd85827468e297d3e44a72844438e807 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 15 Nov 2020 22:32:39 +0200 Subject: New user options 'copy-region-blink-delay' and 'delete-pair-blink-delay' * lisp/emacs-lisp/lisp.el (delete-pair-blink-delay): New defcustom. (delete-pair): Use it. (Bug#4136) * lisp/simple.el (copy-region-blink-delay): New defcustom. (indicate-copied-region): Use it. (Bug#42865) Thanks to Sean Whitton . (indicate-copied-region): Use 'query-replace-descr' not to show newlines literally. Use "Copied text" instead of misleading "Saved text" (bug#42865). --- lisp/emacs-lisp/lisp.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 35590123ee6..124900168c3 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -784,9 +784,17 @@ This command assumes point is not in a string or comment." (interactive "P") (insert-pair arg ?\( ?\))) +(defcustom delete-pair-blink-delay blink-matching-delay + "Time in seconds to delay after showing a paired character to delete. +It's used by the command `delete-pair'. The value 0 disables blinking." + :type 'number + :group 'lisp + :version "28.1") + (defun delete-pair (&optional arg) "Delete a pair of characters enclosing ARG sexps that follow point. -A negative ARG deletes a pair around the preceding ARG sexps instead." +A negative ARG deletes a pair around the preceding ARG sexps instead. +The option `delete-pair-blink-delay' can disable blinking." (interactive "P") (if arg (setq arg (prefix-numeric-value arg)) @@ -802,6 +810,9 @@ A negative ARG deletes a pair around the preceding ARG sexps instead." (if (= (length p) 3) (cdr p) p)) insert-pair-alist)) (error "Not after matching pair")) + (when (and (numberp delete-pair-blink-delay) + (> delete-pair-blink-delay 0)) + (sit-for delete-pair-blink-delay)) (delete-char 1))) (delete-char -1)) (save-excursion @@ -814,6 +825,9 @@ A negative ARG deletes a pair around the preceding ARG sexps instead." (if (= (length p) 3) (cdr p) p)) insert-pair-alist)) (error "Not before matching pair")) + (when (and (numberp delete-pair-blink-delay) + (> delete-pair-blink-delay 0)) + (sit-for delete-pair-blink-delay)) (delete-char -1))) (delete-char 1)))) -- cgit v1.2.3