emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-30 73c1252bb6b: Fix link to major mode variable in docstring


From: Thierry Volpiatto
Subject: Re: emacs-30 73c1252bb6b: Fix link to major mode variable in docstring
Date: Tue, 09 Jul 2024 04:22:35 +0000

Thierry Volpiatto <thievol@posteo.net> writes:

> Stefan Kangas <stefankangas@gmail.com> writes:
>
>> Eshel Yaron <me@eshelyaron.com> writes:
>>
>>> I think it's not always correct to say "the variable" here, because that
>>> "%s" may be replaced with a form that's not just a variable.  E.g. now
>>> C-h f global-auto-revert-mode RET says:
>>>
>>>   To check whether the minor mode is enabled in the current buffer,
>>>   evaluate the variable ‘(default-value 'global-auto-revert-mode)’.
>>
>> Thanks, you're right.  Now reverted.
>
> No, this is not right, reverting fix nothing, we are just back to previous
> bug, this is unrelated, the bug is in `easy-mmode--mode-docstring` which
> have a misleading arg called 'getter' and naturally `define-minor-mode`
> pass 'getter' to it instead of passing 'mode'.
>
> PS: Please CC me as I am not suscribed to this list, thanks.

So to resume, the change done in bug#71815 i.e. adding "the variable"
before the button in `easy-mmode--arg-docstring` have nothing to do with
what described above (about global-auto-revert-mode), this bug was here
before the change introduced by bug#71815, so please reenable "the
variable" change in `easy-mmode--arg-docstring` . The following patch
should fixes the bug described above about global minor-mode showing the
exp (default-value 'global-xxx-mode), this happens in all global minor-modes.

diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 7006ae6c785..445cf822045 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -97,7 +97,7 @@ The mode's hook is called both when the mode is enabled and 
when
 it is disabled.")
 
 (defun easy-mmode--mode-docstring (doc mode-pretty-name keymap-sym
-                                       getter global)
+                                       variable global)
   ;; If we have a doc string, and it's already complete (which we
   ;; guess at with the simple heuristic below), then just return that
   ;; as is.
@@ -129,7 +129,7 @@ it is disabled.")
                         (if global "global " "")
                         mode-pretty-name
                         ;; Avoid having quotes turn into pretty quotes.
-                        (string-replace "'" "\\='" (format "%S" getter)))))
+                        (string-replace "'" "\\='" (format "%S" variable)))))
           (let ((start (point)))
             (insert argdoc)
             (when (fboundp 'fill-region) ;Don't break bootstrap!
@@ -336,7 +336,7 @@ or call the function `%s'."))))
          warnwrap
          `(defun ,modefun (&optional arg ,@extra-args)
             ,(easy-mmode--mode-docstring doc pretty-name keymap-sym
-                                         getter globalp)
+                                         (or variable mode) globalp)
             ,(when interactive
               ;; Use `toggle' rather than (if ,mode 0 1) so that using
               ;; repeat-command still does the toggling correctly.

-- 
Thierry

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]