bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66394: 29.1; Make register-read-with-preview more useful


From: Stefan Monnier
Subject: bug#66394: 29.1; Make register-read-with-preview more useful
Date: Fri, 15 Dec 2023 10:18:05 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> @@ -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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]