From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Thierry Volpiatto <thievol@posteo.net>
Newsgroups: gmane.emacs.bugs
Subject: bug#66394: 29.1; Make register-read-with-preview more useful
Date: Thu, 30 Nov 2023 10:21:39 +0000
Message-ID: <87sf4nv8wc.fsf@posteo.net>
References: <87il7ib6cu.fsf@posteo.net> <87y1fwtyrl.fsf@posteo.net>
 <87y1fut1wp.fsf@web.de> <87ttqgpjiz.fsf@posteo.net>
 <87wmvbibpr.fsf@web.de> <877cnb2n63.fsf@posteo.net>
 <8734xyc8z0.fsf@web.de> <87zg05rewi.fsf@posteo.net>
 <87ttqcg8gw.fsf@web.de> <87h6mcr8ol.fsf@posteo.net>
 <87r0l73029.fsf@web.de> <877cmdx8ud.fsf@posteo.net>
 <jwvjzqcxrnq.fsf-monnier+emacs@gnu.org> <87sf50s1gh.fsf@posteo.net>
 <83o7ficesp.fsf@gnu.org> <878r6leh9d.fsf@posteo.net>
 <83il5pbnmh.fsf@gnu.org> <87zfz1cz7s.fsf@posteo.net>
 <83bkbc7j1o.fsf@gnu.org> <8734wov2wv.fsf@posteo.net>
 <83v89j6arv.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: multipart/signed; boundary="==-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="26131"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: michael_heerdegen@web.de, 66394@debbugs.gnu.org, monnier@iro.umontreal.ca,
 stefankangas@gmail.com
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 30 11:23:19 2023
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1r8eCU-0006Xa-5p
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Nov 2023 11:23:18 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1r8eC8-00031B-KN; Thu, 30 Nov 2023 05:22:56 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1r8eC6-00030n-EK
 for bug-gnu-emacs@gnu.org; Thu, 30 Nov 2023 05:22:54 -0500
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1r8eC6-0002Yf-6L
 for bug-gnu-emacs@gnu.org; Thu, 30 Nov 2023 05:22:54 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1r8eCD-0003RA-S1
 for bug-gnu-emacs@gnu.org; Thu, 30 Nov 2023 05:23:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Thierry Volpiatto <thievol@posteo.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 30 Nov 2023 10:23:01 +0000
Resent-Message-ID: <handler.66394.B66394.170133972513127@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 66394
X-GNU-PR-Package: emacs
Original-Received: via spool by 66394-submit@debbugs.gnu.org id=B66394.170133972513127
 (code B ref 66394); Thu, 30 Nov 2023 10:23:01 +0000
Original-Received: (at 66394) by debbugs.gnu.org; 30 Nov 2023 10:22:05 +0000
Original-Received: from localhost ([127.0.0.1]:52349 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1r8eBH-0003Pb-Vq
 for submit@debbugs.gnu.org; Thu, 30 Nov 2023 05:22:05 -0500
Original-Received: from mout01.posteo.de ([185.67.36.65]:37507)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <thievol@posteo.net>) id 1r8eBC-0003P0-Hj
 for 66394@debbugs.gnu.org; Thu, 30 Nov 2023 05:22:02 -0500
Original-Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id D52DB240028
 for <66394@debbugs.gnu.org>; Thu, 30 Nov 2023 11:21:44 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1701339704; bh=UyVED6QNug79f3UmM3vIy+7J8Y5wcpESk6lBTuEpGfU=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Autocrypt:OpenPGP:
 From;
 b=H8S5g3l7yXGwABCYh9cEfCMHpldXjTHrrcET/JOzaRtsvapu2S2mrj/U/e1CWxKrQ
 5B/JCeWxSFHaNDgdqslpItmP0CJUD4z01LprbQ6d5f1dUDn/0YCQxCI64tcYDxvAwW
 9zu1/yqiva7JAbWXhfj5LQ5tcj0cAoboRYzdQFn4b7kZ7JvjeJ0mVLjHaDMaVN+xYD
 0fap2mmATOWpgpHggpv1dCh7gG35BVn8wExVU6uOtCgnrGxuQ9GUyyVEH+CfRQm0XK
 vD+djOZtInDQKWa4h1sPSizP5JK+vZxpJxaiRKBEQqDZLdMHFf076XjaUCbh61DRMz
 NxLd47xHUaPdg==
Original-Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4SgsgB51Ghz6tvk;
 Thu, 30 Nov 2023 11:21:42 +0100 (CET)
