GNU bug report logs - #66394
29.1; Make register-read-with-preview more useful

Previous Next

Package: emacs;

Reported by: Thierry Volpiatto <thievol <at> posteo.net>

Date: Sat, 7 Oct 2023 19:07:01 UTC

Severity: normal

Found in version 29.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #306 received at 66394 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Thierry Volpiatto <thievol <at> posteo.net>
Cc: michael_heerdegen <at> web.de, dmitry <at> gutov.dev, Eli Zaretskii <eliz <at> gnu.org>,
 Stefan Kangas <stefankangas <at> gmail.com>, 66394 <at> debbugs.gnu.org
Subject: Re: bug#66394: 29.1; Make register-read-with-preview more useful
Date: Fri, 15 Dec 2023 10:18:05 -0500
> @@ -429,7 +429,12 @@ Format of each entry is controlled by the variable `register-preview-function'."
>  Prompt with the string PROMPT.
>  If `help-char' (or a member of `help-event-list') is pressed,
>  display such a window regardless."
> -  (funcall register--read-with-preview-function prompt))
> +  (let ((register--read-with-preview-function
> +         (if (and executing-kbd-macro
> +                  (memq register-use-preview '(nil never)))
> +             #'register-read-with-preview-basic
> +           (default-value 'register--read-with-preview-function))))
> +    (funcall register--read-with-preview-function prompt)))

Questions/comments:

- Why did you change from using
  `register--read-with-preview-function` to using
  (default-value 'register--read-with-preview-function) ?
  [ The answer should presumably be in the commit message but
    I couldn't find it there.  ]

- Why let-bind `register--read-with-preview-function`
  rather than using a local lexical var?
  [ The answer should probably be in a comment in the code.  ]

- Making the behavior dependent on `executing-kbd-macro` is generally
  undesirable, so it should be accompanied with a comment in the code
  explaining why we need it (with enough detail that someone
  sufficiently motivated could potentially "fix" the code to remove this
  dependency, or alternatively to convince that someone else that this
  dependency is actually desirable here).


-- Stefan





This bug report was last modified 1 year and 211 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.