* Re: first emacs lisp script: hello world [not found] <mailman.4714.1197046346.18990.help-gnu-emacs@gnu.org> @ 2007-12-07 18:04 ` Joel J. Adamson 2007-12-07 18:08 ` Xah Lee 1 sibling, 0 replies; 14+ messages in thread From: Joel J. Adamson @ 2007-12-07 18:04 UTC (permalink / raw) To: help-gnu-emacs "Stewart Haddock" <SHaddock@corp.web.com> writes: > All right.. Here comes the new guy. > > I downloaded emacs, but I can not figure out how to create a hello > world script and run it. I know this is incredibly basic, but when > you are doing this stuff by yourself it is not always obvious. Can > someone point the way? Have you tried the tutorial? If you're really interested in Emacs Lisp, see http://www.gnu.org/software/emacs/emacs-lisp-intro/html_mono/emacs-lisp-intro.html. It should also be included as an info file in your installation (as long as you installed Emacs 22 or above). [f1] i should get you the info browser. HTH Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: first emacs lisp script: hello world [not found] <mailman.4714.1197046346.18990.help-gnu-emacs@gnu.org> 2007-12-07 18:04 ` first emacs lisp script: hello world Joel J. Adamson @ 2007-12-07 18:08 ` Xah Lee 1 sibling, 0 replies; 14+ messages in thread From: Xah Lee @ 2007-12-07 18:08 UTC (permalink / raw) To: help-gnu-emacs See: Emacs Lisp Basics http://xahlee.org/emacs/elisp_basics.html Xah xah@xahlee.org \xAD\xF4 http://xahlee.org/ On Dec 7, 7:11 am, "Stewart Haddock" <SHadd...@corp.web.com> wrote: > All right.. Here comes the new guy. > > I downloaded emacs, but I can not figure out how to create a hello world > script and run it. I know this is incredibly basic, but when you are > doing this stuff by yourself it is not always obvious. Can someone > point the way? > > Stewart ^ permalink raw reply [flat|nested] 14+ messages in thread
* first emacs lisp script: hello world @ 2007-12-07 15:11 Stewart Haddock 2007-12-07 17:18 ` Lennart Borgman (gmail) ` (3 more replies) 0 siblings, 4 replies; 14+ messages in thread From: Stewart Haddock @ 2007-12-07 15:11 UTC (permalink / raw) To: help-gnu-emacs [-- Attachment #1.1: Type: text/plain, Size: 299 bytes --] All right.. Here comes the new guy. I downloaded emacs, but I can not figure out how to create a hello world script and run it. I know this is incredibly basic, but when you are doing this stuff by yourself it is not always obvious. Can someone point the way? Stewart [-- Attachment #1.2: Type: text/html, Size: 2046 bytes --] [-- Attachment #2: Type: text/plain, Size: 152 bytes --] _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: first emacs lisp script: hello world 2007-12-07 15:11 Stewart Haddock @ 2007-12-07 17:18 ` Lennart Borgman (gmail) 2007-12-07 17:29 ` Eric Hanchrow ` (2 subsequent siblings) 3 siblings, 0 replies; 14+ messages in thread From: Lennart Borgman (gmail) @ 2007-12-07 17:18 UTC (permalink / raw) To: Stewart Haddock; +Cc: help-gnu-emacs Stewart Haddock wrote: > All right.. Here comes the new guy. > > > > I downloaded emacs, but I can not figure out how to create a hello world > script and run it. I know this is incredibly basic, but when you are > doing this stuff by yourself it is not always obvious. Can someone > point the way? Maybe http://www.emacswiki.org/cgi-bin/emacs-en?CategoryCode or a simple hello-world: (defun hello-world() (interactive) (message "Hello!")) put that in your *Scratch* buffer, do M-x eval-buffer and then M-x hello-world ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: first emacs lisp script: hello world 2007-12-07 15:11 Stewart Haddock 2007-12-07 17:18 ` Lennart Borgman (gmail) @ 2007-12-07 17:29 ` Eric Hanchrow 2007-12-07 17:44 ` Peter Dyballa [not found] ` <mailman.4724.1197050200.18990.help-gnu-emacs@gnu.org> 3 siblings, 0 replies; 14+ messages in thread From: Eric Hanchrow @ 2007-12-07 17:29 UTC (permalink / raw) To: help-gnu-emacs >>>>> "Stewart" == Stewart Haddock <SHaddock@corp.web.com> writes: Stewart> All right.. Here comes the new guy. I downloaded emacs, Stewart> but I can not figure out how to create a hello world Stewart> script and run it. I know this is incredibly basic, but Stewart> when you are doing this stuff by yourself it is not Stewart> always obvious. Can someone point the way? Depends what you mean by "script". If you mean a standalone program that you can invoke from the operating-system shell, then ... even if it's theoretically possible to do that, I don't think you want to. Ugh. But if, on the other hand, you just mean "a function I can invoke from within Emacs that displays \"hello world\" somewhere", there are lots of ways. Take a look at "An Introduction to Programming in Emacs Lisp", specifically the node named "1.2 Run a Program". If you're reading this message in Emacs 22 at this very minute, you can easily view that node by putting your cursor at the end of the following Lisp expression, and typing C-x C-e: (info "(eintr)Run a Program") -- ... advocating Object-Oriented Programming is like advocating Pants-Oriented Clothing. -- Steve Yegge ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: first emacs lisp script: hello world 2007-12-07 15:11 Stewart Haddock 2007-12-07 17:18 ` Lennart Borgman (gmail) 2007-12-07 17:29 ` Eric Hanchrow @ 2007-12-07 17:44 ` Peter Dyballa [not found] ` <mailman.4724.1197050200.18990.help-gnu-emacs@gnu.org> 3 siblings, 0 replies; 14+ messages in thread From: Peter Dyballa @ 2007-12-07 17:44 UTC (permalink / raw) To: Stewart Haddock; +Cc: help-gnu-emacs Am 07.12.2007 um 16:11 schrieb Stewart Haddock: > I downloaded emacs, but I can not figure out how to create a hello > world > script and run it. emacs -nw -Q -eval '(message "ORBIS SALUTE")' ? -- Greetings Pete Real Time, adj.: Here and now, as opposed to fake time, which only occurs there and then. ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.4724.1197050200.18990.help-gnu-emacs@gnu.org>]
* Re: first emacs lisp script: hello world [not found] ` <mailman.4724.1197050200.18990.help-gnu-emacs@gnu.org> @ 2007-12-07 22:06 ` Joel J. Adamson 2007-12-07 23:52 ` Eric Hanchrow [not found] ` <mailman.4745.1197071540.18990.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 14+ messages in thread From: Joel J. Adamson @ 2007-12-07 22:06 UTC (permalink / raw) To: help-gnu-emacs Eric Hanchrow <offby1@blarg.net> writes: > Depends what you mean by "script". If you mean a standalone program > that you can invoke from the operating-system shell, then ... even if > it's theoretically possible to do that, I don't think you want to. #!/usr/bin/emacs --script (message "Hello Biscuit-lovers!") An actual transcript from my shell: joel@W0053328:~/lisp/el% chmod +x biscuit.el joel@W0053328:~/lisp/el% ./biscuit.el Hello Biscuit-lovers! I rest my case. Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: first emacs lisp script: hello world 2007-12-07 22:06 ` Joel J. Adamson @ 2007-12-07 23:52 ` Eric Hanchrow [not found] ` <mailman.4745.1197071540.18990.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 14+ messages in thread From: Eric Hanchrow @ 2007-12-07 23:52 UTC (permalink / raw) To: help-gnu-emacs #!/usr/bin/emacs --script (message "Hello Biscuit-lovers!") Waal, shoot, Jackson; ah dint know 'bout thet thar --script option. -- He who refuses to do arithmetic is doomed to talk nonsense. -- John McCarthy ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.4745.1197071540.18990.help-gnu-emacs@gnu.org>]
* Re: first emacs lisp script: hello world [not found] ` <mailman.4745.1197071540.18990.help-gnu-emacs@gnu.org> @ 2007-12-10 16:34 ` Joel J. Adamson 2007-12-10 18:39 ` thorne 2007-12-11 16:08 ` Exal de Jesus Garcia Carrillo 0 siblings, 2 replies; 14+ messages in thread From: Joel J. Adamson @ 2007-12-10 16:34 UTC (permalink / raw) To: help-gnu-emacs Eric Hanchrow <offby1@blarg.net> writes: > #!/usr/bin/emacs --script > (message "Hello Biscuit-lovers!") > > Waal, shoot, Jackson; ah dint know 'bout thet thar --script option. It's pretty sweet, and I got the impression that it's a fairly new feature since there's very little about it on EmacsWiki. I've already written a couple shell-scripts in it. Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: first emacs lisp script: hello world 2007-12-10 16:34 ` Joel J. Adamson @ 2007-12-10 18:39 ` thorne 2007-12-12 21:29 ` Sebastian Tennant 2007-12-13 14:19 ` Joel J. Adamson 2007-12-11 16:08 ` Exal de Jesus Garcia Carrillo 1 sibling, 2 replies; 14+ messages in thread From: thorne @ 2007-12-10 18:39 UTC (permalink / raw) To: help-gnu-emacs jadamson@partners.org (Joel J. Adamson) writes: > Eric Hanchrow <offby1@blarg.net> writes: > >> #!/usr/bin/emacs --script >> (message "Hello Biscuit-lovers!") >> >> Waal, shoot, Jackson; ah dint know 'bout thet thar --script option. > > It's pretty sweet, and I got the impression that it's a fairly new > feature since there's very little about it on EmacsWiki. I've already > written a couple shell-scripts in it. That is cool. Goodbye bash, hello Emacs. But i couldn't find anything about it in the Emacs info file (though i did not search high and low) now on EmacsWiki.org. I'd like to know basic stuff, like: Is there a way to get a command-line argument to the script?--etc. And speaking of info, is there a command in info (or some other way) to find out the canonical name of a specific node, to refer people to that node? -- Theron Ttlåx ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: first emacs lisp script: hello world 2007-12-10 18:39 ` thorne @ 2007-12-12 21:29 ` Sebastian Tennant 2007-12-13 14:19 ` Joel J. Adamson 1 sibling, 0 replies; 14+ messages in thread From: Sebastian Tennant @ 2007-12-12 21:29 UTC (permalink / raw) To: help-gnu-emacs Quoth thorne <thorne@timbral.net>: > And speaking of info, is there a command in info (or some other way) to > find out the canonical name of a specific node, to refer people to that > node? C-h i m emacs <RET> Look at the mode line. There's the canonical node name - "(emacs) Top". Sebastian ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: first emacs lisp script: hello world 2007-12-10 18:39 ` thorne 2007-12-12 21:29 ` Sebastian Tennant @ 2007-12-13 14:19 ` Joel J. Adamson 1 sibling, 0 replies; 14+ messages in thread From: Joel J. Adamson @ 2007-12-13 14:19 UTC (permalink / raw) To: help-gnu-emacs thorne <thorne@timbral.net> writes: > jadamson@partners.org (Joel J. Adamson) writes: > >> Eric Hanchrow <offby1@blarg.net> writes: >> >>> #!/usr/bin/emacs --script >>> (message "Hello Biscuit-lovers!") >>> >>> Waal, shoot, Jackson; ah dint know 'bout thet thar --script option. >> >> It's pretty sweet, and I got the impression that it's a fairly new >> feature since there's very little about it on EmacsWiki. I've already >> written a couple shell-scripts in it. > > That is cool. Goodbye bash, hello Emacs. You can manipulate buffers in an Emacs script and save them using the regular file-saving and file-writing commands. > But i couldn't find anything about it in the Emacs info file (though i > did not search high and low) now on EmacsWiki.org. Yeah, I found nothing myself, other than one note saying that it was a very new feature and few people have used it. So I decided to try it out. Appendix C.2 "Initial Options" |`--script FILE' | Run Emacs in batch mode, like `--batch', and then read and execute | the Lisp code in FILE. | | The normal use of this option is in executable script files that | run Emacs. They can start with this text on the first line | | #!/usr/bin/emacs --script | | which will invoke Emacs with `--script' and supply the name of the | script file as FILE. Emacs Lisp then treats `#!' as a comment | delimiter. > I'd like to know basic stuff, like: Is there a way to get a > command-line argument to the script?--etc. The first two arguments are "/usr/bin/emacs" and "--script", so I access command line options with (nthcdr 3 (command-line-args)), but think you could use (command-line-args-left) instead. For example, when I want a list of files to load and edit: (setq files (nthcdr 3 command-line-args)) (dolist (file files) (catch 'no-file ;; is the filereadable? (if (file-readable-p file) ;; then find the file (find-file file) ...))) I started this to replace sed, since I mostly do substitutions, I wrote a regex-replace function to take an alist of regexes and their respective replacements. This way I just have to type the alist, instead of s/.../.../Ig a corresponding bunch of times: (defun jedit-strip-regex (alist) "Takes a list of regex-replacement string pairs; processes entire buffer." (interactive "sList: ") ;; for each cell in alist, define regex and replacement text (dolist (regex-cell alist) (let ((regex (car regex-cell)) (replacement (cadr regex-cell))) ;; go to beginning of buffer (goto-char (point-min)) ;; when you find the search string, replace it with replacement ;; text (while (re-search-forward regex nil t) (replace-match replacement nil nil))))) I previously posted this on gnu.emacs.sources without the accompanying script that uses it. Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: first emacs lisp script: hello world 2007-12-10 16:34 ` Joel J. Adamson 2007-12-10 18:39 ` thorne @ 2007-12-11 16:08 ` Exal de Jesus Garcia Carrillo 2007-12-11 18:05 ` Joel J. Adamson 1 sibling, 1 reply; 14+ messages in thread From: Exal de Jesus Garcia Carrillo @ 2007-12-11 16:08 UTC (permalink / raw) To: help-gnu-emacs -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Joel J. Adamson em gnu.emacs.help escreveu : > I've already > written a couple shell-scripts in it. Available online? :-) - -- Spam protection: In my e-mail replace the words `no-spam' with `exal'. . -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/> iD8DBQFHXrX+oZmxoVJRtGIRApwwAJ9rePOdlUXl6UnTypTBluHPUtq3bACdH6+w Bh5ogV02Fez7ZLT69iSjXIM= =IJiF -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: first emacs lisp script: hello world 2007-12-11 16:08 ` Exal de Jesus Garcia Carrillo @ 2007-12-11 18:05 ` Joel J. Adamson 0 siblings, 0 replies; 14+ messages in thread From: Joel J. Adamson @ 2007-12-11 18:05 UTC (permalink / raw) To: help-gnu-emacs Exal de Jesus Garcia Carrillo <no-spam@gnu.org> writes: > Joel J. Adamson em gnu.emacs.help escreveu : > > >> I've already >> written a couple shell-scripts in it. > > > Available online? :-) I will make them available on EmacsWiki and gnu.emacs.sources after I insert a few dependency checks. Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109 ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2007-12-13 14:19 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <mailman.4714.1197046346.18990.help-gnu-emacs@gnu.org> 2007-12-07 18:04 ` first emacs lisp script: hello world Joel J. Adamson 2007-12-07 18:08 ` Xah Lee 2007-12-07 15:11 Stewart Haddock 2007-12-07 17:18 ` Lennart Borgman (gmail) 2007-12-07 17:29 ` Eric Hanchrow 2007-12-07 17:44 ` Peter Dyballa [not found] ` <mailman.4724.1197050200.18990.help-gnu-emacs@gnu.org> 2007-12-07 22:06 ` Joel J. Adamson 2007-12-07 23:52 ` Eric Hanchrow [not found] ` <mailman.4745.1197071540.18990.help-gnu-emacs@gnu.org> 2007-12-10 16:34 ` Joel J. Adamson 2007-12-10 18:39 ` thorne 2007-12-12 21:29 ` Sebastian Tennant 2007-12-13 14:19 ` Joel J. Adamson 2007-12-11 16:08 ` Exal de Jesus Garcia Carrillo 2007-12-11 18:05 ` Joel J. Adamson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).