all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* batch mode
@ 2008-03-02 18:50 Sebastian Tennant
  2008-03-02 22:22 ` Peter Dyballa
  0 siblings, 1 reply; 28+ messages in thread
From: Sebastian Tennant @ 2008-03-02 18:50 UTC (permalink / raw)
  To: help-gnu-emacs

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





^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: batch mode
  2008-03-02 18:50 batch mode Sebastian Tennant
@ 2008-03-02 22:22 ` Peter Dyballa
  0 siblings, 0 replies; 28+ messages in thread
From: Peter Dyballa @ 2008-03-02 22:22 UTC (permalink / raw)
  To: Sebastian Tennant; +Cc: help-gnu-emacs


Am 02.03.2008 um 19:50 schrieb Sebastian Tennant:

> 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?


Do you that in shell it's possible unite stderr and stdout?

--
Greetings

   Pete

There is no national science just as there is no national  
multiplication table; what is national is no longer science.
				– Anton Checov







^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: batch mode
       [not found] <mailman.8180.1204483870.18990.help-gnu-emacs@gnu.org>
@ 2008-03-03  0:34 ` Pascal Bourguignon
  2008-03-03  9:36   ` Sebastian Tennant
       [not found]   ` <mailman.8214.1204537035.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 28+ messages in thread
From: Pascal Bourguignon @ 2008-03-03  0:34 UTC (permalink / raw)
  To: help-gnu-emacs

Sebastian Tennant <sebyte@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.


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: batch mode
  2008-03-03  0:34 ` batch mode Pascal Bourguignon
@ 2008-03-03  9:36   ` Sebastian Tennant
       [not found]   ` <mailman.8214.1204537035.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 28+ messages in thread
From: Sebastian Tennant @ 2008-03-03  9:36 UTC (permalink / raw)
  To: help-gnu-emacs

Quoth Pascal Bourguignon <pjb@informatimago.com>:
> Sebastian Tennant <sebyte@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





^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: batch mode
       [not found]   ` <mailman.8214.1204537035.18990.help-gnu-emacs@gnu.org>
@ 2008-03-11 21:18     ` Brendan Halpin
  2008-03-12 14:50       ` Suppressing load messages (was: batch mode) Joel J. Adamson
       [not found]       ` <mailman.8762.1205333492.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 28+ messages in thread
From: Brendan Halpin @ 2008-03-11 21:18 UTC (permalink / raw)
  To: help-gnu-emacs

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")
-------------------------------------------------------------------

generates the following output:
-------------------------------------------------------------------
brendan@annacotty:/tmp$ ./hw.el 
Loading 00debian-vars...
Loading /etc/emacs-snapshot/site-start.d/50auctex.el (source)...
Loading /usr/share/emacs/23.0.50/site-lisp/auctex.el (source)...
Loading /usr/share/emacs/23.0.50/site-lisp/preview-latex.el (source)...
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Skipping dictionaries-common setup for emacs-snapshot
Loading /etc/emacs/site-start.d/50gcl.el (source)...
Loading /etc/emacs/site-start.d/50slime.el (source)...
Loading /usr/share/emacs-snapshot/site-lisp/slime/slime-autoloads...
Hello World!
-------------------------------------------------------------------