In-Reply-To: <83v89j6arv.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 30 Nov
 2023 08:00:20 +0200 (3 hours, 56 minutes, 56 seconds ago)")
Autocrypt: addr=thievol@posteo.net; prefer-encrypt=mutual;
 keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCvxTr7MpzzruZbhLPW1K3R6N2MA
 edi8Y+C8o27FVRIjpdbaKMGu9je7JV/TbUQYo3SOwCK1vM4LUn4V6ZLzSYkuiEt4eyMoiDdyvN0p
 kcK6P9x9DCetcEVszXzQg+yzCVrQ2hXWDXWT4M18EC3wtO7RHPouMqGiwBFhBAYErCqFWFxQHkfb
 tG/4yGyJ58rglb65O3qijjMWvYwcWZun9/7qm8Z4/4mHopmo2zgU+OrptnLSZfkZGz3Y7Uf452xQ
 GVq0Fv75NPvQru7y+DYVhuVXXyAmGxt+vf4rIiixMBbhKEPjcxEPAa2LTzex2IsTZR+QVG9uDnqC
 WcgaOEQ58fzXNvNhtwwF/Rgio2XWAJVdmFWS59/k9W58CIUSNKBMZh2XeGdEmtHvDtCxW3z6FJha
 36RzOM3fMNNiAGdFZJA84gcdloJR+sHCDTTPT3784fjr+V8An7sI581NGFzkRQqPvEQCZbUAEQEA
 Ac0SdGhpZXZvbEBwb3N0ZW8ubmV0wsEOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA
 FiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmL3HCoACgkQDsVtFB0W75OVEAv/f6XxmtIFz08fUb8h
 Bp/zJP6IC4/rhhh+0GMRIRzLN8DK0jV8JCzYdFHiRJOy2lNIOpmrrCmjRRxferc2G42+ePFIsslx
 hU46VSz1Z83NwIG3mpdYNV5WUTUdgzxExHTNTFCd7NKv0nlHKQaA 
OpenPGP: url=https://posteo.de/keys/thievol@posteo.net.asc; preference=encrypt
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:275282
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/275282>

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Thierry Volpiatto <thievol@posteo.net>
>> Cc: monnier@iro.umontreal.ca,  michael_heerdegen@web.de,
>>   stefankangas@gmail.com,  66394@debbugs.gnu.org
>> Date: Wed, 29 Nov 2023 18:18:40 +0000
>>=20
>> Eli Zaretskii <eliz@gnu.org> writes:
>>=20
>> > The response "a" to the "Point to register:" question is something I
>> > needed to type;
>>=20
>> Of course we are using now read-from-minibuffer and the test is related
>> to read-key not quitting with C-g
>>=20
>> > previously the test never asked any questions (and it shouldn't,
>> > AFAIU).
>>=20
>> Yes, it shouldn't, but now we are using a real minibuffer, is this test
>> really needed?
>> It is like if you had to make tests in all functions using
>> read-from-minibuffer to check if it quit properly with C-g (it does of c=
ourse).
>
> Can we have a similar issue with read-from-minibuffer?  Not with C-g,
> but with some other invalid input, like some function key or non-ASCII
> character or invalid character codepoint?

No, because unlike read-key, read-from-minibuffer doesn't read these
keys and exit immediately.  For example we can now set a register to C-g
by using "C-q C-g" but hitting directly C-g will quit minibuffer (as
expected), BTW I have updated the manual, see the attached patchs.  I
have also fixed register-preview-default accordingly so that it print
the register as a string but not a key representation e.g. "^X" instead
of "C-x" (if one find this ugly we could use "C-x" as a display property
of "^X").

> If this cannot happen, then perhaps the whole test file should be
> removed?

I think it can be removed, yes (done in patch below).

> Anyway, I trust you to do what is needed here, I just want the test
> suite to keep running successfully, and I don't have time to work on
> this myself.  TIA.

Ok, can you review (and merge if ok) following patchs.

>> ALSO: I intentionally leave register-preview-delay defcustom with a FIXME
>> comment, do you want to remove it? It is not used anymore now AFAIK.
>
> This should be declared obsolete, with an explanation that it is no
> longer used, and a note about that should be added to NEWS, in the
> incompatible changes section.  Then we can remove the FIXME.

done.

Thanks.

=2D-=20
Thierry

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Make-register-preview-delay-obsolete.patch
Content-Transfer-Encoding: quoted-printable

