emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

--script


From: Brendan Halpin
Subject: --script
Date: Thu, 13 Mar 2008 21:35:49 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

I was pleased to see the 
#!/usr/bin/emacs --script idiom, because I can think of lots of ways of
harnessing Emacs' power in command-line utilities. 

However, there seem to be one or two problems before it can replace Perl
et al. One is the ability to read from STDIN -- I see that has been
discussed. 

Another is the start up process. It would be good if the site-start
process could recognise when Emacs was invoked with --script and avoid
loading packages only appropriate for interactive use. Not only is this
inefficient, but it results in a lot of chatter to STDERR.

Example:

> address@hidden:/tmp$ cat qq.el
> #!/usr/bin/emacs --script
> (princ (format "The date is %s\n" (current-time-string)))
> address@hidden:/tmp$ ./qq.el 2> /dev/null
> The date is Thu Mar 13 21:26:38 2008
> address@hidden:/tmp$ ./qq.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...
> The date is Thu Mar 13 21:26:43 2008

princ writes to STDOUT, so if I redirect STDERR I see just the desired
output, but without re-direction it's lost in a forest of "Loading"
messages. 

Re-directing STDERR to hide these messages has the inconvenience of
disabling intentional use of STDERR for real errors and warnings.

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

Is there a way to identify in lisp whether Emacs has been invoked with
--script? If so it is perhaps possible to develop conventions in the
site-start process whereby certain packages are loaded only for
interactive use. 

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:address@hidden  http://www.ul.ie/sociology/brendan.halpin.html





reply via email to

[Prev in Thread] Current Thread [Next in Thread]