Adding options like -q and --no-site-file to the bang line don't seem to
have any effect, and this makes Emacs unattractive for small scripts. 

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


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Suppressing load messages (was: batch mode)
  2008-03-11 21:18     ` Brendan Halpin
@ 2008-03-12 14:50       ` Joel J. Adamson
       [not found]       ` <mailman.8762.1205333492.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 28+ messages in thread
From: Joel J. Adamson @ 2008-03-12 14:50 UTC (permalink / raw)
  To: brendan.halpin; +Cc: help-gnu-emacs

Brendan Halpin <brendan.halpin@ul.ie> 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 --script
> (princ "Hello World!\n")
> -------------------------------------------------------------------
>
> generates the following output:
> -------------------------------------------------------------------
> brendan@annacotty:/tmp$ ./hw.el 
> Loading 00debian-vars...
> Loading /etc/emacs-snapshot/site-start.d/50auctex.el (source)...
> Loading /usr/share/emacs/23.0.50/site-lisp/auctex.el (source)...
> Loading /usr/share/emacs/23.0.50/site-lisp/preview-latex.el (source)...
> Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
> Skipping dictionaries-common setup for emacs-snapshot
> Loading /etc/emacs/site-start.d/50gcl.el (source)...
> Loading /etc/emacs/site-start.d/50slime.el (source)...
> Loading /usr/share/emacs-snapshot/site-lisp/slime/slime-autoloads...

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</dev/null"
,----
| 
| /home/joel/lisp/el: ZShell> cat hello.el
| #!/usr/bin/emacs --script
| (message "this is garbage!\n")
| (princ "Hello, Is it me you're looking for?\n")
| 
| /home/joel/lisp/el: ZShell> ./hello.el 
| this is garbage!
| 
| Hello, Is it me you're looking for?
| /home/joel/lisp/el: ZShell> ./hello.el 2</dev/null
| Hello, Is it me you're looking for?
`----

There ya go.

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?

> Adding options like -q and --no-site-file to the bang line don't seem to
> have any effect, and this makes Emacs unattractive for small scripts. 

Only if all you want is STDOUT.  If you want to use 'emacs --script' for
non-interactive editing a la sed and awk, then it's perfect: load those
files into buffers, edit them and save them.

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.







^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
       [not found]       ` <mailman.8762.1205333492.18990.help-gnu-emacs@gnu.org>
@ 2008-03-12 15:31         ` Brendan Halpin
  2008-03-12 15:58           ` Lennart Borgman (gmail)
                             ` (3 more replies)
  0 siblings, 4 replies; 28+ messages in thread
From: Brendan Halpin @ 2008-03-12 15:31 UTC (permalink / raw)
  To: help-gnu-emacs

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</dev/null"

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


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 15:31         ` Suppressing load messages Brendan Halpin
@ 2008-03-12 15:58           ` Lennart Borgman (gmail)
  2008-03-12 16:59           ` Joel J. Adamson
                             ` (2 subsequent siblings)
  3 siblings, 0 replies; 28+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-12 15:58 UTC (permalink / raw)
  To: brendan.halpin; +Cc: help-gnu-emacs

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!




^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 15:31         ` Suppressing load messages Brendan Halpin
  2008-03-12 15:58           ` Lennart Borgman (gmail)
@ 2008-03-12 16:59           ` Joel J. Adamson
       [not found]           ` <mailman.8775.1205341175.18990.help-gnu-emacs@gnu.org>
       [not found]           ` <mailman.8771.1205337534.18990.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 28+ messages in thread
From: Joel J. Adamson @ 2008-03-12 16:59 UTC (permalink / raw)
  To: brendan.halpin; +Cc: help-gnu-emacs

Brendan Halpin <brendan.halpin@ul.ie> 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</dev/null"
>
> 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. 

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.

Like I said if you want to edit files in place, you just open them, edit
them and save them, and STDOUT is incidental; in fact, all you'll get is
STDERR unless your functions have side-effects that call princ.

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.







^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
       [not found]           ` <mailman.8775.1205341175.18990.help-gnu-emacs@gnu.org>
@ 2008-03-12 17:30             ` Brendan Halpin
  2008-03-12 17:56               ` Lennart Borgman (gmail)
                                 ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Brendan Halpin @ 2008-03-12 17:30 UTC (permalink / raw)
  To: help-gnu-emacs

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).

