From: Brendan Halpin <brendan.halpin@ul.ie>
To: emacs-devel@gnu.org
Subject: --script
Date: Thu, 13 Mar 2008 21:35:49 +0000 [thread overview]
Message-ID: <8763vq8fyi.fsf@wivenhoe.staff8.ul.ie> (raw)
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:
> brendan@wivenhoe:/tmp$ cat qq.el
> #!/usr/bin/emacs --script
> (princ (format "The date is %s\n" (current-time-string)))
> brendan@wivenhoe:/tmp$ ./qq.el 2> /dev/null
> The date is Thu Mar 13 21:26:38 2008
> brendan@wivenhoe:/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:brendan.halpin@ul.ie http://www.ul.ie/sociology/brendan.halpin.html
next reply other threads:[~2008-03-13 21:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-13 21:35 Brendan Halpin [this message]
2008-03-14 10:48 ` --script Andreas Schwab
2008-03-14 14:19 ` --script Brendan Halpin
2008-03-14 14:38 ` --script Jason Rumney
2008-03-14 14:45 ` --script Andreas Schwab
2008-03-14 11:56 ` --script Johan Bockgård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8763vq8fyi.fsf@wivenhoe.staff8.ul.ie \
--to=brendan.halpin@ul.ie \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.