From: "João Távora" <joaotavora@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: Glenn Morris <rgm@gnu.org>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: master 9ade7ea: Fix Eldoc problem when loading on Emacs 26.3
Date: Fri, 10 Jul 2020 20:57:00 +0100 [thread overview]
Message-ID: <87h7ufdtyr.fsf@gmail.com> (raw)
In-Reply-To: <87lfjrdzna.fsf@gmail.com> ("João Távora"'s message of "Fri, 10 Jul 2020 18:54:17 +0100")
João Távora <joaotavora@gmail.com> writes:
> Noam Postavsky <npostavs@gmail.com> writes:
>>> makunbound, as Noam suggested, doesn't work.
>>> Is there an easy way to "unlocalize" a symbol?
>> Oh, maybe kill-local-variable?
>
> No, that doesn't work either. I was looking at data.c and alloc.c and
> Maybe come up with a better idea, or maybe, like Stefan suggests, don't
> make it an alias at all, just deprecate it and keep using it instead of
> eldoc-documentation-strategy when we find it to be bound.
That sort of works, but it forces extensions that do want to
"Package-Require" eldoc to remember to unbind
eldoc-documentation-function if they are loaded on older Emacs versions,
which is undesirable.
So I think a better plan is just to reverse the variable alias on older
Emacs versions. Attaching the patch that does this:
commit b7019ed5e76dda40642db1b20d3dd1484b2536e6
Author: João Távora <joaotavora@gmail.com>
Date: Fri Jul 10 20:49:54 2020 +0100
Sort out Eldoc backward compatibility of eldoc-documentation-function
Use eldoc--documentation-strategy-defcustom to decide in which
direction to make the variable alias, depending on the Emacs version.
* lisp/emacs-lisp/eldoc.el
(eldoc--documentation-strategy-defcustom): Helper macro.
(eldoc-documentation-strategy, eldoc-documentation-function): Use it.
(Version): Bump to 1.5.0
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 7964c4c45a..ccae09a906 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
@@ -535,10 +535,27 @@ eldoc-documentation-enthusiast
(if (stringp str) (funcall callback str))
nil))))
-(define-obsolete-variable-alias 'eldoc-documentation-function
- 'eldoc-documentation-strategy "eldoc-1.1.0")
-
-(defcustom eldoc-documentation-strategy #'eldoc-documentation-default
+;; JT@2020-07-10: Eldoc is pre-loaded, so in in Emacs < 28 we can't
+;; make the "old" `eldoc-documentation-function' point to the new
+;; `eldoc-documentation-strategy', so we do the reverse. This allows
+;; for Eldoc to be loaded in those older Emacs versions and work with
+;; whomever (major-modes, extensions, ueser) sets one of the other
+;; variable.
+(defmacro eldoc--documentation-strategy-defcustom
+ (main secondary value docstring &rest more)
+ "Defcustom helper macro for sorting `eldoc-documentation-strategy'."
+ (declare (indent 2))
+ `(if (< emacs-major-version 28)
+ (progn
+ (defcustom ,secondary ,value ,docstring ,@more)
+ (defvaralias ',main ',secondary ,docstring))
+ (progn
+ (defcustom ,main ,value ,docstring ,@more)
+ (defvaralias ',secondary ',main ,docstring))))
+
+(eldoc--documentation-strategy-defcustom eldoc-documentation-strategy
+ eldoc-documentation-function
+ #'eldoc-documentation-default
"How to collect and organize results of `eldoc-documentation-functions'.
This variable controls how `eldoc-documentation-functions', which
next prev parent reply other threads:[~2020-07-10 19:57 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 [this message]
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
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=87h7ufdtyr.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=emacs-devel@gnu.org \
--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.