Subject: Re: bug#4136: 23.1; delete-pair

From: Juri Linkov <[email-masked]>
Date: Tue, 22 Sep 2020 21:18:23 +0300

>> If it's really impossible to delete a pair in text-mode, then better
>> to signal an error.
>
> OK; I've reapplied the patch and fixed the test, and I'm now re-closing
> this bug report.

Thanks.  Every time I delete a pair of quotes in a long string,
or a pair of parens in a long sexp, it makes me feel uneasy since
I worry whether it deleted the intended characters or not.

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?

This is achievable with this patch:

diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index ac4ba78897..88e1b26af3 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -752,6 +752,8 @@ delete-pair
 				      (if (= (length p) 3) (cdr p) p))
 				    insert-pair-alist))
 	      (error "Not after matching pair"))
+	    (when blink-matching-paren
+	      (sit-for blink-matching-delay))
 	    (delete-char 1)))
 	(delete-char -1))
     (save-excursion
@@ -764,6 +766,8 @@ delete-pair
 				    (if (= (length p) 3) (cdr p) p))
 				  insert-pair-alist))
 	    (error "Not before matching pair"))
+	  (when blink-matching-paren
+	    (sit-for blink-matching-delay))
 	  (delete-char -1)))
       (delete-char 1))))