[Top][All Lists]

[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:41:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)

> Now what remains to do is to combine multi-message feature with 
> minibuffer-message,
> so when the minibuffer is not active then multi-line messages are displayed
> in the echo-area, otherwise multi-line messages are displayed at the end
> of the minibuffer:
> (defun set-multi-message--wrapper (orig-fun message)
>   (let* ((multi-message (set-multi-message message)))
>     (or (funcall orig-fun multi-message)
>         multi-message)))
> (setq set-message-function 'set-minibuffer-message)
> (add-function :around set-message-function #'set-multi-message--wrapper)

Turning this into defcustom is a challenge.  I tried to introduce
a fictitious 'set-minibuffer-multi-message', but I see no way to use
'add-function' on a symbol in :set of defcustom.  It seems something
like (local 'SYMBOL) but for global scope is missing, e.g. like
an non-existent '(global sym)' demonstrated below, but I'm not sure.

diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index e3dc6f03c4..18067bfd07 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -646,6 +646,19 @@ minibuffer-prompt-properties--setter
                                                     :format "%v")
                                            (other :tag "Unlimited" t))
+             (set-message-function
+              minibuffer (choice
+                          (const :tag "Handle minibuffer" 
+                          (const :tag "Accumulate messages" set-multi-message)
+                          (const :tag "Accumulate messages and handle 
minibuffer" set-minibuffer-multi-message)
+                         (function :tag "Other function"))
+             "28.1"
+              :set (lambda (sym val)
+                     (cond
+                      ((eq val 'set-minibuffer-multi-message)
+                       (set-default sym 'set-minibuffer-message)
+                       (add-function :around (global sym) 
+                      (t (set-default sym val)))))
             (unibyte-display-via-language-environment mule boolean)
             (blink-cursor-alist cursor alist "22.1")
             (overline-margin display integer "22.1")

reply via email to

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