From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Artur Hefczyc Newsgroups: gmane.emacs.help Subject: Re: Cool and Useful LISP for the .emacs file Date: Thu, 13 Nov 2003 22:54:12 +0300 Organization: Aster City Net Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <873ccs59jv.fsf@141-moc-9.acn.waw.pl> References: <7ik76b4k7s.fsf@neoscale.com> <87oevn9mim.fsf@141-moc-9.acn.waw.pl> <873cctih28.fsf@thalassa.informatimago.com> Reply-To: DONTkobit@SPAMplusnet.MEpl NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1068753608 15793 80.91.224.253 (13 Nov 2003 20:00:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 13 Nov 2003 20:00:08 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 13 21:00:04 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AKNdL-00033D-00 for ; Thu, 13 Nov 2003 21:00:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AKOaV-00049z-Bj for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Nov 2003 16:01:11 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!newsfeed.stueberl.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.tpinternet.pl!newsfeed.gazeta.pl!news.astercity.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 63 Original-NNTP-Posting-Host: 212.76.54.141 Original-X-Trace: foka.aster.pl 1068753252 26882 212.76.54.141 (13 Nov 2003 19:54:12 GMT) Original-X-Complaints-To: abuse@astercity.net Original-NNTP-Posting-Date: Thu, 13 Nov 2003 19:54:12 +0000 (UTC) X-Tech-Contact: usenet@astercity.net X-Server-Info: http://www.astercity.net/news/ User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:s3wTg9Ws1y4jazLIe9fhb7WdTw4= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEWZnZ3Iy9WTkI0NBA/H oYr09Ph6ZFJAKRng2dewemz3jcCRAAACR0lEQVR4nFWSvWvjQBDF1+a42jJyUKkTwcnVLtzGZrjL ljki2PJsi3HUHRi0tSGCrc2isP/tvVn5SyNceH779r0ZSZGnk59bvtVhIaVCRd3jfH/r7xc90LUn 2lvboGftVQBFzV3d6Y5tYwWfBVAEDoEhsRZnrb0CW5Ej+pKOHQB6dZnT0ljaWBfw2gOxxw/0Yp6g st9yNCZdXhVEajWN9zRsBZwlSmq6iwbcm5xBotRI7ZaLy4j20BOcL4rvcYKGA2z4sLxcNS7m8W4Z FKobKIriIKAOmgH39qpQAhYNttnVAIuBYmEFhBC6AYhxayINwPYGxjsJFbyQbn9nPpat14GiBFu4 XYX8TQCABx/uQD7HBB6nEddWL/HtqhxAzUMQgLkDV60xqeYI8p8hxLBce9641jlHACrPi0eSTHj9 vquOLjOexLpQYwAJFYLXAO6hIjHPC1H0Y5A+vahvXz4C7LdA0D5uOCmAEOJVGJGlp/GwX03SJ76A OWxlbLFaJelTo6NDBBQJ80mN0l916B0K3noxlpXwFu/eexWP7/+l5DV5j0G7k9gFlcsGt7N3DK41 ZKuUSNQK/W0xK41MoTWFVZIgNj7Dhp9LqTQOXqHvQAB420rfvOEPFpUlxwQ/APtsIik/cVf3Q77x xLnjWv0tz2VS7Cm25ZkotHpF+U7rTRRk2TEzqrzV5zpJzlc5dw/MzPUK9AeKt605C5DnHvzhUS9o TTlQPPBHD0pXHodgIyauLc0QTHnk2iMEpWnvU5kJf8wMEslo5j+pJm2vs6mv0wAAAABJRU5ErkJg gg== Original-Xref: shelby.stanford.edu gnu.emacs.help:118212 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:14153 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:14153 Pascal Bourguignon writes: >> > Kin Cho 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). > 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/