=== modified file 'lisp/emacs-lisp/eldoc.el' --- lisp/emacs-lisp/eldoc.el 2011-01-25 04:08:28 +0000 +++ lisp/emacs-lisp/eldoc.el 2011-10-05 09:15:52 +0000 @@ -146,6 +146,11 @@ "Idle time delay currently in use by timer. This is used to determine if `eldoc-idle-delay' is changed by the user.") +(defvar eldoc-message-function nil + "The function used by `eldoc-message' to display messages. +It should receive the same arguments as `message'. If this is +nil, `eldoc-minibuffer-message' is used.") + ;;;###autoload (define-minor-mode eldoc-mode @@ -185,8 +190,30 @@ (setq eldoc-current-idle-delay eldoc-idle-delay) (timer-set-idle-time eldoc-timer eldoc-idle-delay t)))) +(defvar eldoc-mode-line-string nil) +(put 'eldoc-mode-line-string 'risky-local-variable t) + +(defun eldoc-minibuffer-message (format-string &rest args) + "Show messages in the mode-line when in the minibuffer. +Otherwise, behave like function `message'." + (if (minibufferp) + (progn + (with-current-buffer (window-buffer (minibuffer-selected-window)) + (unless (assq 'eldoc-mode-line-string mode-line-format) + (push '(eldoc-mode-line-string (" " eldoc-mode-line-string " ")) + mode-line-format))) + (add-hook 'minibuffer-exit-hook + (lambda () (setq eldoc-mode-line-string nil)) + nil t) + (and (stringp format-string) + (setq eldoc-mode-line-string + (apply 'format format-string args))) + (force-mode-line-update)) + (apply 'message format-string args))) + (defun eldoc-message (&rest args) - (let ((omessage eldoc-last-message)) + (let ((omessage eldoc-last-message) + (msgfunc (or eldoc-message-function #'eldoc-minibuffer-message))) (setq eldoc-last-message (cond ((eq (car args) eldoc-last-message) eldoc-last-message) ((null (car args)) nil) @@ -200,8 +227,8 @@ ;; they are Legion. ;; Emacs way of preventing log messages. (let ((message-log-max nil)) - (cond (eldoc-last-message (message "%s" eldoc-last-message)) - (omessage (message nil))))) + (cond (eldoc-last-message (funcall msgfunc "%s" eldoc-last-message)) + (omessage (funcall msgfunc nil))))) eldoc-last-message) ;; This function goes on pre-command-hook for XEmacs or when using idle