The LISP-based scripting language used to customise the Emacs programmers' editor.

Emacs is completely scriptable in Elisp - look in /usr/share/emacs/site-lisp/*.el for the start-up and config files.

Programming in Emacs Lisp is an online book about Emacs scripting by Robert J. Chassell. It does not assume you already know Lisp.

Note for Lisp programmers

ELisp is dynamically scoped. This affects how global variables in function definitions are looked up. With dynamic scoping the interpreter looks up these variables in the environment where the function is called. What other LISP do is to use the variable definitions that were present when the function was defined (i.e. lexical scoping). This difference will only effect you if you are trying to do lots of higher-order functional programming in ELisp, but if you do, it will trip you up.


This sets up the F12 key to instantly save and close a file that Emacs is editing

(defun begins-with-p (str sub)

"True if string `str' begins with substring `sub'." (and (>= (length str) (length sub))

(string= (substring str 0 (length sub)) sub)))

(defun put-away-buffer (&optional buffer)

"This kills a buffer, saving its contents first, if necessary.

Internal and scratch buffers are ignored."

(interactive) (unless buffer

(setq buffer (current-buffer)))

(unless (or (begins-with-p (buffer-name buffer) " ") ;ignore internal buffers

(string= "scratch" (buffer-name buffer))) ;ignore scratch buffer

(when (and (buffer-file-name buffer) ;is visiting a file

(buffer-modified-p buffer))



(global-set-key [f12? #'put-away-buffer)

CategoryProgrammingLanguages, CategoryFunctionalProgrammingLanguages

lib/main.php:944: Notice: PageInfo: Cannot find action page

lib/main.php:839: Notice: PageInfo: Unknown action