GNU bug report logs - #58801
[PATCH] Autoload the `calc-eval-error' variable

Previous Next

Package: emacs;

Reported by: Matt Armstrong <matt <at> rfc20.org>

Date: Wed, 26 Oct 2022 17:04:01 UTC

Severity: wishlist

Tags: patch

Fixed in version 30.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #25 received at 58801 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Matt Armstrong <matt <at> rfc20.org>
Cc: 58801 <at> debbugs.gnu.org
Subject: Re: bug#58801: [PATCH] Autoload the `calc-eval-error' variable
Date: Thu, 7 Sep 2023 00:51:57 -0700
Matt Armstrong <matt <at> rfc20.org> writes:

> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
>> Matt Armstrong <matt <at> rfc20.org> writes:
>>
>>> Note that in my case I had (require 'calc) in the file that used the
>>> `calc-eval-error' symbol.  The info docs for calc state that (require
>>> 'calc) loads nearly everything you need from calc.  I may not understand
>>> something about the design constraints here, but it seems strange to
>>> refrain from autoloading this symbol, since (require 'calc) already
>>> (auto)loads a *lot* of stuff.
>>
>> So you are saying that if you have a file foo.el, that requires calc,
>> and then tries to use calc-eval-error variable (documented as part of
>> the external API), you get a byte-compiler warning?
>>
>> I agree that this doesn't sound very intuitive.
>
> I regret typing about `require' at all, as my line of argument is
> simpler than that.
>
> Running "emacs -Q" comes with `calc-eval' autoloaded.  Since calc
> documentation mentions `calc-eval-error' as a configuration variable for
> the `calc-eval' behavior, it is makes most sense to autoload either
> neither of them or both of them.

Thanks, now I understand the situation better.

We typically avoid autoloading variables, and I'm not sure it's
justified here.  See (info "(elisp) When to Autoload") for details.

Could we instead just declare it in calc.el?  I believe that should
silence any warnings from the byte-compiler.  It's a one line change:

    (defvar calc-eval-error)

Or will that not work in your use case for some reason?

> (In the particular case of the Calc package, dozens of functions and
> variables are already autoloaded.  The omission of `calc-eval-error'
> also seems more an oversight than intentional.)

FWIW, I couldn't find any autoloaded variables in calc-loaddefs.el.
What am I missing?




This bug report was last modified 1 year and 194 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.