]> git.eshelyaron.com Git - emacs.git/commitdiff
Redirect eldoc messages to the mode-line when in edebug-mode
authorDmitry Gutov <dgutov@yandex.ru>
Sat, 4 Mar 2023 00:37:14 +0000 (02:37 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 4 Mar 2023 00:37:14 +0000 (02:37 +0200)
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message): Redirect
eldoc messages to the mode-line when in edebug-mode (bug#56459).
(eldoc-minibuffer--cleanup): New function, used in above.

lisp/emacs-lisp/eldoc.el

index 83948ad00d4d36b77b02a8c5f09d55940e4715fe..74bef264bf1a6155cf29613600b5281322c858e9 100644 (file)
@@ -296,13 +296,9 @@ reflect the change."
 This function displays the message produced by formatting ARGS
 with FORMAT-STRING on the mode line when the current buffer is a minibuffer.
 Otherwise, it displays the message like `message' would."
-  (if (minibufferp)
+  (if (or (bound-and-true-p edebug-mode) (minibufferp))
       (progn
-       (add-hook 'minibuffer-exit-hook
-                 (lambda () (setq eldoc-mode-line-string nil
-                             ;; https://debbugs.gnu.org/16920
-                             eldoc-last-message nil))
-                 nil t)
+        (add-hook 'post-command-hook #'eldoc-minibuffer--cleanup)
        (with-current-buffer
            (window-buffer
             (or (window-in-direction 'above (minibuffer-window))
@@ -321,6 +317,13 @@ Otherwise, it displays the message like `message' would."
           (force-mode-line-update)))
     (apply #'message format-string args)))
 
+(defun eldoc-minibuffer--cleanup ()
+  (unless (or (bound-and-true-p edebug-mode) (minibufferp))
+    (setq eldoc-mode-line-string nil
+          ;; https://debbugs.gnu.org/16920
+          eldoc-last-message nil)
+    (remove-hook 'post-command-hook #'eldoc-minibuffer--cleanup)))
+
 (make-obsolete
  'eldoc-message "use `eldoc-documentation-functions' instead." "eldoc-1.1.0")
 (defun eldoc-message (&optional string) (eldoc--message string))