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


View this message in rfc822 format

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: bug#66394: 29.1; Make register-read-with-preview more useful
Date: Sat, 16 Dec 2023 10:31:50 -0500
> 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 210 days ago.

Previous Next


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