emacs-devel
[Top][All Lists]
Advanced

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

Re: Intelligent stacking of messages in the echo area


From: Juri Linkov
Subject: Re: Intelligent stacking of messages in the echo area
Date: Thu, 30 Jan 2020 00:54:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)

>> Maybe this is because multi-line messages resize the echo-area window
>> every time a new message line is added (when resize-mini-windows is non-nil),
>> so height changes of the echo-area window invoke 
>> window-configuration-change-hook.
>
> I suspect that it is exactly the case.
> However, window-configuration-change-hook is not fired so frequently in
> other functions like split-window.
> Most likely, it is because window-configuration-change-hook is only
> called during redisplay. From its docstring:
> "Functions called during redisplay when window configuration has
> changed."
>
> I guess that resizing echo-area forcefully calls redisplay and hence
> window-configuration-change-hook, thus slowing down command execution.

To avoid continual resizing of echo-area when new messages arrive,
maybe 'resize-mini-windows' should allow setting it to a fixed number
of lines, so e.g. (setq resize-mini-windows 10) would mean
that the height of the echo-area will be kept always at 10 lines,
even when it displays less lines.

If this is impossible to do then a possible workaround is to emulate this
in set-multi-message by inserting empty lines to fill the height to
a fixed amount of lines.  This is a possible change over the previous patch:

@@ -452,7 +474,11 @@ set-multi-message
       (push (vector (float-time) message (not message-log-max)) 
multi-message-list)
       (when (> (length multi-message-list) multi-message-max)
         (setf (nthcdr multi-message-max multi-message-list) nil)))
-    (mapconcat (lambda (m) (aref m 1))
-               (reverse multi-message-list)
+    (mapconcat (lambda (m) (if (stringp m) m (aref m 1)))
+               (append (reverse multi-message-list)
+                       ;; Fill remaining space by empty lines to keep fixed 
height
+                       ;; of the echo-area to avoid continual resizing of 
echo-area
+                       ;; when new messages arrive.
+                       (make-list (- multi-message-max (length 
multi-message-list)) ""))
                multi-message-separator)))

Then another problem is that clear-message doesn't keep fixed height of 
echo-area.
Maybe an additional workaround would be to issue an empty message that
will be filled by empty lines in set-multi-message for clear-message as well:

(defun clear-multi-message--wrapper (orig-fun)
  (funcall orig-fun)
  (setq multi-message-list nil)
  (message "\n"))

(setq clear-message-function 'clear-minibuffer-message)
(add-function :around clear-message-function #'clear-multi-message--wrapper)



reply via email to

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