It should be acceptable to writers of emacs-script utilities to
explicitly load anything that is needed.

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


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
       [not found]           ` <mailman.8771.1205337534.18990.help-gnu-emacs@gnu.org>
@ 2008-03-12 17:53             ` Brendan Halpin
  2008-03-12 18:03               ` Exal de Jesus Garcia Carrillo
                                 ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Brendan Halpin @ 2008-03-12 17:53 UTC (permalink / raw)
  To: help-gnu-emacs

"Lennart Borgman (gmail)" <lennart.borgman@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:/tmp$ ./hw.el 
|Loading 00debian-vars...
|Loading /etc/emacs/site-start.d/50a2ps.el (source)...
|Loading a2ps-print...
|Loading /etc/emacs-snapshot/site-start.d/50auctex.el (source)...
|Loading /usr/share/emacs/23.0.50/site-lisp/auctex.el (source)...
|Loading /usr/share/emacs/23.0.50/site-lisp/preview-latex.el (source)...
|Loading /etc/emacs/site-start.d/50css-mode.el (source)...
|Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
|Skipping dictionaries-common setup for emacs-snapshot
|Loading /etc/emacs/site-start.d/50emacs-goodies-el.el (source)...
|Loading /etc/emacs/site-start.d/50html-helper-mode.el (source)...
|Loading /etc/emacs/site-start.d/50slime.el (source)...
|Loading /usr/share/emacs-snapshot/site-lisp/slime/slime-autoloads...
|Hello!
|brendan@wivenhoe:/tmp$ 
+-------------------------------------------------------------------

As you can see, while I do get the output, it also loads a lot of
irrelevant files and generates lots of output to stderr.

The -Q, -batch and -no-site-file arguments aren't accepted on the 
"#! /usr/bin/emacs --script" line. 

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


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 17:30             ` Brendan Halpin
@ 2008-03-12 17:56               ` Lennart Borgman (gmail)
  2008-03-12 18:52               ` Joel J. Adamson
       [not found]               ` <mailman.8782.1205347999.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 28+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-12 17:56 UTC (permalink / raw)
  To: brendan.halpin; +Cc: help-gnu-emacs

> It should be acceptable to writers of emacs-script utilities to
> explicitly load anything that is needed.


It looks like you get a load message if you use load-library, but not if 
you use require:

;; Use this with
;;   emacs -Q -batch -l hello.el
;; to test for load output messages
(unless (featurep 'ido)
   (message "* ido not loaded, will do (require 'ido) now:")
   (require 'ido))
(unless (featurep 'cua-base)
   (message "* cua-base not loaded, will do (load-library \"cua-base\") 
now:")
   (load-library "cua-base"))
(message "\nHello World!")




^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 17:53             ` Brendan Halpin
@ 2008-03-12 18:03               ` Exal de Jesus Garcia Carrillo
  2008-03-12 18:35                 ` Brendan Halpin
  2008-03-12 22:03               ` Lennart Borgman (gmail)
  2008-03-12 23:32               ` Glenn Morris
  2 siblings, 1 reply; 28+ messages in thread
From: Exal de Jesus Garcia Carrillo @ 2008-03-12 18:03 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brendan Halpin em gnu.emacs.help escreveu:

> 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:/tmp$ ./hw.el 
> |Loading 00debian-vars...
> |Loading /etc/emacs/site-start.d/50a2ps.el (source)...
<snip>



mmm, what emacs version are you running, I get this output:

,----
| exal@frida:~$ cat hello.el 
| #!/home/exal/repos/emacs/src/emacs --script
| (message "Hello world")
| exal@frida:~$ ./hello.el 
| Hello world
| exal@frida:~$
`----


- -- 
Spam protection: 
In my e-mail replace the words `no-spam' with `exal'.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>

