From: Juri Linkov <juri@jurta.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Eli Barzilay <eli@barzilay.org>, 4136@debbugs.gnu.org
Subject: bug#4136: 23.1; delete-pair
Date: Thu, 12 Nov 2020 22:21:21 +0200 [thread overview]
Message-ID: <87lff672da.fsf@mail.linkov.net> (raw)
In-Reply-To: <87r1qsd47i.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 23 Sep 2020 15:15:29 +0200")
[-- Attachment #1: Type: text/plain, Size: 647 bytes --]
>> How about using the same delay blink-matching-delay that is used
>> after showing a matching paren, but in this case to show
>> a character at the other end of the pair with a delay
>> before deleting it?
>
> Makes sense to me, but I'm not a regular user of delete-pair, so I don't
> know whether that'd be annoying or reassuring...
After a month of using it the following patch proved to be useful.
It adds anew new defcustom delete-pair-blink-delay based on the default
value of blink-matching-delay. Exactly the same defcustom is also
added copy-region-blink-delay for the feature request in bug#42865
not to blink when copying a region:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: blink-delay.patch --]
[-- Type: text/x-diff, Size: 3426 bytes --]
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")
\f
;; This executes C-g typed while Emacs is waiting for a command.
;; Quitting out of a program does not go through here;
next prev parent reply other threads:[~2020-11-12 20:21 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-13 6:22 bug#4136: 23.1; delete-pair Eli Barzilay
2009-08-13 9:53 ` martin rudalics
2009-08-13 23:29 ` Juri Linkov
2009-08-14 1:18 ` Eli Barzilay
2009-08-14 15:50 ` Stefan Monnier
2009-08-14 22:45 ` Juri Linkov
2009-08-15 1:46 ` Eli Barzilay
2009-08-15 23:06 ` Juri Linkov
2009-08-16 0:00 ` Eli Barzilay
2009-08-17 0:46 ` Juri Linkov
2009-08-17 3:13 ` Eli Barzilay
2009-08-17 21:17 ` Juri Linkov
2009-08-18 7:13 ` martin rudalics
2009-08-19 0:48 ` Juri Linkov
2020-09-14 14:08 ` Lars Ingebrigtsen
2020-09-14 19:12 ` Juri Linkov
2020-09-15 12:27 ` Lars Ingebrigtsen
2020-09-15 18:07 ` Juri Linkov
2020-09-17 14:45 ` Lars Ingebrigtsen
2020-09-18 8:35 ` Juri Linkov
2020-09-18 10:59 ` Lars Ingebrigtsen
2020-09-21 19:12 ` Juri Linkov
2020-09-22 14:45 ` Lars Ingebrigtsen
2020-09-22 18:18 ` Juri Linkov
2020-09-23 13:15 ` Lars Ingebrigtsen
2020-11-12 20:21 ` Juri Linkov [this message]
2020-11-12 21:16 ` Basil L. Contovounesios
2020-11-13 8:29 ` Juri Linkov
2020-11-16 20:55 ` Juri Linkov
2020-11-16 21:37 ` Drew Adams
2009-08-16 10:27 ` martin rudalics
2009-08-18 3:10 ` Stefan Monnier
2009-08-19 0:47 ` Juri Linkov
2009-08-15 10:11 ` martin rudalics
2009-08-14 7:17 ` martin rudalics
2009-08-14 22:45 ` Juri Linkov
2009-08-15 10:11 ` martin rudalics
2009-08-15 23:03 ` Juri Linkov
2009-08-16 10:27 ` martin rudalics
2009-08-13 23:28 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lff672da.fsf@mail.linkov.net \
--to=juri@jurta.org \
--cc=4136@debbugs.gnu.org \
--cc=eli@barzilay.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.