From=203df81fb5dc5809cab7843e5358c17d0039b55eb1 Mon Sep 17 00:00:00 2001
From: Thierry Volpiatto <thievol@posteo.net>
Date: Thu, 30 Nov 2023 08:03:45 +0100
Subject: [PATCH 1/4] Make register-preview-delay obsolete

* etc/NEWS: Update.
* lisp/register.el (register-preview-delay): Make it obsolete.
=2D--
 etc/NEWS         | 5 +++++
 lisp/register.el | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 6661ac70e1b..bab3529339f 100644
=2D-- a/etc/NEWS
+++ b/etc/NEWS
@@ -1138,6 +1138,11 @@ showcases all their customization options.
 
 * Incompatible Lisp Changes in Emacs 30.1
=20
+---
+** 'register-preview-delay' is no longer used.
+Register preview is no more delayed.  If you want to disable it use
+'register-use-preview' instead with a boolean value.
+
 +++
 ** 'M-TAB' now invokes 'completion-at-point' also in Text mode.
 Text mode no longer binds 'M-TAB' to 'ispell-complete-word', and
diff --git a/lisp/register.el b/lisp/register.el
index 61bef503f91..88d0e8e1d10 100644
=2D-- a/lisp/register.el
+++ b/lisp/register.el
@@ -93,7 +93,6 @@ of the marked text."
   :type '(choice (const :tag "None" nil)
 		 (character :tag "Use register" :value ?+)))