iD8DBQFH2Bo2oZmxoVJRtGIRAv4MAKCWGgkxjAawncf2er85j3Ima+KtTQCgg/rF
6uP0HZBymwyPnPMJRyfkU1w=
=dYu3
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 18:03               ` Exal de Jesus Garcia Carrillo
@ 2008-03-12 18:35                 ` Brendan Halpin
  2008-03-12 18:47                   ` Exal de Jesus Garcia Carrillo
  0 siblings, 1 reply; 28+ messages in thread
From: Brendan Halpin @ 2008-03-12 18:35 UTC (permalink / raw)
  To: help-gnu-emacs

Exal de Jesus Garcia Carrillo <no-spam@gnu.org> writes:

> mmm, what emacs version are you running, I get this output:
>
> ,----
> | exal@frida:~$ cat hello.el 
> | #!/home/exal/repos/emacs/src/emacs --script
> | (message "Hello world")
> | exal@frida:~$ ./hello.el 
> | Hello world
> | exal@frida:~$
> `----
M-x emacs-version gives: 
GNU Emacs 23.0.50.1 (i486-pc-linux-gnu, GTK+ Version 2.12.2)
 of 2007-12-02 on elegiac, modified by Debian

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


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 18:35                 ` Brendan Halpin
@ 2008-03-12 18:47                   ` Exal de Jesus Garcia Carrillo
  0 siblings, 0 replies; 28+ messages in thread
From: Exal de Jesus Garcia Carrillo @ 2008-03-12 18:47 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brendan Halpin em gnu.emacs.help escreveu:

> Exal de Jesus Garcia Carrillo <no-spam@gnu.org> writes:
>
>> mmm, what emacs version are you running, I get this output:
>>
>> ,----
>> | exal@frida:~$ cat hello.el 
>> | #!/home/exal/repos/emacs/src/emacs --script
>> | (message "Hello world")
>> | exal@frida:~$ ./hello.el 
>> | Hello world
>> | exal@frida:~$
>> `----
> M-x emacs-version gives: 
> GNU Emacs 23.0.50.1 (i486-pc-linux-gnu, GTK+ Version 2.12.2)
>  of 2007-12-02 on elegiac, modified by Debian



I'm thinking is for the emacs version, I have 
"GNU Emacs 23.0.60.2 (powerpc-unknown-linux-gnu, GTK+ Version 2.10.11) 
of 2008-02-22 on frida"

I ran the same hello.el script with emacs22 and get this:


,----[ emacs22 output ]
| exal@frida:~$ cat hello.el 
| #!/usr/bin/emacs --script
| (message "Hello world")
| exal@frida:~$ ./hello.el 
| Loading 00debian-vars...
| Loading /etc/emacs/site-start.d/50autoconf.el (source)...
| Loading /etc/emacs/site-start.d/50bbdb.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/50dictionary-el.el (source)...
| Loading dictionary-init...
| Loading /etc/emacs/site-start.d/50erc.el (source)...
| Loading erc-auto...
| Loading /etc/emacs/site-start.d/50festival.el (source)...
| Loading /etc/emacs/site-start.d/50psvn.el (source)...
| Loading /etc/emacs/site-start.d/50slime.el (source)...
| Hello world
| exal@frida:~$ 
`----

- -- 
Spam protection: 
In my e-mail replace the words `no-spam' with `exal'.


.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>

iD8DBQFH2CVdoZmxoVJRtGIRApXUAJ9RppDJ0hrEb5dLcqVPJboKsqr7xACfR09t
9C1H1maF+nc0ojmaMRVBurA=
=A7PP
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 17:30             ` Brendan Halpin
  2008-03-12 17:56               ` Lennart Borgman (gmail)
@ 2008-03-12 18:52               ` Joel J. Adamson
       [not found]               ` <mailman.8782.1205347999.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 28+ messages in thread
From: Joel J. Adamson @ 2008-03-12 18:52 UTC (permalink / raw)
  To: brendan.halpin; +Cc: help-gnu-emacs

Brendan Halpin <brendan.halpin@ul.ie> writes:
> but it is clearly inappropriate to load lots of irrelevant files

Yes, they looked like the sort of thing that you should load yourself.
They won't load if you put them in .emacs.  If this is your system, then
I suggest you get that stuff out of site-start.el: why use what the
Debian project put there? ;) If it's not your system, then I suggest you
tell a sysadmin that site-start.el contains a lot of stuff that ought to
be left up to the user.  However, he might get a lot of requests for
those packages...

If you want behavior like Perl or Python (output to STDOUT), then you
should figure out a way to divert STDERR from inside Emacs.  I tried 

