|
|
Up |
|
|
  |
Author: Sebastian TennantSebastian 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 |
|
  |
Author: Pascal BourguignonPascal 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 |
|
  |
Author: Sebastian TennantSebastian 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 |
|
  |
Author: Brendan HalpinBrendan 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 |
|
  |
Author: Joel J. AdamsonJoel 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 |
|
  |
Author: Brendan HalpinBrendan Halpin Date: Mar 12, 2008 08:31
> 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
|
| |
| 1 Comment |
|
  |
Author: Lennart Borgman (gmail)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 |
|
  |
Author: Joel J. AdamsonJoel J. Adamson Date: Mar 12, 2008 09:59
Brendan Halpin 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 |
|
  |
Author: Brendan HalpinBrendan Halpin Date: Mar 12, 2008 10:30
> 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 |
|
  |
|
|
  |
Author: Brendan HalpinBrendan 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 |
  |
|
|
|
|
|