help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Cool and Useful LISP for the .emacs file


From: Artur Hefczyc
Subject: Re: Cool and Useful LISP for the .emacs file
Date: Thu, 13 Nov 2003 22:54:12 +0300
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux)

Pascal Bourguignon <spam@thalassa.informatimago.com> writes:
>> > Kin Cho <kin@techie.com> writes:
>> >> I used to carry around a collection of shell, sed, awk, and perl
>> >> scripts to do various text/file/directory processing, as well as
>> >> doing cvs/rcs stuff, running compilation and gdb etc...  Now I do
>> >> (almost) all these things in elisp.
>> > I like this idea! I would like to use elisp as scripting language
>> > also. However I would like to know if it is possible to use it that
>> > way. I mean, lets assume I create elisp script to update my Linux box
>> > system with new releases of some packages.
>> > Is it possible to run it from command line like all other scripts,
>> > bash, perl etc.?
>> > I mean file script starting from:
>> > #!/usr/bin/emacs
>> > Or any other elisp interpreter?
>> Given how big Emacs is, I would think that it would be best to start
>> emacs in background (say, from your .login) and then use something
>> like gnudoit or emacsclient to send your elisp to the background
>> Emacs.  Done correctly, I would think that it would execute your
>> scripts much faster, no?
> No.
> emacs IS NOT big.
> $ ls -l emacs perl
> -rwxr-xr-t    1 pascal   regular   4433296 2003-11-12 19:08 emacs*
> -rwxr-xr-x    1 pascal   regular   1113248 2003-11-12 19:08 perl*
> emacs is already in core memory so forking additionnal emacs processes
> does not cost anything significant.
> Starting a script  in perl or in emacs takes the  same time. (Any time
> below 0.7 s IS the same time).
> <snip>

Thank you all for your comments. They are very valuable for me.
I am emacs user for many years but not an expert of elisp or any other
Lisp implementation.
So I don't care whether it is efficient or not, fast or slow, I just
want to learn lisp and become good in it. Therefore I want to start
using it whenever possible.

At the moment, with emacs-cvs ver. 21.3.50 using emacs as script
interpreter is pretty easy without any additional tricks. Just put to
your first line of script file:

#!/use/bin/emacs --script

;; And after that you can use regular elisp code:
(princ "Hello world!")
;; end.

Of course it doesn't work with earlier versions and does _not_ work
construction presented below:

#!/use/bin/emacs --batch -l $0

because for some reason emacs thinks that the whole parameter string:
"--batch -l $0" is one option - unknown for him.

Artur
-- 
Artur Hefczyc, Open Source Developer:
http://www.geotools.org/
http://generguide.sourceforge.net/
http://wttools.sourceforge.net/
http://maven-plugins.sourceforge.net/


reply via email to

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