unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefankangas@gmail.com>
To: Matt Armstrong <matt@rfc20.org>
Cc: 58801@debbugs.gnu.org
Subject: bug#58801: [PATCH] Autoload the `calc-eval-error' variable
Date: Thu, 7 Sep 2023 00:51:57 -0700	[thread overview]
Message-ID: <CADwFkm=MFk2woDoa7P+kUV4QdcKgW1kketRF_ox1Z+nh=-TW8Q@mail.gmail.com> (raw)
In-Reply-To: <87o7std54i.fsf@rfc20.org> (Matt Armstrong's message of "Sat, 26 Nov 2022 08:58:53 -0800")

Matt Armstrong <matt@rfc20.org> writes:

> Stefan Kangas <stefankangas@gmail.com> writes:
>
>> Matt Armstrong <matt@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?





  reply	other threads:[~2023-09-07  7:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 17:02 bug#58801: [PATCH] Autoload the `calc-eval-error' variable Matt Armstrong
2022-11-11 13:16 ` Stefan Kangas
2022-11-15 18:24   ` Matt Armstrong
2022-11-15 18:42     ` Eli Zaretskii
2022-11-24 19:50     ` Stefan Kangas
2022-11-26 16:58       ` Matt Armstrong
2023-09-07  7:51         ` Stefan Kangas [this message]
2023-11-05 16:38           ` Stefan Kangas

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkm=MFk2woDoa7P+kUV4QdcKgW1kketRF_ox1Z+nh=-TW8Q@mail.gmail.com' \
    --to=stefankangas@gmail.com \
    --cc=58801@debbugs.gnu.org \
    --cc=matt@rfc20.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).