* Silently loading site files in -batch mode
@ 2012-08-05 22:02 Jack Kelly
2012-08-06 5:25 ` Andreas Röhler
0 siblings, 1 reply; 10+ messages in thread
From: Jack Kelly @ 2012-08-05 22:02 UTC (permalink / raw)
To: help-gnu-emacs
(Please CC me in replies - I'm not subscribed.)
Hello again list,
I'm still trying to make batchmode emacs silently load site files.
Despite the warnings about advising builtins, advising `load' so that
it is always called with `NOMESSAGE' works:
(defadvice load (before quiet-loading activate)
(ad-set-arg 2 t))
However, making sure that this advice is added before anything is
loaded is not easy. I have tried adding it to `before-init-hook' and
dumping a new emacs, but calling dump-emacs causes a segfault.
Apparently dumping a dumped emacs ceased to work years ago[1].
My other approach was to invoke emacs with -Q, advise `load' and then
load site-run-file. That doesn't work either, as with -Q,
site-run-file is undefined:
$ emacs -Q -batch -eval "(print site-run-file)"
nil
$
(As I'm writing this code for automake, I could check site-run-file
during configure and save it, but that's not the main problem.)
Unfortunately, debian has seen fit to patch lisp/startup.el[2], which
means that to correctly load everything now means checking if it's a
debianised emacs (and other distros could cause similar mischief).
Are there any other command-line flags or environment variables that I
could use to silence the initial loading messages? If not, are there
any in the development pipeline?
Thanks,
-- Jack
[1]: http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-02/msg00207.html
[2]: http://patch-tracker.debian.org/patch/series/view/emacs24/24.1+1-4/0002-Run-debian-startup-and-set-debian-emacs-flavor.patch
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Silently loading site files in -batch mode
2012-08-05 22:02 Silently loading site files in -batch mode Jack Kelly
@ 2012-08-06 5:25 ` Andreas Röhler
2012-08-06 8:23 ` Jack Kelly
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Röhler @ 2012-08-06 5:25 UTC (permalink / raw)
To: help-gnu-emacs
Am 06.08.2012 00:02, schrieb Jack Kelly:
> (Please CC me in replies - I'm not subscribed.)
>
> Hello again list,
>
> I'm still trying to make batchmode emacs silently load site files.
> Despite the warnings about advising builtins, advising `load' so that
> it is always called with `NOMESSAGE' works:
>
> (defadvice load (before quiet-loading activate)
> (ad-set-arg 2 t))
>
> However, making sure that this advice is added before anything is
> loaded is not easy. I have tried adding it to `before-init-hook' and
> dumping a new emacs, but calling dump-emacs causes a segfault.
> Apparently dumping a dumped emacs ceased to work years ago[1].
>
> My other approach was to invoke emacs with -Q, advise `load' and then
> load site-run-file. That doesn't work either, as with -Q,
> site-run-file is undefined:
>
> $ emacs -Q -batch -eval "(print site-run-file)"
>
> nil
> $
>
> (As I'm writing this code for automake, I could check site-run-file
> during configure and save it, but that's not the main problem.)
>
> Unfortunately, debian has seen fit to patch lisp/startup.el[2], which
> means that to correctly load everything now means checking if it's a
> debianised emacs (and other distros could cause similar mischief).
>
> Are there any other command-line flags or environment variables that I
> could use to silence the initial loading messages? If not, are there
> any in the development pipeline?
>
> Thanks,
>
> -- Jack
>
> [1]: http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-02/msg00207.html
> [2]: http://patch-tracker.debian.org/patch/series/view/emacs24/24.1+1-4/0002-Run-debian-startup-and-set-debian-emacs-flavor.patch
>
>
$EMACS -Q --batch --eval "(load \"MY-FILE\" nil t)"
Maybe like that?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Silently loading site files in -batch mode
2012-08-06 5:25 ` Andreas Röhler
@ 2012-08-06 8:23 ` Jack Kelly
2012-08-06 10:33 ` Andreas Röhler
2012-08-06 15:55 ` Doug Lewan
0 siblings, 2 replies; 10+ messages in thread
From: Jack Kelly @ 2012-08-06 8:23 UTC (permalink / raw)
To: Andreas Röhler; +Cc: help-gnu-emacs
On Mon, Aug 6, 2012 at 3:25 PM, Andreas Röhler
<andreas.roehler@easy-emacs.de> wrote:
> Am 06.08.2012 00:02, schrieb Jack Kelly:
>
> $EMACS -Q --batch --eval "(load \"MY-FILE\" nil t)"
This is quiet and simple, but is it safe to invoke the byte-compiler
with -Q? I worry that in some cases, a required package might not be
loaded if -Q is used. The byte-compile could then fail if (require
'foo) in the compiled file fails. Or am I wrong?
-- Jack
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Silently loading site files in -batch mode
2012-08-06 8:23 ` Jack Kelly
@ 2012-08-06 10:33 ` Andreas Röhler
2012-08-06 15:55 ` Doug Lewan
1 sibling, 0 replies; 10+ messages in thread
From: Andreas Röhler @ 2012-08-06 10:33 UTC (permalink / raw)
To: Jack Kelly; +Cc: help-gnu-emacs
Am 06.08.2012 10:23, schrieb Jack Kelly:
> On Mon, Aug 6, 2012 at 3:25 PM, Andreas Röhler
> <andreas.roehler@easy-emacs.de> wrote:
>> Am 06.08.2012 00:02, schrieb Jack Kelly:
>>
>> $EMACS -Q --batch --eval "(load \"MY-FILE\" nil t)"
>
> This is quiet and simple, but is it safe to invoke the byte-compiler
> with -Q? I worry that in some cases, a required package might not be
> loaded if -Q is used.
You are right. OTOH, when compiling a certain stuff, you might not need all loads from init.
The byte-compile could then fail if (require
> 'foo) in the compiled file fails. Or am I wrong?
that depends IMO if the path-TO-FOO is known here already.
BTW if interested, maybe have a look at my use-case
http://bazaar.launchpad.net/~a-roehler/python-mode/components-python-mode/view/head:/test/python-mode-tests.sh
not saying it's perfect :)
>
> -- Jack
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Silently loading site files in -batch mode
2012-08-06 8:23 ` Jack Kelly
2012-08-06 10:33 ` Andreas Röhler
@ 2012-08-06 15:55 ` Doug Lewan
2012-08-06 23:17 ` Jack Kelly
1 sibling, 1 reply; 10+ messages in thread
From: Doug Lewan @ 2012-08-06 15:55 UTC (permalink / raw)
To: Jack Kelly; +Cc: help-gnu-emacs@gnu.org
Everything that you (require) will be loaded -- even with -Q.
If there's something that's not, then that's a bug in the code that needs it.
,Doug
> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of Jack Kelly
> Sent: Monday, 2012 August 06 04:24
> To: Andreas Röhler
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Silently loading site files in -batch mode
>
> On Mon, Aug 6, 2012 at 3:25 PM, Andreas Röhler
> <andreas.roehler@easy-emacs.de> wrote:
> > Am 06.08.2012 00:02, schrieb Jack Kelly:
> >
> > $EMACS -Q --batch --eval "(load \"MY-FILE\" nil t)"
>
> This is quiet and simple, but is it safe to invoke the byte-compiler
> with -Q? I worry that in some cases, a required package might not be
> loaded if -Q is used. The byte-compile could then fail if (require
> 'foo) in the compiled file fails. Or am I wrong?
>
> -- Jack
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Silently loading site files in -batch mode
2012-08-06 15:55 ` Doug Lewan
@ 2012-08-06 23:17 ` Jack Kelly
2012-08-07 3:38 ` PJ Weisberg
0 siblings, 1 reply; 10+ messages in thread
From: Jack Kelly @ 2012-08-06 23:17 UTC (permalink / raw)
To: Doug Lewan; +Cc: help-gnu-emacs@gnu.org
Doug,
I agree with you, however debian's modifications to how emacs starts
up means that there's some potential additions to the load-path that
come from files similar to /etc/emacs/site-start.d/50autoconf.el .
Not running the call to debian-startup appears to mean that the
following could happen:
1. package foo is being compiled.
2. foo.el contains (require 'bar), installed by apt.
3. emacs is invoked with -Q, so the directory containing bar.el or
bar.elc is not in the load-path.
4. boom.
-- Jack
On Tue, Aug 7, 2012 at 1:55 AM, Doug Lewan <dougl@shubertticketing.com> wrote:
> Everything that you (require) will be loaded -- even with -Q.
>
> If there's something that's not, then that's a bug in the code that needs it.
>
> ,Doug
>
>> -----Original Message-----
>> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
>> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
>> Behalf Of Jack Kelly
>> Sent: Monday, 2012 August 06 04:24
>> To: Andreas Röhler
>> Cc: help-gnu-emacs@gnu.org
>> Subject: Re: Silently loading site files in -batch mode
>>
>> On Mon, Aug 6, 2012 at 3:25 PM, Andreas Röhler
>> <andreas.roehler@easy-emacs.de> wrote:
>> > Am 06.08.2012 00:02, schrieb Jack Kelly:
>> >
>> > $EMACS -Q --batch --eval "(load \"MY-FILE\" nil t)"
>>
>> This is quiet and simple, but is it safe to invoke the byte-compiler
>> with -Q? I worry that in some cases, a required package might not be
>> loaded if -Q is used. The byte-compile could then fail if (require
>> 'foo) in the compiled file fails. Or am I wrong?
>>
>> -- Jack
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Silently loading site files in -batch mode
2012-08-06 23:17 ` Jack Kelly
@ 2012-08-07 3:38 ` PJ Weisberg
2012-08-07 3:57 ` Jack Kelly
0 siblings, 1 reply; 10+ messages in thread
From: PJ Weisberg @ 2012-08-07 3:38 UTC (permalink / raw)
To: Jack Kelly; +Cc: help-gnu-emacs@gnu.org
On Mon, Aug 6, 2012 at 4:17 PM, Jack Kelly <jack@jackkelly.name> wrote:
> Doug,
>
> I agree with you, however debian's modifications to how emacs starts
> up means that there's some potential additions to the load-path that
> come from files similar to /etc/emacs/site-start.d/50autoconf.el .
>
> Not running the call to debian-startup appears to mean that the
> following could happen:
>
> 1. package foo is being compiled.
> 2. foo.el contains (require 'bar), installed by apt.
> 3. emacs is invoked with -Q, so the directory containing bar.el or
> bar.elc is not in the load-path.
> 4. boom.
$EMACS -Q --batch --eval "(push \"/path/to/bar\" load-path)" --eval
"(load \"MY-FILE\" nil t)"
-PJ
Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Silently loading site files in -batch mode
2012-08-07 3:38 ` PJ Weisberg
@ 2012-08-07 3:57 ` Jack Kelly
2012-08-07 4:49 ` PJ Weisberg
0 siblings, 1 reply; 10+ messages in thread
From: Jack Kelly @ 2012-08-07 3:57 UTC (permalink / raw)
To: PJ Weisberg; +Cc: help-gnu-emacs@gnu.org
On Tue, Aug 7, 2012 at 1:38 PM, PJ Weisberg <pj@irregularexpressions.net> wrote:
> On Mon, Aug 6, 2012 at 4:17 PM, Jack Kelly <jack@jackkelly.name> wrote:
>> Not running the call to debian-startup appears to mean that the
>> following could happen:
>>
>> 1. package foo is being compiled.
>> 2. foo.el contains (require 'bar), installed by apt.
>> 3. emacs is invoked with -Q, so the directory containing bar.el or
>> bar.elc is not in the load-path.
>> 4. boom.
>
> $EMACS -Q --batch --eval "(push \"/path/to/bar\" load-path)" --eval
> "(load \"MY-FILE\" nil t)"
Indeed. But now we've come full circle: I can either get quiet
loading, or I have to replicate debian's weird startup changes, but I
can't easily get a change in before startup.el and get both.
Thanks for the advice Andreas, Doug and PJ, but it's really starting
to look I can't easily make emacs do what I want.
-- Jack
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Silently loading site files in -batch mode
2012-08-07 3:57 ` Jack Kelly
@ 2012-08-07 4:49 ` PJ Weisberg
2012-08-07 5:05 ` Jack Kelly
0 siblings, 1 reply; 10+ messages in thread
From: PJ Weisberg @ 2012-08-07 4:49 UTC (permalink / raw)
To: Jack Kelly; +Cc: help-gnu-emacs@gnu.org
On Mon, Aug 6, 2012 at 8:57 PM, Jack Kelly <jack@jackkelly.name> wrote:
> On Tue, Aug 7, 2012 at 1:38 PM, PJ Weisberg <pj@irregularexpressions.net> wrote:
>> On Mon, Aug 6, 2012 at 4:17 PM, Jack Kelly <jack@jackkelly.name> wrote:
>>> Not running the call to debian-startup appears to mean that the
>>> following could happen:
>>>
>>> 1. package foo is being compiled.
>>> 2. foo.el contains (require 'bar), installed by apt.
>>> 3. emacs is invoked with -Q, so the directory containing bar.el or
>>> bar.elc is not in the load-path.
>>> 4. boom.
>>
>> $EMACS -Q --batch --eval "(push \"/path/to/bar\" load-path)" --eval
>> "(load \"MY-FILE\" nil t)"
>
> Indeed. But now we've come full circle: I can either get quiet
> loading, or I have to replicate debian's weird startup changes, but I
> can't easily get a change in before startup.el and get both.
Which of Debian's weird startup changes does your code actually depend
on? Are you sure you aren't just trying to anticipate a problem that
doesn't actually exist?
-PJ
Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Silently loading site files in -batch mode
2012-08-07 4:49 ` PJ Weisberg
@ 2012-08-07 5:05 ` Jack Kelly
0 siblings, 0 replies; 10+ messages in thread
From: Jack Kelly @ 2012-08-07 5:05 UTC (permalink / raw)
To: PJ Weisberg; +Cc: help-gnu-emacs@gnu.org
On Tue, Aug 7, 2012 at 2:49 PM, PJ Weisberg <pj@irregularexpressions.net> wrote:
> On Mon, Aug 6, 2012 at 8:57 PM, Jack Kelly <jack@jackkelly.name> wrote:
>> On Tue, Aug 7, 2012 at 1:38 PM, PJ Weisberg <pj@irregularexpressions.net> wrote:
>>> On Mon, Aug 6, 2012 at 4:17 PM, Jack Kelly <jack@jackkelly.name> wrote:
>>>> Not running the call to debian-startup appears to mean that the
>>>> following could happen:
>>>>
>>>> 1. package foo is being compiled.
>>>> 2. foo.el contains (require 'bar), installed by apt.
>>>> 3. emacs is invoked with -Q, so the directory containing bar.el or
>>>> bar.elc is not in the load-path.
>>>> 4. boom.
>>>
>>> $EMACS -Q --batch --eval "(push \"/path/to/bar\" load-path)" --eval
>>> "(load \"MY-FILE\" nil t)"
>>
>> Indeed. But now we've come full circle: I can either get quiet
>> loading, or I have to replicate debian's weird startup changes, but I
>> can't easily get a change in before startup.el and get both.
>
> Which of Debian's weird startup changes does your code actually depend
> on? Are you sure you aren't just trying to anticipate a problem that
> doesn't actually exist?
I am writing this as part of automake's elisp compilation refactoring
that's going on at the moment:
http://lists.gnu.org/archive/html/automake-patches/2012-07/msg00147.html
is the start of the relevant thread.
In an ideal world, we'd silence the loading messages to get proper
silent-rules support (like how compiling C code these days just prints
'CC foo.c' or whatever, unless there are errors or warnings). Because
the current elisp support calls emacs with -q, I'm hesitant to move to
-Q in case it causes breakage in obscure cases.
-- Jack
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-08-07 5:05 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-05 22:02 Silently loading site files in -batch mode Jack Kelly
2012-08-06 5:25 ` Andreas Röhler
2012-08-06 8:23 ` Jack Kelly
2012-08-06 10:33 ` Andreas Röhler
2012-08-06 15:55 ` Doug Lewan
2012-08-06 23:17 ` Jack Kelly
2012-08-07 3:38 ` PJ Weisberg
2012-08-07 3:57 ` Jack Kelly
2012-08-07 4:49 ` PJ Weisberg
2012-08-07 5:05 ` Jack Kelly
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).