Subject: bug#76739: 31.0.50; Register previews cannot be disabled

From: Thierry Volpiatto <[email-masked]>
Date: Wed, 05 Mar 2025 06:53:35 +0000

Eli Zaretskii <[email-masked]> writes:

>> From: Thierry Volpiatto <[email-masked]>
>> Cc: Rudolf Adamkovič <[email-masked]>,  Thierry
>>  Volpiatto
>>  <[email-masked]>,  [email-masked]
>> Date: Tue, 04 Mar 2025 17:46:59 +0000
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> > Thierry, could you please look into this?
>> 
>> Yes, I already replied, the problem is if one set this variable with
>> setq, the defcustom has a :set function.
>
> Yes, I saw it too late, thanks.
>
>> So from emacs -Q here:
>> 
>> (customize-set-variable 'register-use-preview 'never)
>> 
>> Then do 3) and 4) from the recipe above.
>> 
>> No preview, as expected.
>
> Right.  I've already updated the doc string to say using setq is not
> effective, so maybe this is all that's needed here.

Yes, for this it should be enough, however there is a little bug when
using never and trying to do C-h, the minibuffer exit with "No register
specified", which is wrong, the preview should popup with full
capabilities, here the needed changes:

diff --git a/lisp/register.el b/lisp/register.el
index 0e9d5676943..cb6d90d6a05 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -579,7 +579,9 @@ or \\='never."
                        (setq pat input))))
                  (if (setq win (get-buffer-window buffer))
                      (with-selected-window win
-                       (when noconfirm
+                       (when (or (eq noconfirm t) ; Using insist
+                                 ;; Don't exit when noconfirm == (never)
+                                 (memq nil noconfirm))
                          ;; Happen only when
                          ;; *-use-preview == insist.
                          (exit-minibuffer))

-- 
Thierry