Elisp: Define Function
Define Function
Basic function definition is of the form:
(defun function_name
(param1 param2 etc)
doc_string_optional
body)
(defun ff () "print yay" (message "Yay!"))
(defun gg (x) "add two" (+ x 2))
(defun ff (x y) "add x and y" (+ x y))
When a function is called, the last expression in the function's definition body is returned. (there's no “return statement”.)
Define a Command
To define a command, add (interactive)
right after the docstring.