* syntax / method for executing an emacs lisp function?
@ 2006-05-30 15:22 farbot
2006-05-30 15:27 ` Albert Reiner
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: farbot @ 2006-05-30 15:22 UTC (permalink / raw)
I'm writing a language mode for emacs, but have never used emacs before
(the mode is for others to use). I've searched for hours, but can't
find the incantation I need. I'd appreciate some pointers to specific
help files or techniques.
I'd like to run the regexp-opt command to optimize my list of keywords.
For example:
(regexp-opt '("TRUE" "FALSE") t)
I've tried a bunch of methods from inside emacs, but it always says
there is "no match" for regexp-opt. I've had the best luck on the
command line using 'emacs --eval' option, but one of two things
happens: 1) it dislikes my syntax (badly placed ()s, unmatched '), or
2) it accepts the syntax, and opens emacs and shows a *scratch* buffer
in "(Lisp Interaction)" mode -- but there are no function results
present. In the *Messages* buffer, I find my command echoed, but still
no function results.
I also tried typing commands in Lisp Interaction mode -- but neither
return nor enter makes them execute.
I'm thinking I need to figure out how to execute from a file instead of
the command line -- since some of my keyword lists are quite long (not
sure how much fits on the command line).
I'm running emacs 21.2.1 from the command line on Mac OS X 10.4.6.
Thanks for any pointers you might have.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: syntax / method for executing an emacs lisp function?
2006-05-30 15:22 syntax / method for executing an emacs lisp function? farbot
@ 2006-05-30 15:27 ` Albert Reiner
2006-05-30 17:30 ` Kevin Rodgers
2006-05-30 19:01 ` farbot
2 siblings, 0 replies; 4+ messages in thread
From: Albert Reiner @ 2006-05-30 15:27 UTC (permalink / raw)
[farbot@gmail.com, 30 May 2006 08:22:10 -0700]:
> I also tried typing commands in Lisp Interaction mode -- but neither
> return nor enter makes them execute.
C-j ?
Or you can also use C-x C-e after any sexp even in non-Lisp buffers.
Can't help with the rest, though.
Albert.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: syntax / method for executing an emacs lisp function?
2006-05-30 15:22 syntax / method for executing an emacs lisp function? farbot
2006-05-30 15:27 ` Albert Reiner
@ 2006-05-30 17:30 ` Kevin Rodgers
2006-05-30 19:01 ` farbot
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2006-05-30 17:30 UTC (permalink / raw)
farbot@gmail.com wrote:
> I'm writing a language mode for emacs, but have never used emacs before
> (the mode is for others to use). I've searched for hours, but can't
> find the incantation I need. I'd appreciate some pointers to specific
> help files or techniques.
First, you should read the Introduction to Programming in Emacs Lisp,
which is a manual distributed with Emacs 22 in Info format and available
on the web at http://www.gnu.org/software/emacs/emacs-lisp-intro/
The Emacs Lisp reference manual is distributed with Emacs in Info
format, too. `C-h i' then `m Info RET' will get you started with
Info, or read it online at http://www.gnu.org/software/emacs/elisp/
The Emacs Wiki is a great resource; here are two good pages, one general
and one specific:
http://www.emacswiki.org/cgi-bin/wiki/CategoryCode
http://www.emacswiki.org/cgi-bin/wiki/CreateNewMajorMode
> I'd like to run the regexp-opt command to optimize my list of keywords.
> For example:
> (regexp-opt '("TRUE" "FALSE") t)
>
> I've tried a bunch of methods from inside emacs, but it always says
> there is "no match" for regexp-opt.
regexp-opt is autoloaded in Emacs 22, but perhaps you need this:
(require 'regexp-opt)
> I've had the best luck on the
> command line using 'emacs --eval' option, but one of two things
> happens: 1) it dislikes my syntax (badly placed ()s, unmatched '), or
> 2) it accepts the syntax, and opens emacs and shows a *scratch* buffer
> in "(Lisp Interaction)" mode -- but there are no function results
> present. In the *Messages* buffer, I find my command echoed, but still
> no function results.
Please post exactly what you did, and exactly what happened. My
crystal ball is at the shop.
The results of a function call given on the command line with --eval
are not printed anywhere by default.
> I also tried typing commands in Lisp Interaction mode -- but neither
> return nor enter makes them execute.
That's because RET is bound to newline in that mode. You need to
type C-j, which runs eval-print-last-sexp.
This is documented in the Emacs manual in the Lisp Interaction node.
> I'm thinking I need to figure out how to execute from a file instead of
> the command line -- since some of my keyword lists are quite long (not
> sure how much fits on the command line).
That's up to your shell and your OS. But putting your Emacs Lisp in
its own file is a good idea anyway.
> I'm running emacs 21.2.1 from the command line on Mac OS X 10.4.6.
> Thanks for any pointers you might have.
Read the Fine Manuals.
--
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: syntax / method for executing an emacs lisp function?
2006-05-30 15:22 syntax / method for executing an emacs lisp function? farbot
2006-05-30 15:27 ` Albert Reiner
2006-05-30 17:30 ` Kevin Rodgers
@ 2006-05-30 19:01 ` farbot
2 siblings, 0 replies; 4+ messages in thread
From: farbot @ 2006-05-30 19:01 UTC (permalink / raw)
Thank you very much for your kind and thoughtful replies. After
getting into Lisp Interaction mode, I was able to execute the
regexp-opt command using C-j.
It looks now like I took many wrong turns in over four hours of reading
the manuals and searching help yesterday. I did search for help on
Lisp Interaction, but somehow ended up at "External Lisp", which told
me to use RET to execute commands. I appreciate the pointers to the
specific wiki and manual pages; those were extremely helpful.
Thanks for taking the time to help me run this one command I needed.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-05-30 19:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-30 15:22 syntax / method for executing an emacs lisp function? farbot
2006-05-30 15:27 ` Albert Reiner
2006-05-30 17:30 ` Kevin Rodgers
2006-05-30 19:01 ` farbot
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).