(setq shell-command-default-error-buffer "*stderr*")

but that doesn't affect batch mode.

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.







^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 17:53             ` Brendan Halpin
  2008-03-12 18:03               ` Exal de Jesus Garcia Carrillo
@ 2008-03-12 22:03               ` Lennart Borgman (gmail)
  2008-03-12 23:32               ` Glenn Morris
  2 siblings, 0 replies; 28+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-12 22:03 UTC (permalink / raw)
  To: brendan.halpin; +Cc: help-gnu-emacs

Brendan Halpin wrote:
> The -Q, -batch and -no-site-file arguments aren't accepted on the 
> "#! /usr/bin/emacs --script" line. 

That looks like a bug to me. Could you please report it as a bug?




^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
       [not found]               ` <mailman.8782.1205347999.18990.help-gnu-emacs@gnu.org>
@ 2008-03-12 22:35                 ` Brendan Halpin
  2008-03-13 16:04                   ` Joel J. Adamson
       [not found]                   ` <mailman.8845.1205424297.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 28+ messages in thread
From: Brendan Halpin @ 2008-03-12 22:35 UTC (permalink / raw)
  To: help-gnu-emacs

jadamson@partners.org (Joel J. Adamson) writes:

> If you want behavior like Perl or Python (output to STDOUT), then you
> should figure out a way to divert STDERR from inside Emacs.  I tried 

That's not necessary, since the print family of commands will write to
STDOUT, and it is useful to be able to use message to write to STDERR. 

I think the general problem is that the script facility promotes uses of
Emacs not expected by package writers (and Debian package maintainers). 

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


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 17:53             ` Brendan Halpin
  2008-03-12 18:03               ` Exal de Jesus Garcia Carrillo
  2008-03-12 22:03               ` Lennart Borgman (gmail)
@ 2008-03-12 23:32               ` Glenn Morris
  2008-03-12 23:37                 ` Glenn Morris
                                   ` (3 more replies)
  2 siblings, 4 replies; 28+ messages in thread
From: Glenn Morris @ 2008-03-12 23:32 UTC (permalink / raw)
  To: help-gnu-emacs

Brendan Halpin wrote:

> The -Q, -batch and -no-site-file arguments aren't accepted on the 
> "#! /usr/bin/emacs --script" line. 

That's an execve issue - you can only have a single argument after the
interpreter on any #! line.

You could always do something like:

#!/bin/sh

/usr/bin/emacs -Q --script <<EOF
...stuff...
EOF


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 23:32               ` Glenn Morris
@ 2008-03-12 23:37                 ` Glenn Morris
  2008-03-13  3:09                   ` Glenn Morris
  2008-03-13  1:31                 ` Lennart Borgman (gmail)
                                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 28+ messages in thread
From: Glenn Morris @ 2008-03-12 23:37 UTC (permalink / raw)
  To: help-gnu-emacs

Glenn Morris wrote:

> /usr/bin/emacs -Q --script <<EOF
> ...stuff...
> EOF

Bah; ignore that (was untested).


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 23:32               ` Glenn Morris
  2008-03-12 23:37                 ` Glenn Morris
@ 2008-03-13  1:31                 ` Lennart Borgman (gmail)
  2008-03-13  3:42                 ` Giorgos Keramidas
       [not found]                 ` <mailman.8816.1205371922.18990.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 28+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-13  1:31 UTC (permalink / raw)
  To: Glenn Morris, Emacs Devel; +Cc: help-gnu-emacs

Glenn Morris wrote:
> Brendan Halpin wrote:
> 
>> The -Q, -batch and -no-site-file arguments aren't accepted on the 
>> "#! /usr/bin/emacs --script" line. 
> 
> That's an execve issue - you can only have a single argument after the
> interpreter on any #! line.

In that case should not --script imply -Q?





^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 23:37                 ` Glenn Morris
@ 2008-03-13  3:09                   ` Glenn Morris
  0 siblings, 0 replies; 28+ messages in thread
From: Glenn Morris @ 2008-03-13  3:09 UTC (permalink / raw)
  To: help-gnu-emacs

Glenn Morris wrote:

> Glenn Morris wrote:
>
>> /usr/bin/emacs -Q --script <<EOF
>> ...stuff...
>> EOF
>
> Bah; ignore that (was untested).


What will actually work is something like the following. Note you have
to use `-script' not `--script', in all but the very latest CVS, due to a bug.

