all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: daanturo <daanturo@gmail.com>
To: 59167@debbugs.gnu.org
Subject: bug#59167: 27.2; eldoc-documentation-strategy being 'ignore prevents new eldoc supports
Date: Thu, 10 Nov 2022 19:41:54 +0700	[thread overview]
Message-ID: <fbf9b2c5-50ce-09c2-e8ff-47ad10026dbe@gmail.com> (raw)
In-Reply-To: <580e34a2-4602-2353-5607-288c65861812@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

This version takes `eldoc-documentation-strategy`'s `default-value` to set
instead (the previous one may take the buffer-local value).

Another justification for the patch:

If `eldoc-documentation-strategy` is already set before loading the new eldoc,
loading the library will pop this warning up:

```
Warning (defvaralias): Overwriting value of ‘eldoc-documentation-strategy’ by aliasing to ‘eldoc-documentation-function’
```

By setting `eldoc-documentation-function` before defining
`eldoc-documentation-strategy` as alias, we can preserver its value of avoid
this warning.


By the way, why was `eldoc-documentation-strategy` made obsolete instead of
`eldoc-documentation-function`, isn't the latter's usage ough to be warned
against?

The second patch declares the correct obsolete one.

-- 
Daanturo.

[-- Attachment #2: 0002-Eldoc-on-old-Emacs-correct-the-obsolete-variable.patch --]
[-- Type: text/x-patch, Size: 1263 bytes --]

From 1a695f0f1acdb537e7fa05bcbed5996ce1ee6ce2 Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@gmail.com>
Date: Thu, 10 Nov 2022 19:32:20 +0700
Subject: [PATCH 2/2] Eldoc on old Emacs: correct the obsolete variable

* lisp/emacs-lisp/eldoc.el (eldoc--documentation-strategy-defcustom):
make eldoc-documentation-function the obsolete one instead of
eldoc-documentation-strategy.
---
 lisp/emacs-lisp/eldoc.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index d5d46446eb..2356a8e024 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -697,7 +697,8 @@ This is meant to be used as a value for `eldoc-documentation-strategy'."
            ;; restore user setting, or our default
            (setq-default ,secondary (or (and (boundp ',main) (default-value ',main))
                                         #'eldoc-documentation-default)))
-         (define-obsolete-variable-alias ',main ',secondary "eldoc-1.1.0"))
+         (defvaralias ',main ',secondary)
+         (make-obsolete-variable ',secondary ',main  "eldoc-1.14.0"))
        (progn
          (defcustom ,main ,value ,docstring  ,@more)
          (defvaralias ',secondary ',main ,docstring))))
-- 
2.38.1


[-- Attachment #3: 0001-Don-t-set-eldoc-strategy-to-ignore-on-Emacs-27-and-b.patch --]
[-- Type: text/x-patch, Size: 1399 bytes --]

From e5e27868a7671d8d52c5920b286bf22a2cc9aac5 Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@gmail.com>
Date: Thu, 10 Nov 2022 16:56:50 +0700
Subject: [PATCH 1/2] Don't set eldoc strategy to ignore on Emacs 27 and below

* lisp/emacs-lisp/eldoc.el (eldoc--documentation-strategy-defcustom): on
Emacs 27 and below, prevent eldoc-documentation-strategy (an alias of
eldoc-documentation-function) being set to 'ignore globally.
---
 lisp/emacs-lisp/eldoc.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index e1801c45b7..d5d46446eb 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -691,6 +691,12 @@ This is meant to be used as a value for `eldoc-documentation-strategy'."
   `(if (< emacs-major-version 28)
        (progn
          (defcustom ,secondary ,value ,docstring ,@more)
+         ;; `eldoc-documentation-strategy' being `ignore' invalidates
+         ;; supports for it
+         (when (equal (default-value ',secondary) #'ignore)
+           ;; restore user setting, or our default
+           (setq-default ,secondary (or (and (boundp ',main) (default-value ',main))
+                                        #'eldoc-documentation-default)))
          (define-obsolete-variable-alias ',main ',secondary "eldoc-1.1.0"))
        (progn
          (defcustom ,main ,value ,docstring  ,@more)
-- 
2.38.1


      reply	other threads:[~2022-11-10 12:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 11:30 bug#59167: 27.2; eldoc-documentation-strategy being 'ignore prevents new eldoc supports daanturo
2022-11-10 12:41 ` daanturo [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=fbf9b2c5-50ce-09c2-e8ff-47ad10026dbe@gmail.com \
    --to=daanturo@gmail.com \
    --cc=59167@debbugs.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.