Category:Emacs Lisp: Difference between revisions

No edit summary
Line 12:
==How to run Emacs Lisp code==
 
A simple way to run Emacs code is to switch to the scratch buffer (Buffers -> *scratch*), type in or paste some Lisp code, and then move to the end of the Lisp expression and press Control-J to evaluate ite.g.[https://www.gnu.org/software/emacs/manual/html_node/efaq/Evaluating-Emacs-Lisp-code.html]
<pre>(+ 1 2 3)</pre>
Then (with the cursor behind the closing parenthesis of the Lisp form) press Control-J to evaluate it.[https://www.gnu.org/software/emacs/manual/html_node/efaq/Evaluating-Emacs-Lisp-code.html] The result appears directly below the evaluated code:
<pre>(+ 1 2 3)<Ctrl-J>
6</pre>
Of course you can also change your code and evaluate it again.
 
Emacs will highlight matching parentheses.
If the debugger window appears, it can be dismissed with File -> Close like any other buffer.
 
If your code has an error and the debugger window appears, it can be dismissed withby placing the cursor in it and then File -> Close like any other buffer.
Lisp code can also be added to the user's ~/.emacs file, which is evaluated at startup.
 
==Customizing Emacs==
 
Lisp code can also be added to the user's ~/.emacs file, which is evaluated at startup.
 
"M-x (=Alt-x) customize" will bring up a menu for customizing default Emacs settings. "Faces -> Basic Faces -> Region" in that menu for example sets the background color of selections. It is a good idea to change this, e.g. to "LightSteelBlue1", because the default setting is a very light gray that is hard to see.
 
Another useful setting is enabling "Emacs -> Convenience -> Cua -> Cua mode" for the standard Ctrl-X/C/V/Z key bindings that are known from most other applications.
 
There are also color themes for Emacs, e.g. if you prefer dark mode.
 
==External links==
Anonymous user