all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#71537: 30.0.50; [PATCH] missing autoload cookies
@ 2024-06-13 14:59 Gerard Vermeulen
  2024-06-13 15:33 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Gerard Vermeulen @ 2024-06-13 14:59 UTC (permalink / raw)
  To: 71537

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

Hello,

I propose the attached patch adding three missing autoload cookies
to eliminate two require forms from two sections in my init.el.

To eliminate (require 'shortdoc) from the first section:
(with-eval-after-load 'help-fns
   ;; ChatGPT recommends to require `shortdoc' contrary to the
   ;; `shortdoc-help-fns-examples-function' documentation string.
   (require 'shortdoc)
   (add-hook 'help-fns-describe-function-functions
             #'shortdoc-help-fns-examples-function)
   (setopt help-enable-symbol-autoload t))

And to eliminate (require 'pulse) from the second section:
(require 'pulse) ; since `pulse' does not autoload `pulse-delay' and
                  ; `pulse-iterations'.

(defun flash-line-around-point (&rest _)
   "Flash the line around point."
   (let ((pulse-iterations 16)
         (pulse-delay 0.1))
     (pulse-momentary-highlight-one-line (point))))

(dolist (command '(scroll-up-command
                    scroll-down-command
                    recenter-top-bottom
                    other-window))
   (advice-add command :after #'flash-line-around-point))

Regards -- Gerard

[-- Attachment #2: missing-autoload-cookies.patch --]
[-- Type: application/octet-stream, Size: 913 bytes --]

diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el
index d9f6a40865a..72867b8562e 100644
--- a/lisp/cedet/pulse.el
+++ b/lisp/cedet/pulse.el
@@ -94,11 +94,13 @@ pulse-highlight-face
 
 ;;; Code:
 
+;;;###autoload
 (defcustom pulse-iterations 10
   "Number of iterations in a pulse operation."
   :group 'pulse
   :type 'number)
 
+;;;###autoload
 (defcustom pulse-delay .03
   "Delay between face lightening iterations."
   :group 'pulse
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index a1e49b50510..54fdba70675 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -1649,6 +1649,7 @@ shortdoc-function-examples
      groups)
     examples))
 
+;;;###autoload
 (defun shortdoc-help-fns-examples-function (function)
   "Insert Emacs Lisp examples for FUNCTION into the current buffer.
 You can add this function to the `help-fns-describe-function-functions'

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#71537: 30.0.50; [PATCH] missing autoload cookies
  2024-06-13 14:59 bug#71537: 30.0.50; [PATCH] missing autoload cookies Gerard Vermeulen
@ 2024-06-13 15:33 ` Eli Zaretskii
  2024-06-13 20:57   ` Gerard Vermeulen
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-06-13 15:33 UTC (permalink / raw)
  To: Gerard Vermeulen; +Cc: 71537

> Date: Thu, 13 Jun 2024 14:59:06 +0000
> From: Gerard Vermeulen <gerard.vermeulen@posteo.net>
> 
> I propose the attached patch adding three missing autoload cookies
> to eliminate two require forms from two sections in my init.el.
> 
> To eliminate (require 'shortdoc) from the first section:
> (with-eval-after-load 'help-fns
>    ;; ChatGPT recommends to require `shortdoc' contrary to the
>    ;; `shortdoc-help-fns-examples-function' documentation string.
>    (require 'shortdoc)
>    (add-hook 'help-fns-describe-function-functions
>              #'shortdoc-help-fns-examples-function)
>    (setopt help-enable-symbol-autoload t))
> 
> And to eliminate (require 'pulse) from the second section:
> (require 'pulse) ; since `pulse' does not autoload `pulse-delay' and
>                   ; `pulse-iterations'.
> 
> (defun flash-line-around-point (&rest _)
>    "Flash the line around point."
>    (let ((pulse-iterations 16)
>          (pulse-delay 0.1))
>      (pulse-momentary-highlight-one-line (point))))
> 
> (dolist (command '(scroll-up-command
>                     scroll-down-command
>                     recenter-top-bottom
>                     other-window))
>    (advice-add command :after #'flash-line-around-point))

Thanks, but I don't understand why what we have now constitutes a
problem.  help-fns loads shortdoc when it needs it, and
pulse-momentary-highlight-one-line is autoloaded already (you don't
need to auto-load variables to assign values to them).

Can you describe the problems you have if you delete those 'require's
from your init file, and explain why manually requiring them is a
problem?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#71537: 30.0.50; [PATCH] missing autoload cookies
  2024-06-13 15:33 ` Eli Zaretskii
@ 2024-06-13 20:57   ` Gerard Vermeulen
  2024-06-14  6:43     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Gerard Vermeulen @ 2024-06-13 20:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 71537



On 13.06.2024 17:33, Eli Zaretskii wrote:
>> Date: Thu, 13 Jun 2024 14:59:06 +0000
>> From: Gerard Vermeulen <gerard.vermeulen@posteo.net>
>> 
>> I propose the attached patch adding three missing autoload cookies
>> to eliminate two require forms from two sections in my init.el.
>> 
>> To eliminate (require 'shortdoc) from the first section:
>> (with-eval-after-load 'help-fns
>>    ;; ChatGPT recommends to require `shortdoc' contrary to the
>>    ;; `shortdoc-help-fns-examples-function' documentation string.
>>    (require 'shortdoc)
>>    (add-hook 'help-fns-describe-function-functions
>>              #'shortdoc-help-fns-examples-function)
>>    (setopt help-enable-symbol-autoload t))
>> 
>> And to eliminate (require 'pulse) from the second section:
>> (require 'pulse) ; since `pulse' does not autoload `pulse-delay' and
>>                   ; `pulse-iterations'.
>> 
>> (defun flash-line-around-point (&rest _)
>>    "Flash the line around point."
>>    (let ((pulse-iterations 16)
>>          (pulse-delay 0.1))
>>      (pulse-momentary-highlight-one-line (point))))
>> 
>> (dolist (command '(scroll-up-command
>>                     scroll-down-command
>>                     recenter-top-bottom
>>                     other-window))
>>    (advice-add command :after #'flash-line-around-point))
> 
> Thanks, but I don't understand why what we have now constitutes a
> problem.  help-fns loads shortdoc when it needs it, and
> pulse-momentary-highlight-one-line is autoloaded already (you don't
> need to auto-load variables to assign values to them).
> 
> Can you describe the problems you have if you delete those 'require's
> from your init file, and explain why manually requiring them is a
> problem?

I try: after deleting those require's:

1. and after doing "M-x describe-function shortdoc" before shortdoc has 
been
     (auto)loaded by something else, I get in my message window:

     help-fns--run-describe-functions: Symbol’s function definition is 
void: shortdoc-help-fns-examples-function

     and the help window does not show (is not created).

     Addition of an autoload cookie to 
shortdoc-help-fns-examples-function
     fixes this.

2. and after calling "other-window" flash-line-around-point gets called,
     but I get in my message window:

     byte-code: Defining as dynamic an already lexical var: 
pulse-iterations

     and the expected visual effect (a slow - about 2 seconds - flashing 
of
     the line containing point) does not show itself.  Addition of the 
two
     autoload cookies to the two defcustoms pulse-iterations and 
pulse-delay
     fixes this.

Manually requiring the two requires is not a real problem, but just 
somewhat
inconvenient and surprising in my point of view (FWIW).








^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#71537: 30.0.50; [PATCH] missing autoload cookies
  2024-06-13 20:57   ` Gerard Vermeulen
@ 2024-06-14  6:43     ` Eli Zaretskii
  2024-06-14  8:29       ` Gerard Vermeulen
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-06-14  6:43 UTC (permalink / raw)
  To: Gerard Vermeulen; +Cc: 71537

> Date: Thu, 13 Jun 2024 20:57:50 +0000
> From: Gerard Vermeulen <gerard.vermeulen@posteo.net>
> Cc: 71537@debbugs.gnu.org
> 
> > Thanks, but I don't understand why what we have now constitutes a
> > problem.  help-fns loads shortdoc when it needs it, and
> > pulse-momentary-highlight-one-line is autoloaded already (you don't
> > need to auto-load variables to assign values to them).
> > 
> > Can you describe the problems you have if you delete those 'require's
> > from your init file, and explain why manually requiring them is a
> > problem?
> 
> I try: after deleting those require's:
> 
> 1. and after doing "M-x describe-function shortdoc" before shortdoc has 
> been
>      (auto)loaded by something else, I get in my message window:
> 
>      help-fns--run-describe-functions: Symbol’s function definition is 
> void: shortdoc-help-fns-examples-function
> 
>      and the help window does not show (is not created).

I cannot reproduce this.  For me, the *Help* buffer is displayed
without any error message.  Are you using the latest master branch of
the Emacs Git repository?  Is this in "emacs -Q"?

> 2. and after calling "other-window" flash-line-around-point gets called,
>      but I get in my message window:
> 
>      byte-code: Defining as dynamic an already lexical var: 
> pulse-iterations

You should use setq (or setopt) instead of let-binding.  These two
variables are user options, so let-binding them is not appropriate.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#71537: 30.0.50; [PATCH] missing autoload cookies
  2024-06-14  6:43     ` Eli Zaretskii
@ 2024-06-14  8:29       ` Gerard Vermeulen
  2024-06-14 11:00         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Gerard Vermeulen @ 2024-06-14  8:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 71537



On 14.06.2024 08:43, Eli Zaretskii wrote:
>> Date: Thu, 13 Jun 2024 20:57:50 +0000
>> From: Gerard Vermeulen <gerard.vermeulen@posteo.net>
>> Cc: 71537@debbugs.gnu.org
>> 
>> > Thanks, but I don't understand why what we have now constitutes a
>> > problem.  help-fns loads shortdoc when it needs it, and
>> > pulse-momentary-highlight-one-line is autoloaded already (you don't
>> > need to auto-load variables to assign values to them).
>> >
>> > Can you describe the problems you have if you delete those 'require's
>> > from your init file, and explain why manually requiring them is a
>> > problem?
>> 
>> I try: after deleting those require's:
>> 
>> 1. and after doing "M-x describe-function shortdoc" before shortdoc 
>> has
>> been
>>      (auto)loaded by something else, I get in my message window:
>> 
>>      help-fns--run-describe-functions: Symbol’s function definition is
>> void: shortdoc-help-fns-examples-function
>> 
>>      and the help window does not show (is not created).
> 
> I cannot reproduce this.  For me, the *Help* buffer is displayed
> without any error message.  Are you using the latest master branch of
> the Emacs Git repository?  Is this in "emacs -Q"?

It works in "emacs -Q" in yesterday's master branch.

In the process, I figured out what was the issue in my init.el:

shortdoc-help-fns-examples-function was the first item in
the help-fns-describe-function-functions list and this needs the 
require.

After moving shortdoc-help-fns-examples-function after all 
help-fns--XXXX
functions in the list, everything works fine without the require.

> 
>> 2. and after calling "other-window" flash-line-around-point gets 
>> called,
>>      but I get in my message window:
>> 
>>      byte-code: Defining as dynamic an already lexical var:
>> pulse-iterations
> 
> You should use setq (or setopt) instead of let-binding.  These two
> variables are user options, so let-binding them is not appropriate.

Indeed, it works with setq.

Thanks a lot. You can close the bug, as far as I am concerned.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#71537: 30.0.50; [PATCH] missing autoload cookies
  2024-06-14  8:29       ` Gerard Vermeulen
@ 2024-06-14 11:00         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-06-14 11:00 UTC (permalink / raw)
  To: Gerard Vermeulen; +Cc: 71537-done

> Date: Fri, 14 Jun 2024 08:29:01 +0000
> From: Gerard Vermeulen <gerard.vermeulen@posteo.net>
> Cc: 71537@debbugs.gnu.org
> 
> 
> 
> On 14.06.2024 08:43, Eli Zaretskii wrote:
> >> Date: Thu, 13 Jun 2024 20:57:50 +0000
> >> From: Gerard Vermeulen <gerard.vermeulen@posteo.net>
> >> Cc: 71537@debbugs.gnu.org
> >> 
> >> > Thanks, but I don't understand why what we have now constitutes a
> >> > problem.  help-fns loads shortdoc when it needs it, and
> >> > pulse-momentary-highlight-one-line is autoloaded already (you don't
> >> > need to auto-load variables to assign values to them).
> >> >
> >> > Can you describe the problems you have if you delete those 'require's
> >> > from your init file, and explain why manually requiring them is a
> >> > problem?
> >> 
> >> I try: after deleting those require's:
> >> 
> >> 1. and after doing "M-x describe-function shortdoc" before shortdoc 
> >> has
> >> been
> >>      (auto)loaded by something else, I get in my message window:
> >> 
> >>      help-fns--run-describe-functions: Symbol’s function definition is
> >> void: shortdoc-help-fns-examples-function
> >> 
> >>      and the help window does not show (is not created).
> > 
> > I cannot reproduce this.  For me, the *Help* buffer is displayed
> > without any error message.  Are you using the latest master branch of
> > the Emacs Git repository?  Is this in "emacs -Q"?
> 
> It works in "emacs -Q" in yesterday's master branch.
> 
> In the process, I figured out what was the issue in my init.el:
> 
> shortdoc-help-fns-examples-function was the first item in
> the help-fns-describe-function-functions list and this needs the 
> require.
> 
> After moving shortdoc-help-fns-examples-function after all 
> help-fns--XXXX
> functions in the list, everything works fine without the require.
> 
> > 
> >> 2. and after calling "other-window" flash-line-around-point gets 
> >> called,
> >>      but I get in my message window:
> >> 
> >>      byte-code: Defining as dynamic an already lexical var:
> >> pulse-iterations
> > 
> > You should use setq (or setopt) instead of let-binding.  These two
> > variables are user options, so let-binding them is not appropriate.
> 
> Indeed, it works with setq.
> 
> Thanks a lot. You can close the bug, as far as I am concerned.

Done, thanks.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-14 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13 14:59 bug#71537: 30.0.50; [PATCH] missing autoload cookies Gerard Vermeulen
2024-06-13 15:33 ` Eli Zaretskii
2024-06-13 20:57   ` Gerard Vermeulen
2024-06-14  6:43     ` Eli Zaretskii
2024-06-14  8:29       ` Gerard Vermeulen
2024-06-14 11:00         ` Eli Zaretskii

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.