[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs evaluating
Pascal J. Bourguignon
Re: emacs evaluating
Sat, 07 Feb 2009 15:18:23 +0100
Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin)
"Haris Bogdanoviæ" <address@hidden> writes:
> "Haris Bogdanoviæ" <address@hidden> wrote in message
>> When I write a function in emacs, how can I try it ?
Emacs questions are better asked on news:gnu.emacs.help
Type C-x C-e with the point after the function source to enter it into
the emacs lisp image.
They type (your-function your-argument) C-x C-e to evaluate it.
If you type C-y C-x C-e instead, the result of the expression will be
inserted in the buffer at the point.
(+ 1 2) C-u C-x C-e --> 3
(defun f (x) (if (< x 1) 1 (* x (f (1- x))))) C-x C-e
(f 9) C-u C-x C-e --> 362880
You don't need to compile your emacs lisp functions to use them. At
least not until they're debugged.
>> Can I open some window (buffer) for evaluating ?
Yes. M-x ielm RET gives you an interactive REPL to emacs lisp.
> When I try to compile function it gives me "make -k" command, I press enter
> and I get error message.
> Does emacs have lisp interpreter or I have to install it separatelly ?
You can get information about what an emacs command purpose is with:
C-h f compile RET
As you can see, compile has nothing to do with compiling emacs lisp
It could be used to compile an emacs lisp source, if you defined a
Makefile or used the emacs command to do so. For example, you could
emacs --eval '(byte-compile-file "source.el")'
to compile source.el into source.elc with emacs.
But we prefer to do it more interactively in lisp:
To compile a function: (byte-compile 'your-function) C-x C-e
To compile an emacs lisp source file: M-x byte-compile-file RET source.el RET
To load an emacs lisp source: M-x load-file RET source.el RET
To evaluate a while buffer: M-x eval-buffer RET
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
Q: What is the most annoying thing on usenet and in e-mail?
----------> http://www.netmeister.org/news/learn2quote.html <-----------
---> http://homepage.ntlworld.com/g.mccaughan/g/remarks/uquote.html <---
__Pascal Bourguignon__ http://www.informatimago.com/
- Re: emacs evaluating,
Pascal J. Bourguignon <=