Subject: bug#16920: 24.3; fix eldoc-message to clear own message only

From: Leo Liu <[email-masked]>
Date: Sun, 02 Mar 2014 15:18:10 +0800

I would like to fix eldoc-message for the upcoming release. Now that
eldoc can be used in the minibuffer there is one issue that can be
really annoying.

1. M-x eval-expression
2. type in (+ 1 1 |) ; | is the cursor
3. quickly pressing SPC repeatedly and then RET

The value 2 is shown and then cleared by eldoc (when eldoc-idle-delay is
short enough one may not see the value at all). The proposed fix is in
the following patch. Comments or objections?

=== modified file 'lisp/emacs-lisp/eldoc.el'
--- lisp/emacs-lisp/eldoc.el	2014-01-30 07:54:28 +0000
+++ lisp/emacs-lisp/eldoc.el	2014-03-02 07:14:45 +0000
@@ -255,7 +255,8 @@
     (let ((message-log-max nil))
       (cond (eldoc-last-message
 	     (funcall eldoc-message-function "%s" eldoc-last-message))
-	    (omessage (funcall eldoc-message-function nil)))))
+	    (omessage (and (equal omessage (current-message))
+			   (funcall eldoc-message-function nil))))))
   eldoc-last-message)
 
 (defun eldoc--message-command-p (command)