#!/bin/sh

cat >| foo <<EOF
(message "hi")
EOF

emacs --no-site-file -script foo


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 23:32               ` Glenn Morris
  2008-03-12 23:37                 ` Glenn Morris
  2008-03-13  1:31                 ` Lennart Borgman (gmail)
@ 2008-03-13  3:42                 ` Giorgos Keramidas
  2008-03-31  2:34                   ` David Combs
       [not found]                 ` <mailman.8816.1205371922.18990.help-gnu-emacs@gnu.org>
  3 siblings, 1 reply; 28+ messages in thread
From: Giorgos Keramidas @ 2008-03-13  3:42 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 12 Mar 2008 16:32:36 -0700, Glenn Morris <rgm+news@stanford.edu> wrote:
> Brendan Halpin wrote:
>
>> The -Q, -batch and -no-site-file arguments aren't accepted on the
>> "#! /usr/bin/emacs --script" line.
>
> That's an execve issue - you can only have a single argument after the
> interpreter on any #! line.

Exactly!

> You could always do something like:
>
> #!/bin/sh
>
> /usr/bin/emacs -Q --script <<EOF
> ...stuff...
> EOF

This lets the shell interpret the Emacs script source.

The following prints nothing here for me:

  #!/bin/sh

  emacs -Q -batch -l /dev/stdin <<EOF
  (let ((var-list (list 'foo$HOME 'bar$LOGNAME)))
    (dolist (var var-list)
      (message "Hello %s" var)))
  EOF

I ended up writing a short shell wrapper, called `emacs-script', like
the following:

    #!/bin/sh
    exec emacs -Q -batch -l "$@"

This lets me write scripts in Elisp by using:

  #!/usr/bin/env emacs-script

  (let ((var-list (list 'foo$HOME 'bar$LOGNAME)))
    (dolist (var var-list)
      (message "Hello %s" var)))

which correctly prints:

  $ ./hw.el
  Hello foo$HOME
  Hello bar$LOGNAME
  $

HTH,
Giorgos



^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
       [not found]                 ` <mailman.8816.1205371922.18990.help-gnu-emacs@gnu.org>
@ 2008-03-13  9:00                   ` Brendan Halpin
  0 siblings, 0 replies; 28+ messages in thread
From: Brendan Halpin @ 2008-03-13  9:00 UTC (permalink / raw)
  To: help-gnu-emacs

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> Glenn Morris wrote:
>> Brendan Halpin wrote:
>>
>>> The -Q, -batch and -no-site-file arguments aren't accepted on
>>> the "#! /usr/bin/emacs --script" line. 
>>
>> That's an execve issue - you can only have a single argument after the
>> interpreter on any #! line.
>
> In that case should not --script imply -Q?

That's what I would have thought (to avoid loading packages only
relevant when interactive), but with the proviso that there needs to be
a way to pick up details of a non-standard installation.

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


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-12 22:35                 ` Brendan Halpin
@ 2008-03-13 16:04                   ` Joel J. Adamson
       [not found]                   ` <mailman.8845.1205424297.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 28+ messages in thread
From: Joel J. Adamson @ 2008-03-13 16:04 UTC (permalink / raw)
  To: brendan.halpin; +Cc: help-gnu-emacs

Brendan Halpin <brendan.halpin@ul.ie> writes:

> jadamson@partners.org (Joel J. Adamson) writes:
>
>> If you want behavior like Perl or Python (output to STDOUT), then you
>> should figure out a way to divert STDERR from inside Emacs.  I tried 
>
> That's not necessary, since the print family of commands will write to
> STDOUT, and it is useful to be able to use message to write to STDERR. 

