From: Dmitry Gutov Date: Sat, 4 Mar 2023 00:37:14 +0000 (+0200) Subject: Redirect eldoc messages to the mode-line when in edebug-mode X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dff9657c6c039ad35734f1d98e0ccc71b85a1a24;p=emacs.git Redirect eldoc messages to the mode-line when in edebug-mode * 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. --- diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 83948ad00d4..74bef264bf1 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -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))