batch mode
  Home FAQ Contact Sign in
gnu.emacs.help only
 
Advanced search
POPULAR GROUPS

more...

gnu.emacs.help Profile…
 Up
batch mode         


Author: Sebastian Tennant
Date: Mar 2, 2008 10:50

Hi all,

By default Emacs in batch mode sends 'message's to stderr.

Is it possible to put a directive in the file loaded with the '-l'
switch, that tells Emacs to send 'message's to stdout instead?

Sebastian
26 Comments
Re: batch mode         


Author: Pascal Bourguignon
Date: Mar 2, 2008 16:34

Sebastian Tennant smolny.plus.com> writes:
> Hi all,
>
> By default Emacs in batch mode sends 'message's to stderr.
>
> Is it possible to put a directive in the file loaded with the '-l'
> switch, that tells Emacs to send 'message's to stdout instead?

Why use message if message doesn't do what you want? Use print!
(and princ, terpri, etc).

--
__Pascal Bourguignon__ http://www.informatimago.com/

READ THIS BEFORE OPENING PACKAGE: According to certain suggested
versions of the Grand Unified Theory, the primary particles
constituting this product may decay to nothingness within the next
four hundred million years.
no comments
Re: batch mode         


Author: Sebastian Tennant
Date: Mar 3, 2008 01:36

Quoth Pascal Bourguignon informatimago.com>:
> Sebastian Tennant smolny.plus.com> writes:
>
>> Hi all,
>>
>> By default Emacs in batch mode sends 'message's to stderr.
>>
>> Is it possible to put a directive in the file loaded with the '-l'
>> switch, that tells Emacs to send 'message's to stdout instead?
>
> Why use message if message doesn't do what you want? Use print!
> (and princ, terpri, etc).

It's not my code, and there are a lot of messages in there!

Peter, of course 2>&1 works in a shell, but my guile script calls emacs
directly to avoid the overhead of the shell.

It turns out, guile has good port redirection routines and I'm able to
route stderr programmatically within the script.

Thanks to you both.

Sebastian
no comments
Re: batch mode         


Author: Brendan Halpin
Date: Mar 11, 2008 14:18

Can I hijack the thread to ask if there is a way of suppressing the
"Loading" and related start-up messages when using the
#!/usr/bin/emacs --script
convention?

At present this:
-------------------------------------------------------------------
#!/usr/bin/emacs --script
(princ "Hello World!\n")
-------------------------------------------------------------------
Show full article (1.49Kb)
no comments
Suppressing load messages (was: batch mode)         


Author: Joel J. Adamson
Date: Mar 12, 2008 07:50

Brendan Halpin writes:
> Can I hijack the thread to ask if there is a way of suppressing the

No, you may not ;)
> "Loading" and related start-up messages when using the
> #!/usr/bin/emacs --script convention?
>
> At present this:
> -------------------------------------------------------------------
> #!/usr/bin/emacs...
Show full article (2.89Kb)
no comments
Re: Suppressing load messages         


Author: Brendan Halpin
Date: Mar 12, 2008 08:31

jadamson@partners.org (Joel J. Adamson) writes:
> This is all STDERR, i.e. the *Messages* buffer. If you redirect STDERR
> or STDOUT, you can suppress the messages, or capture the output in a file.
>
> For example, "hello 2

Yes, but that's not a solution so much as a workaround.
> The real question you should be asking is why emacs is loading all that
> crap when you're using the --script option. Who's in charge of your
> site-start.el?

Indeed. In practice Debian are in charge, but there's nothing to stop me
changing it -- now all I need is to know (i) how to tell at startup if emacs
is invoked with --script and (ii) how to interfere with the site-start.d
process.

Brendan
--
Brendan Halpin, Department of Sociology, University of Limerick, Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F2-025 x 3147
mailto:brendan.halpin@ul.ie http://www.ul.ie/sociology/brendan.halpin.html
1 Comment
Re: Suppressing load messages         


Author: Lennart Borgman (gmail)
Date: Mar 12, 2008 08:58

Brendan Halpin wrote:
> Indeed. In practice Debian are in charge, but there's nothing to stop me
> changing it -- now all I need is to know (i) how to tell at startup if emacs
> is invoked with --script and (ii) how to interfere with the site-start.d
> process.

Excuse me, I did not follow, but do you need to run site-start.el

I tested this:

C:\test>emacs -Q -batch -l hello.el
Hello World!
no comments
Re: Suppressing load messages         


Author: Joel J. Adamson
Date: Mar 12, 2008 09:59

Brendan Halpin writes:
> jadamson@partners.org (Joel J. Adamson) writes:
>
>> This is all STDERR, i.e. the *Messages* buffer. If you redirect STDERR
>> or STDOUT, you can suppress the messages, or capture the output in a file.
>>
>> For example, "hello 2
>
> Yes, but that's not a solution so much as a workaround.

Well if there can be no arrangement, then we are at an impasse.
>> The real question you should be asking is why emacs is loading all that
>> crap when you're using the --script option. Who's in charge of your
>> site-start.el?
>
> Indeed. In practice Debian are in charge, but there's nothing to stop me
> changing it -- now all I need is to know (i) how to tell at startup if emacs
> is invoked with --script and (ii) how to interfere with the site-start.d
> process.
Show full article (2.04Kb)
no comments
Re: Suppressing load messages         


Author: Brendan Halpin
Date: Mar 12, 2008 10:30

jadamson@partners.org (Joel J. Adamson) writes:
> By the above I mean that what you're suggesting sounds like a
> workaround, and my workaround sounds like a solution. Perhaps there's
> another way to redirect *Messages* from within Emacs.
>
> You can still redirect your output. If you don't want that, then
> perhaps you need to reconsider why you're using --script.

Indeed. All I want it to use Emacs as a scripting language to write
little utilities, and that they behave just like utilities written in
Perl or Python.

My thought processes were heading in the direction that the hash-bang
--script option is very new and not yet completely thought through, and
that a long-term solution might lie in hacking the start process.
Perhaps the start process should behave differently when invoked in with
--script. I suspect that completely ignoring the site-start structure
could be suboptimal (if there are site-wide settings that are
non-standard), but it is clearly inappropriate to load lots of
irrelevant files (and not just because of the chatter to STDERR).
Show full article (1.41Kb)
1 Comment
Re: Suppressing load messages         


Author: Brendan Halpin
Date: Mar 12, 2008 10:53

"Lennart Borgman (gmail)" gmail.com> writes:
> Excuse me, I did not follow, but do you need to run site-start.el
>
> I tested this:
>
> C:\test>emacs -Q -batch -l hello.el
> Hello World!

No, I'm talking about using it to write script files than be invoked
under the shell (bash etc.):

+-------------------------------------------------------------------
|brendan@wivenhoe:/tmp$ cat hw.el
|#! /usr/bin/emacs --script
|(princ "Hello!\n")
|brendan@wivenhoe:/tmp$ chmod +x hw.el
|brendan@wivenhoe...
Show full article (1.86Kb)
1 Comment

RELATED THREADS
SubjectArticles qty Group
Re: Computer Check Batch stuck in Batch Recovery Limbo!microsoft.public.greatplains ·
1 2 3