From: "João Távora" <joaotavora@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Glenn Morris <rgm@gnu.org>, Noam Postavsky <npostavs@gmail.com>,
emacs-devel <emacs-devel@gnu.org>
Subject: Re: master 9ade7ea: Fix Eldoc problem when loading on Emacs 26.3
Date: Sat, 11 Jul 2020 09:06:24 +0100 [thread overview]
Message-ID: <87zh86cw73.fsf@gmail.com> (raw)
In-Reply-To: <jwvtuyf7x8g.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 10 Jul 2020 19:44:24 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> all, a much safer bet. I've even thought about dropping the whole
>> "rename function to strategy" idea completely, which was just a cosmetic
>> way to escape the awful mind-bending confusion between "e-d-function"
>> singular and "e-d-functions" plural.
>
> The reason why I was happy to see you use a different name is to make it
> possible for eldoc--supported-p to distinguish the case where something
> changed the -strategy var (which shouldn't affect
> eldoc--supported-p) from the case where something changed
> the -function var.
Yes, I know that now, and I don't oppose it. I just don't feel
capacitated enough to separated the two things without mixing myself up
:-). I drafted up this patch yesterday, but it's got this problem I
mentioned. Maybe you can fix it. In the meantime, I'm going to go with
the alias.
João
commit c40761d683dcf70fe7f404b675a3a2631edfeaf0
Author: João Távora <joaotavora@gmail.com>
Date: Fri Jul 10 19:11:01 2020 +0100
Adjust Eldoc backward compatibility of eldoc-documentation-function
Making a variable alias doesn't work because that variable is
preloaded and localized. So just keep the
eldoc-documentation-function, make it obsolete, and let it be used
instead of strategy if it is found to be non-nil (either locally or
globally).
* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): Set
eldoc-documentation-function to nil.
(eldoc-documentation-function): Reinstate variable.
(eldoc--documentation-strategy): New helper function.
(eldoc--invoke-strategy): Use eldoc--documentation-strategy.
(eldoc--supported-p): Reowkr
(Version): Bump to 1.5.0
eldoc--supported-p
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 7964c4c45a..29007807aa 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -5,7 +5,7 @@
;; Author: Noah Friedman <friedman@splode.com>
;; Keywords: extensions
;; Created: 1995-10-06
-;; Version: 1.4.0
+;; Version: 1.5.0
;; Package-Requires: ((emacs "26.3"))
;; This is a GNU ELPA :core package. Avoid functionality that is not
@@ -233,7 +233,8 @@ eldoc--eval-expression-setup
#'elisp-eldoc-var-docstring nil t)
(add-hook 'eldoc-documentation-functions
#'elisp-eldoc-funcall nil t)
- (setq eldoc-documentation-strategy 'eldoc-documentation-default)
+ (setq-local eldoc-documentation-function nil)
+ (setq-local eldoc-documentation-strategy 'eldoc-documentation-default)
(eldoc-mode +1))
;;;###autoload
@@ -535,8 +536,11 @@ eldoc-documentation-enthusiast
(if (stringp str) (funcall callback str))
nil))))
-(define-obsolete-variable-alias 'eldoc-documentation-function
- 'eldoc-documentation-strategy "eldoc-1.1.0")
+(make-obsolete-variable
+ 'eldoc-documentation-function
+ "use `eldoc-documentation-strategy' instead." "eldoc-1.5.0")
+
+(defvar eldoc-documentation-function nil)
(defcustom eldoc-documentation-strategy #'eldoc-documentation-default
"How to collect and organize results of `eldoc-documentation-functions'.
@@ -584,9 +588,14 @@ eldoc-documentation-strategy
(function :tag "Other function"))
:version "28.1")
+(defun eldoc--documentation-strategy ()
+ "Return the actual "
+ (or (bound-and-true-p eldoc-documentation-function)
+ eldoc-documentation-strategy))
+
(defun eldoc--supported-p ()
"Non-nil if an ElDoc function is set for this buffer."
- (and (not (memq eldoc-documentation-strategy '(nil ignore)))
+ (and (not (memq (eldoc--documentation-strategy) '(nil ignore)))
(or eldoc-documentation-functions
;; The old API had major modes set `eldoc-documentation-function'
;; to provide eldoc support. It's impossible now to determine
@@ -596,7 +605,8 @@ eldoc--supported-p
;; `eldoc-documentation-functions' (as in the new API).
;; But at least if it's set buffer-locally it's a good hint that
;; there's some eldoc support in the current buffer.
- (local-variable-p 'eldoc-documentation-strategy))))
+ (local-variable-p 'eldoc-documentation-strategy)
+ (local-variable-p 'eldoc-documentation-function))))
(defvar eldoc--enthusiasm-curbing-timer nil
"Timer used by the `eldoc-documentation-enthusiast' strategy.
@@ -703,7 +713,7 @@ eldoc--invoke-strategy
(display-doc)
t))))))
(let* ((eldoc--make-callback #'make-callback)
- (res (funcall eldoc-documentation-strategy)))
+ (res (funcall (eldoc--documentation-strategy))))
;; Observe the old and the new protocol:
(cond (;; Old protocol: got string, output immediately;
(stringp res) (register-doc 0 res nil) (display-doc))
prev parent reply other threads:[~2020-07-11 8:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200710004934.18557.69586@vcs0.savannah.gnu.org>
[not found] ` <20200710004936.2935520A27@vcs0.savannah.gnu.org>
2020-07-10 16:09 ` master 9ade7ea: Fix Eldoc problem when loading on Emacs 26.3 Glenn Morris
2020-07-10 17:09 ` João Távora
2020-07-10 17:36 ` Noam Postavsky
2020-07-10 17:54 ` João Távora
2020-07-10 19:57 ` João Távora
2020-07-10 21:35 ` Stefan Monnier
2020-07-10 21:58 ` João Távora
2020-07-10 22:16 ` Stefan Monnier
2020-07-10 22:41 ` João Távora
2020-07-10 23:44 ` Stefan Monnier
2020-07-11 8:06 ` João Távora [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh86cw73.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=npostavs@gmail.com \
--cc=rgm@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.