diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 35590123ee..be2adfa848 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -784,9 +784,17 @@ insert-parentheses (interactive "P") (insert-pair arg ?\( ?\))) +(defcustom delete-pair-blink-delay blink-matching-delay + "Time in seconds to delay after showing a pair character to delete. +No timeout in case of 0." + :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 @@ delete-pair (if (= (length p) 3) (cdr p) p)) insert-pair-alist)) (error "Not after matching pair")) + (when (and (natnump 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 @@ delete-pair (if (= (length p) 3) (cdr p) p)) insert-pair-alist)) (error "Not before matching pair")) + (when (and (natnump delete-pair-blink-delay) + (> delete-pair-blink-delay 0)) + (sit-for delete-pair-blink-delay)) (delete-char -1))) (delete-char 1)))) diff --git a/lisp/simple.el b/lisp/simple.el index e96c7c9a6e..3d18909f2c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5089,9 +5089,9 @@ kill-ring-save (defun indicate-copied-region (&optional message-len) "Indicate that the region text has been copied interactively. -If the mark is visible in the selected window, blink the cursor -between point and mark if there is currently no active region -highlighting. +If the mark is visible in the selected window, blink the cursor between +point and mark if there is currently no active region highlighting. +The option `copy-region-blink-delay' can disable blinking. If the mark lies outside the selected window, display an informative message containing a sample of the copied text. The @@ -5106,11 +5106,13 @@ indicate-copied-region ;; Swap point-and-mark quickly so as to show the region that ;; was selected. Don't do it if the region is highlighted. (unless (and (region-active-p) - (face-background 'region nil t)) + (face-background 'region nil t) + (natnump copy-region-blink-delay) + (> copy-region-blink-delay 0)) ;; Swap point and mark. (set-marker (mark-marker) (point) (current-buffer)) (goto-char mark) - (sit-for blink-matching-delay) + (sit-for copy-region-blink-delay) ;; Swap back. (set-marker (mark-marker) mark (current-buffer)) (goto-char point) @@ -8135,6 +8139,13 @@ blink-paren-post-self-insert-function ;; `sit-for'. That's also the reason it get a `priority' prop ;; of 100. 'append) + +(defcustom copy-region-blink-delay blink-matching-delay + "Time in seconds to delay after showing a pair character to delete. +No timeout in case of 0." + :type 'number + :group 'killing + :version "28.1") ;; This executes C-g typed while Emacs is waiting for a command. ;; Quitting out of a program does not go through here;