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

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

bug#34614: 26.1.92; When reading input in mini-buffer, message to each a


From: HaiJun Zhang
Subject: bug#34614: 26.1.92; When reading input in mini-buffer, message to each area overide the input prompt
Date: Sat, 9 Nov 2019 23:38:29 +0000

Thanks. I think it will be better if emacs can record the last buffer(Including minibuffer) selected manually by the user and provide a function like selected-buffer to return this buffer. And minibuffer-message can use this.
在 2019年11月10日 +0800 AM7:07,Juri Linkov <juri@linkov.net>,写道:
I got it. Thanks for your explaination.

It is strange that minibuffer-message-timeout is defined in C.
But the timeout is processed in lisp (in the function minibuffer-message).

在 2019年11月8日 +0800 AM6:58,Juri Linkov <juri@linkov.net>,写道:

The prompt is replaced with the message from autorevert. And after
about 2~3 seconds (not fixed), the prompt comes back. What controls
the delay(2~3 seconds)? It is not the value of
minibuffer-message-timeout, which is 0.6. Is this expected?

The problem is that when auto-revert-handler calls minibuffer-message,
the current buffer is not the minibuffer, because functions that call
auto-revert-handler (auto-revert-notify-handler, auto-revert--end-lockout,
or auto-revert-buffers) change the current buffer using with-current-buffer.

When the current buffer is not the minibuffer then minibuffer-message
just calls (message "%s" message) and then does
(sit-for (or minibuffer-message-timeout 1000000))

And it behaves differently with the following test code:

(progn (run-with-idle-timer 3 nil
(lambda ()
(minibuffer-message "Reverting buffer `%s'." (buffer-name))))
(call-interactively 'find-file))

This works well. The prompt is NOT replaced. The message is appended
to the end of the prompt and disappears after 0.6 second.

To work well like this, minibuffer-message should be called outside
of with-current-buffer code block. Yesterday I fixed Man-bgproc-sentinel
in bug#19064 to call minibuffer-message outside of with-current-buffer.

But auto-revert functions require complete rewrite. I don't see
how this could be fixed with a simple change.

Actually I found a solution with two alternatives, and both works well,
and I can't decide which is less error-prone. This patch shows both:

diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 9275513c8d..17678010f1 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -815,7 +815,13 @@ auto-revert-handler
(when revert
(when (and auto-revert-verbose
(not (eq revert 'fast)))
- (message "Reverting buffer `%s'." (buffer-name)))
+ ;; 1.
+ (with-selected-window (old-selected-window)
+ (minibuffer-message "Reverting buffer `%s'." (buffer-name)))
+ ;; 2.
+ ;; (with-current-buffer (window-buffer (old-selected-window))
+ ;; (minibuffer-message "Reverting buffer `%s'." (buffer-name)))
+ )
;; If point (or a window point) is at the end of the buffer, we
;; want to keep it at the end after reverting. This allows one
;; to tail a file.


reply via email to

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