From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Matt Armstrong <matt@rfc20.org>
Cc: 59707@debbugs.gnu.org
Subject: bug#59707: 29.0.50; Seeking a more robust `package-quickstart'
Date: Tue, 29 Nov 2022 21:37:15 -0500 [thread overview]
Message-ID: <jwvlentchhm.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87edtlpact.fsf@rfc20.org> (Matt Armstrong's message of "Tue, 29 Nov 2022 16:14:10 -0800")
> With this, emacs fails to launch, instead printing:
>
> Symbol’s value as variable is void: geiser-active-implementations
Did `--debug-init` provide a backtrace?
> The code for `geiser-activate-implementation' was originally:
>
> (defsubst geiser-activate-implementation (impl)
> (add-to-list 'geiser-active-implementations impl))
>
> So the `(add-to-list 'geiser-active-implementations 'guile)' ended up
> inlined into "package-quickstart.elc", which executed directly, without
> first (auto) loading 'geiser-impl' as was intended. Thus, the
> `geiser-active-implementations' variable did not exist, yet was
> referenced, by inlining, but did not appear textually in
> package-quickstart.el.
>
> Once understood obvious fix to make geiser-activate-implementation a
> defun instead of a defsubst.
FWIW, that's a rather poor fix, since it causes `geiser-impl.el` (and
the files it requires) to be unconditionally loaded during
Emacs startup. The better fix would be to make sure the
`geiser-active-implementations` itself gets initialized before the calls
to `geiser-activate-implementation`.
> Ideas for improvement (also seeking ideas from others)
> ========================================
>
> 0) Make `package-quickstart t' the default, because it is great, and
> that way people tend to see the same kinds of problems. :-)
I think it's a good idea to do that on `master`, indeed.
> 1) Harden Emacs such that signaled errors from "package-quickstart.elc"
> don't prevent startup (but are somehow saved and logged, maybe as
> warnings?).
Agreed. I suspect it should also do things like delete the `.elc` file
(and/or the `.el` file), or at least suggest doing it, so as to help
diagnose/circumvent the problem.
> 2) Make --debug-init functional for errors thrown by
> "package-quickstart.elc". Currently, package-quickstart is loaded
> before the first frame is initialized, so Emacs takes the "print the
> error and exit" route for any signaled errors, instead of, for example,
> ending up in the elisp debugger.
In the case of `--debug-init` it could at least print the backtrace on
`stderr`. Or store the backtrace and display it later (even though the
debugger wouldn't be active, it would still be nicer to manipulate than
when sent to stderr).
> 3) Perhaps package-quickstart.elc could be loaded later in the
> initialization phase, after the first frame is created?
I'm not in favor of such a change, no.
> 5) Change "package-quickstart.el" code gen to provide more context for
> errors, perhaps with `condition-case-unless-debug'. The jwigley's
> use-package package does something similar in its macro expansions and
> it is nice. In the specific case with the geiser packages, because
> Emacs exited immediately, it would have been useful to know that the
> error came from the "geiser-guile-autloads" portion of
> "package-quickstart.elc".
We could probably use `(setq load-file-name ...)` between file chunks
(instead of `let` binding the var) and wrap the whole file with
a `condition-case` which then prints the "current" `load-file-name`.
> 6) Print a warning when a `defsubst' function is autoloaded, as the
> autoload won't work from byte compiled code.
It works. It just works differently (it copies the whole `defsubst`
instead of placing an `autoload` statement). AFAIK byte-compiled or not
doesn't make much difference in this respect.
Stefan
next prev parent reply other threads:[~2022-11-30 2:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 0:14 bug#59707: 29.0.50; Seeking a more robust `package-quickstart' Matt Armstrong
2022-11-30 2:37 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-11-30 5:59 ` Matt Armstrong
2022-11-30 13:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-30 19:13 ` Matt Armstrong
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=jwvlentchhm.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=59707@debbugs.gnu.org \
--cc=matt@rfc20.org \
--cc=monnier@iro.umontreal.ca \
/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).