Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
Elisp
Edit
PageHistory
Diff
Info
LikePages
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 | http://www.delorie.com/gnu/docs/emacs-lisp-intro/emacs-lisp-intro.html]'' 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 | HigherOrderFunctions] in ELisp, but if you do, it will trip you up. !!!Example 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)) (save-buffer)) (kill-this-buffer))) (global-set-key [[f12] #'put-away-buffer) ---- CategoryProgrammingLanguages, CategoryFunctionalProgrammingLanguages
4 pages link to
Elisp
:
LISP
TextEditor
Emacs
Tcl