Go to the first, previous, next, last section, table of contents.


Defining Functions

Named functions are normally defined by the defun special form.

Special Form: defun name lambda-list body-forms...
defun initialises the function definition of the symbol name to the lambda expression resulting from the concatenation of the symbol lambda, lambda-list and the body-forms. So,

(defun foo (x y)
  ...
==
(fset 'foo #'(lambda (x y)
               ...

The body-forms may contain a documentation string for the function as its first form and an interactive calling specification as its first (if there is no doc-string) or second form if the function may be called interactively by the user (see section Commands).

An example function definition (actually a command) taken from Jade's source is,

(defun upcase-word (count)
  "Makes the next COUNT words from the cursor upper-case."
  (interactive "p")
  (let
      ((pos (forward-word count)))
    (upcase-area (cursor-pos) pos)
    (goto-char pos)))


Go to the first, previous, next, last section, table of contents.