Huh?  Then what do you want?  Do you want to see only STDOUT on the
screen?  Do you want to capture it in a file?

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.







^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
       [not found]                   ` <mailman.8845.1205424297.18990.help-gnu-emacs@gnu.org>
@ 2008-03-13 16:54                     ` Brendan Halpin
  2008-03-13 18:01                       ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 28+ messages in thread
From: Brendan Halpin @ 2008-03-13 16:54 UTC (permalink / raw)
  To: help-gnu-emacs

jadamson@partners.org (Joel J. Adamson) writes:

> Brendan Halpin <brendan.halpin@ul.ie> writes:
>
>> jadamson@partners.org (Joel J. Adamson) writes:
>>
>>> If you want behavior like Perl or Python (output to STDOUT), then you
>>> should figure out a way to divert STDERR from inside Emacs.  I tried 
>>
>> That's not necessary, since the print family of commands will write to
>> STDOUT, and it is useful to be able to use message to write to STDERR. 
>
> Huh?  Then what do you want?  Do you want to see only STDOUT on the
> screen?  Do you want to capture it in a file?

I think we're talking at cross purposes. What I'm moaning about is that
there is that even with "--script" there is a lot of unnecessary loading
going on, with the most visible effect of lots of chatter on STDERR.
Simply, that makes Emacs less useful for writing little self-executable
shell utilities. 

What would be nice would be to be able to write hash-bang utilities in
Emacs that behave like any other, with output going to STDOUT and
errors/warnings going to STDERR. We're not quite there yet but it
shouldn't be impossible. Maybe I should talk to the emacs-devel list.

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


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-13 16:54                     ` Brendan Halpin
@ 2008-03-13 18:01                       ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 28+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-13 18:01 UTC (permalink / raw)
  To: brendan.halpin; +Cc: help-gnu-emacs

Brendan Halpin wrote:
> jadamson@partners.org (Joel J. Adamson) writes:
> 
>> Brendan Halpin <brendan.halpin@ul.ie> writes:
>>
>>> jadamson@partners.org (Joel J. Adamson) writes:
>>>
>>>> If you want behavior like Perl or Python (output to STDOUT), then you
>>>> should figure out a way to divert STDERR from inside Emacs.  I tried 
>>> That's not necessary, since the print family of commands will write to
>>> STDOUT, and it is useful to be able to use message to write to STDERR. 
>> Huh?  Then what do you want?  Do you want to see only STDOUT on the
>> screen?  Do you want to capture it in a file?
> 
> I think we're talking at cross purposes. What I'm moaning about is that
> there is that even with "--script" there is a lot of unnecessary loading
> going on, with the most visible effect of lots of chatter on STDERR.
> Simply, that makes Emacs less useful for writing little self-executable
> shell utilities. 
> 
> What would be nice would be to be able to write hash-bang utilities in
> Emacs that behave like any other, with output going to STDOUT and
> errors/warnings going to STDERR. We're not quite there yet but it
> shouldn't be impossible. Maybe I should talk to the emacs-devel list.

Please do. I have already taken up this issue, but no one has answered yet.




^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Suppressing load messages
  2008-03-13  3:42                 ` Giorgos Keramidas
