Subject: Re: bug#20682: 25.0.50; Enable users to combine --script and --quick

From: Stefan Monnier <[email-masked]>
Date: Thu, 28 May 2015 14:48:04 -0400

> This is a feature request to enable users to write emacs scripts (à la
> --script) that can be executed in a way that --quick does (i.e. avoid
> loading site stuff).

I'm not very much in favor of adding yet another ad-hoc arg for that.
OTOH I'd be happy to see a new argument that lets you provide various
args as one.  E.g. "emacs --args=-Q,--script" which would be more
generally useful to deal with the limit of only one arg in shebang.
Given the size limit of shebang lines, we'd also want this extra arg to
be shortish.

An alternative would be to combine --args and --script, so you could
say "emacs --script=-Q" to get what you're asking for.

>  - There are no messages like:

>      Loading 00debian-vars...
>      Loading /etc/emacs/site-start.d/50a2ps.el (source)...
>      Loading /etc/emacs/site-start.d/50autoconf.el (source)...
>      Loading /etc/emacs/site-start.d/50cmake-data.el (source)...
>      Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
>      Loading debian-ispell...
>      Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
>      Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
>      Loading /etc/emacs/site-start.d/51debian-el.el (source)...

>    when running a script.  That would be a nice thing if you wanted to
>    write something like wc or so.

I consider those messages as bugs.

BTW, Ideally, Debian packaging of Emacs packages should move towards
installing those packages as ELPA packages (i.e. install them into one
of package-directory-list and let Emacs load their <pkg>-autoloads.el
file).

>  - It would speed up startup by a factor of five (for me, 0.01 secs
>    vs. 0.002 secs when using the wrapper from above)

We should look into speeding this up, BTW.  Part of it might be
a problem on Debian's side (where those files do too much), but
I suspect that the problem goes deeper and we should figure out how to
improve it.  E.g. package.el's handling of package initialization could
use some optimization for the usual case where the set of packages is
the same as last time.

E.g. Ideally we could cache somewhere the last set of packages seen
along with the resulting set of <pkg>-autoloads.el files that we loaded
and actually keep the concatenation of those files into a single file
which we'd load instead.  Of course, this won't work currently because
those files are "position dependent" (e.g. they use load-file-name or
#$), but we should try and solve those problems.

>  - It might not be necessary to load site stuff.  On the contrary, if
>    you want to write portable scripts, it might be more desirable to be
>    able to write environment independent scripts

I tend to consider that any <pkg>-autoloads.el file should be 100%
harmless, or at least that the kind of changes they cause should be no
worse than the kinds of changes you experience when going from
Emacs-A.B to Emacs-A.C or Emacs-A+1.C

        Stefan

PS: Just to clarify, this should not be taken as an argument against
providing a way to get both -Q and --script as a single arg.