Subject: Re: bug#27230: eldoc doc

From: [email-masked] (Charles A. Roelli)
Date: Tue, 19 Sep 2017 22:02:33 +0200

> From: Dmitry Gutov <[email-masked]>
> Date: Fri, 15 Sep 2017 01:03:35 +0300
> 
> > Right.  But why should we break its calling convention without good
> > reason, when we can see that now that other packages have been using
> > it?
> 
> Now they know they should fix it, though.

Unfortunately it means there are probably other users of the function,
and if we don't document the change, the function should stay as is.
Attached is a patch that brings back the old behavior, without the
convoluted buggy logic for setting eldoc-last-message.  What do you
think?

And from an earlier message:

> Aside from breaking the "obviously wrong" callers like explained above, 
> the code had a subtle bug where calling it with no format arguments, and 
> then with some arguments, wouldn't update the message area.

Should be fixed with this patch.

>From f872315286949e9b428ee108c66a8bb5f1131953 Mon Sep 17 00:00:00 2001
From: "Charles A. Roelli" <[email-masked]>
Date: Tue, 19 Sep 2017 22:00:54 +0200
Subject: [PATCH] Keep old calling convention of 'eldoc-message'

* lisp/emacs-lisp/eldoc.el (eldoc-message): Keep its old calling
convention, as it's used by other packages.  See the discussion in
Bug#27230, and the previous change 7ef0b5f6 ("Simplify
eldoc-message") of 2017-08-21.
---
 lisp/emacs-lisp/eldoc.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index cba9a00..7176eb8 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -276,12 +276,13 @@ eldoc-minibuffer-message
           (force-mode-line-update)))
     (apply 'message format-string args)))
 
-(defun eldoc-message (&optional string)
+(defun eldoc-message (&optional format-string &rest args)
   "Display STRING as an ElDoc message if it's non-nil.
 
 Also store it in `eldoc-last-message' and return that value."
   (let ((omessage eldoc-last-message))
-    (setq eldoc-last-message string)
+    (setq eldoc-last-message
+          (if args (apply #'format-message format-string args) format-string))
     ;; In emacs 19.29 and later, and XEmacs 19.13 and later, all messages
     ;; are recorded in a log.  Do not put eldoc messages in that log since
     ;; they are Legion.
-- 
2.9.4