=20
=2D;; FIXME: This is no more needed, remove it.
 (defcustom register-preview-delay 1
   "If non-nil, time to wait in seconds before popping up register preview =
window.
 If nil, do not show register previews, unless `help-char' (or a member of
@@ -101,6 +100,7 @@ If nil, do not show register previews, unless `help-cha=
r' (or a member of
   :version "24.4"
   :type '(choice number (const :tag "No preview unless requested" nil))
   :group 'register)
+(make-obsolete-variable 'register-preview-delay "No longer used." "30.1")
=20
 (defcustom register-preview-default-keys (mapcar #'string (number-sequence=
 ?a ?z))
   "Default keys for setting a new register."
=2D-=20
2.34.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0002-Fix-register-preview-default.patch
Content-Transfer-Encoding: quoted-printable

From=20bcf7bd8feb05914e6000b572c3e75664a9090c1a Mon Sep 17 00:00:00 2001
From: Thierry Volpiatto <thievol@posteo.net>
Date: Thu, 30 Nov 2023 10:38:52 +0100
Subject: [PATCH 2/4] Fix register-preview-default

We need to print the string representation (one char) of an eventual
key description e.g. "^X" instead of "C-x".

* lisp/register.el (register-preview-default): Use `string' to print regist=
er.
=2D--
 lisp/register.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/register.el b/lisp/register.el
index 88d0e8e1d10..9b457e716f2 100644
=2D-- a/lisp/register.el
+++ b/lisp/register.el
@@ -131,7 +131,7 @@ See the documentation of the variable `register-alist' =
for possible VALUEs."
 (defun register-preview-default (r)
   "Function that is the default value of the variable `register-preview-fu=
nction'."
   (format "%s: %s\n"
=2D	  (single-key-description (car r))
+	  (string (car r))
 	  (register-describe-oneline (car r))))
=20
 (defvar register-preview-function #'register-preview-default
=2D-=20
2.34.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment; filename=0003-Update-register-manual.patch
Content-Transfer-Encoding: quoted-printable

From=2093c07593bac8d7f0428a92502ee5de8def128c5c Mon Sep 17 00:00:00 2001
From: Thierry Volpiatto <thievol@posteo.net>
Date: Thu, 30 Nov 2023 10:53:46 +0100
Subject: [PATCH 3/4] Update register manual

doc/emacs/regs.texi: Do it.
=2D--
 doc/emacs/regs.texi | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi
index e52f68dd18e..5e5b7ae2b16 100644
=2D-- a/doc/emacs/regs.texi
+++ b/doc/emacs/regs.texi
@@ -16,9 +16,8 @@ jump back to that position once or many times.
 we will denote by @var{r}; @var{r} can be a letter (such as @samp{a})
 or a number (such as @samp{1}); case matters, so register @samp{a} is
 not the same as register @samp{A}.  You can also set a register in
=2Dnon-alphanumeric characters, for instance @samp{*} or @samp{C-d}.
=2DNote, it's not possible to set a register in @samp{C-g} or @samp{ESC},
=2Dbecause these keys are reserved for quitting (@pxref{Quitting}).
+non-alphanumeric characters, for instance @samp{C-d} by using for
+example @key{C-q} @samp{C-d}.
=20
 @findex view-register
   A register can store a position, a piece of text, a rectangle, a
=2D-=20
2.34.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0004-Delete-register-tests.el-now-no-more-needed.patch
Content-Transfer-Encoding: quoted-printable

From=20d60e3b4969a420fe9ba66b5732f57243385e5e88 Mon Sep 17 00:00:00 2001
From: Thierry Volpiatto <thievol@posteo.net>
Date: Thu, 30 Nov 2023 11:04:47 +0100
Subject: [PATCH 4/4] Delete register-tests.el now no more needed

* register-tests.el: Deleted file.
=2D--
 test/lisp/register-tests.el | 43 -------------------------------------
 1 file changed, 43 deletions(-)
 delete mode 100644 test/lisp/register-tests.el

diff --git a/test/lisp/register-tests.el b/test/lisp/register-tests.el
deleted file mode 100644
index 6283d1c31e0..00000000000
=2D-- a/test/lisp/register-tests.el
+++ /dev/null
@@ -1,43 +0,0 @@
=2D;;; register-tests.el --- tests for register.el  -*- lexical-binding: t-=
*-
=2D
=2D;; Copyright (C) 2017-2023 Free Software Foundation, Inc.
=2D
=2D;; Author: Tino Calancha <tino.calancha@gmail.com>
=2D;; Keywords:
=2D
=2D;; This file is part of GNU Emacs.
=2D
=2D;; GNU Emacs is free software: you can redistribute it and/or modify
=2D;; it under the terms of the GNU General Public License as published by
=2D;; the Free Software Foundation, either version 3 of the License, or
=2D;; (at your option) any later version.
=2D
=2D;; GNU Emacs is distributed in the hope that it will be useful,
=2D;; but WITHOUT ANY WARRANTY; without even the implied warranty of
=2D;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
=2D;; GNU General Public License for more details.
=2D
=2D;; You should have received a copy of the GNU General Public License
=2D;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
=2D
=2D;;; Commentary:
=2D
=2D
=2D;;; Code:
=2D(require 'ert)
=2D(require 'cl-lib)
=2D
=2D(ert-deftest register-test-bug27634 ()
=2D  "Test for https://debbugs.gnu.org/27634 ."
=2D  (dolist (event (list ?\C-g 'escape ?\C-\[))
=2D    (cl-letf (((symbol-function 'read-key) #'ignore)
=2D              (last-input-event event)
=2D              (register-alist nil))
=2D      (should (equal 'quit
=2D                     (condition-case err
=2D                         (call-interactively 'point-to-register)
=2D                       (quit (car err)))))
=2D      (should-not register-alist))))
=2D
=2D(provide 'register-tests)
=2D;;; register-tests.el ends here
=2D-=20
2.34.1


--=-=-=--

--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmVoYjQTHHRoaWV2b2xA
cG9zdGVvLm5ldAAKCRAOxW0UHRbvkzXyC/kBEQlBq0ikuda24dpYAm3QNF018i4K
DGKIAcwH7QGcJOyF4LrUH7wV2/qex9CaBjgKfwCKSzLebJ5rrlxeIZe2yPdGNafJ
/R3KTVDsADLWuQbeVITKKReOxr8mGhRl+4wckch4BJFt25y9cfit2o8MxpLlAY1P
Hhz6j06q/L9sDFgms77hiLNmMIghIWgVSxjvQ3UvxWRpgcR/h+gJcb+P10PaVncz
efq3WO+cn2oYNM2QDeQFfxh8BSmnXnGip2/68AJ42TIJigpyXRJF87CFAimU90cP
cO6OXtUvBucT+kMBpdJncEbi7b8w4g/XYSDWTed5I/okGTrIecYPN+MET2E+cBgA
rNr7gPJ+BZ2YFh0/krtIAZ2ixbkqWK9sb/46Tul0HXfP6iXL1aH4gcAvgEJa16/N
FOiI8gyEZjVXUcXle27LJ7ZrGj/OJnqcUIbAeEAMjTcwXdzq8N854z4crCvIbfaA
kVZARCGPdhJIZ+dr7NQHymRiz/IV59wQMLM=
=iUe8
-----END PGP SIGNATURE-----
--==-=-=--