[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: Fri, 31 Jan 2020 00:35:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> 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.
> `(default-value sym)` should do the trick.

Maybe I'm doing something wrong, but with the following patch it fails:

Debugger entered--Lisp error: (void-variable v)
  (default-value v)
  (lambda nil (default-value v))()
  advice--add-function(:around ((lambda nil (default-value v)) lambda (gv--val) 
(set-default v gv--val)) set-multi-message--wrapper nil)
  (add-function :around (default-value sym) #'set-multi-message--wrapper)

diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index e3dc6f03c4..ecfb2a63c1 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -646,6 +646,20 @@ minibuffer-prompt-properties--setter
                                                     :format "%v")
                                            (other :tag "Unlimited" t))
+             (set-message-function
+              minibuffer (choice
+                          (const :tag "No special handling" nil)
+                          (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 (default-value 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]