@ 2008-03-31  2:34                   ` David Combs
  0 siblings, 0 replies; 28+ messages in thread
From: David Combs @ 2008-03-31  2:34 UTC (permalink / raw)
  To: help-gnu-emacs

In article <87zlt39tnn.fsf@kobe.laptop>,
Giorgos Keramidas  <keramida@ceid.upatras.gr> wrote:
>On Wed, 12 Mar 2008 16:32:36 -0700, Glenn Morris <rgm+news@stanford.edu> wrote:
>> Brendan Halpin wrote:
>>
>>> The -Q, -batch and -no-site-file arguments aren't accepted on the
>>> "#! /usr/bin/emacs --script" line.
>>
>> That's an execve issue - you can only have a single argument after the
>> interpreter on any #! line.
>
>Exactly!
>
>> You could always do something like:
>>
>> #!/bin/sh
>>
>> /usr/bin/emacs -Q --script <<EOF
>> ...stuff...
>> EOF
>
>This lets the shell interpret the Emacs script source.
>
>The following prints nothing here for me:
>
>  #!/bin/sh
>
>  emacs -Q -batch -l /dev/stdin <<EOF
>  (let ((var-list (list 'foo$HOME 'bar$LOGNAME)))
>    (dolist (var var-list)
>      (message "Hello %s" var)))
>  EOF
>
>I ended up writing a short shell wrapper, called `emacs-script', like
>the following:
>
>    #!/bin/sh
>    exec emacs -Q -batch -l "$@"
>
>This lets me write scripts in Elisp by using:
>
>  #!/usr/bin/env emacs-script
>
>  (let ((var-list (list 'foo$HOME 'bar$LOGNAME)))
>    (dolist (var var-list)
>      (message "Hello %s" var)))
>
>which correctly prints:
>
>  $ ./hw.el
>  Hello foo$HOME
>  Hello bar$LOGNAME
>  $
>
>HTH,
>Giorgos
>



Looks clever, but I don't really understand it (yet).

Maybe you give a few more details about what you gain (apparantely
a lot) via the shell-wrapper?   Thanks!

Also, if a general technique is what it is, where else might you use
such a thing?


Thanks!

David




^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2008-03-31  2:34 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.8180.1204483870.18990.help-gnu-emacs@gnu.org>
2008-03-03  0:34 ` batch mode Pascal Bourguignon
2008-03-03  9:36   ` Sebastian Tennant
     [not found]   ` <mailman.8214.1204537035.18990.help-gnu-emacs@gnu.org>
2008-03-11 21:18     ` Brendan Halpin
2008-03-12 14:50       ` Suppressing load messages (was: batch mode) Joel J. Adamson
     [not found]       ` <mailman.8762.1205333492.18990.help-gnu-emacs@gnu.org>
2008-03-12 15:31         ` Suppressing load messages Brendan Halpin
2008-03-12 15:58           ` Lennart Borgman (gmail)
2008-03-12 16:59           ` Joel J. Adamson
     [not found]           ` <mailman.8775.1205341175.18990.help-gnu-emacs@gnu.org>
2008-03-12 17:30             ` Brendan Halpin
2008-03-12 17:56               ` Lennart Borgman (gmail)
2008-03-12 18:52               ` Joel J. Adamson
     [not found]               ` <mailman.8782.1205347999.18990.help-gnu-emacs@gnu.org>
2008-03-12 22:35                 ` Brendan Halpin
2008-03-13 16:04                   ` Joel J. Adamson
     [not found]                   ` <mailman.8845.1205424297.18990.help-gnu-emacs@gnu.org>
2008-03-13 16:54                     ` Brendan Halpin
2008-03-13 18:01                       ` Lennart Borgman (gmail)
     [not found]           ` <mailman.8771.1205337534.18990.help-gnu-emacs@gnu.org>
2008-03-12 17:53             ` Brendan Halpin
2008-03-12 18:03               ` Exal de Jesus Garcia Carrillo
2008-03-12 18:35                 ` Brendan Halpin
2008-03-12 18:47                   ` Exal de Jesus Garcia Carrillo
2008-03-12 22:03               ` Lennart Borgman (gmail)
2008-03-12 23:32               ` Glenn Morris
2008-03-12 23:37                 ` Glenn Morris
2008-03-13  3:09                   ` Glenn Morris
2008-03-13  1:31                 ` Lennart Borgman (gmail)
2008-03-13  3:42                 ` Giorgos Keramidas
2008-03-31  2:34                   ` David Combs
     [not found]                 ` <mailman.8816.1205371922.18990.help-gnu-emacs@gnu.org>
2008-03-13  9:00                   ` Brendan Halpin
2008-03-02 18:50 batch mode Sebastian Tennant
2008-03-02 22:22 ` Peter Dyballa

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.