GNU bug report logs -
#66394
29.1; Make register-read-with-preview more useful
Previous Next
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 #321 received at 66394 <at> debbugs.gnu.org (full text, mbox):
> It should be possible to use post-command-hook, I didn't use it because
> it makes harder the communication between the minibuffer and the preview
> buffer.
The patch below seems to work for my extremely limited testing.
Stefan
diff --git a/lisp/register.el b/lisp/register.el
index fa4bbcf483f..31466a42b0a 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -328,7 +328,7 @@ register-read-with-preview
m))
(data (register-command-info this-command))
(enable-recursive-minibuffers t)
- types msg result timer act win strs smatch)
+ types msg result act win strs smatch)
(if data
(setq types (register-preview-info-types data)
msg (register-preview-info-msg data)
@@ -360,9 +360,7 @@ register-read-with-preview
(progn
(minibuffer-with-setup-hook
(lambda ()
- (setq timer
- (run-with-idle-timer
- 0.01 'repeat
+ (add-hook 'post-command-hook
(lambda ()
(with-selected-window (minibuffer-window)
(let ((input (minibuffer-contents)))
@@ -408,13 +406,13 @@ register-read-with-preview
;; jump, don't ask for confirmation
;; and exit immediately (bug#66394).
(setq result pat)
- (exit-minibuffer)))))))))
+ (exit-minibuffer))))))
+ nil 'local))
(setq result (read-from-minibuffer
prompt nil map nil nil (register-preview-get-defaults act))))
(cl-assert (and result (not (string= result "")))
nil "No register specified")
(string-to-char result))
- (when timer (cancel-timer timer))
(let ((w (get-buffer-window buf)))
(and (window-live-p w) (delete-window w)))
(and (get-buffer buf) (kill-buffer buf)))))
This bug report was last modified 1 year and 209 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.