all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* --script
@ 2008-03-13 21:35 Brendan Halpin
  2008-03-14 10:48 ` --script Andreas Schwab
  2008-03-14 11:56 ` --script Johan Bockgård
  0 siblings, 2 replies; 6+ messages in thread
From: Brendan Halpin @ 2008-03-13 21:35 UTC (permalink / raw)
  To: emacs-devel

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





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

* Re: --script
  2008-03-13 21:35 --script Brendan Halpin
@ 2008-03-14 10:48 ` Andreas Schwab
  2008-03-14 14:19   ` --script Brendan Halpin
  2008-03-14 11:56 ` --script Johan Bockgård
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2008-03-14 10:48 UTC (permalink / raw)
  To: brendan.halpin; +Cc: emacs-devel

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

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

I think noninteractive is the right variable.

Documentation:
Non-nil means Emacs is running without interactive terminal.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

* Re: --script
  2008-03-13 21:35 --script Brendan Halpin
  2008-03-14 10:48 ` --script Andreas Schwab
@ 2008-03-14 11:56 ` Johan Bockgård
  1 sibling, 0 replies; 6+ messages in thread
From: Johan Bockgård @ 2008-03-14 11:56 UTC (permalink / raw)
  To: emacs-devel

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

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

  ``When Emacs is running in batch mode, any request to read from the
    minibuffer actually reads a line from the standard input descriptor
    that was supplied when Emacs was started.''

-- 
Johan Bockgård





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

* Re: --script
  2008-03-14 10:48 ` --script Andreas Schwab
@ 2008-03-14 14:19   ` Brendan Halpin
  2008-03-14 14:38     ` --script Jason Rumney
  2008-03-14 14:45     ` --script Andreas Schwab
  0 siblings, 2 replies; 6+ messages in thread
From: Brendan Halpin @ 2008-03-14 14:19 UTC (permalink / raw)
  To: emacs-devel

Andreas Schwab <schwab@suse.de> writes:

> I think noninteractive is the right variable.
>
> Documentation:
> Non-nil means Emacs is running without interactive terminal.

Excellent. Now, is there a way of exploiting this at the site-start
level? For instance, to selectively suppress the loading of certain
files in site-start.d when they are not relevant?

I can't find anything in Lisp -- perhaps this is controlled from C?

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] 6+ messages in thread

* Re: --script
  2008-03-14 14:19   ` --script Brendan Halpin
@ 2008-03-14 14:38     ` Jason Rumney
  2008-03-14 14:45     ` --script Andreas Schwab
  1 sibling, 0 replies; 6+ messages in thread
From: Jason Rumney @ 2008-03-14 14:38 UTC (permalink / raw)
  To: brendan.halpin; +Cc: emacs-devel

Brendan Halpin wrote:
> Andreas Schwab <schwab@suse.de> writes:
>
>   
>> I think noninteractive is the right variable.
>>
>> Documentation:
>> Non-nil means Emacs is running without interactive terminal.
>>     
>
> Excellent. Now, is there a way of exploiting this at the site-start
> level? For instance, to selectively suppress the loading of certain
> files in site-start.d when they are not relevant?
>   

(if noninteractive ... ....) would seem the obvious solution, or are you 
looking for something else.






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

* Re: --script
  2008-03-14 14:19   ` --script Brendan Halpin
  2008-03-14 14:38     ` --script Jason Rumney
@ 2008-03-14 14:45     ` Andreas Schwab
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2008-03-14 14:45 UTC (permalink / raw)
  To: brendan.halpin; +Cc: emacs-devel

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

> I can't find anything in Lisp -- perhaps this is controlled from C?

See the command line parsing in main.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

end of thread, other threads:[~2008-03-14 14:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-13 21:35 --script Brendan Halpin
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

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.