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.
This commit is contained in:
Dmitry Gutov 2023-03-04 02:37:14 +02:00
parent a33d3ae98a
commit dff9657c6c

View 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))