Emacs Lisp: Define Function

By Xah Lee. Date: . Last updated: .

Basic function definition is of the form:

(defun function_name (param1 param2 etc) doc_string_optional body)

(defun myFunction ()
  (message "Yay!"))

When a function is called, the last expression in the function's definition body is returned. (there's no “return statement”.)

(info "(elisp) Defining Functions")

Lisp Basics

Emacs Lisp Function

ErgoEmacs mascot-s276x226
Buy Xah Emacs Tutorial

Lisp Basics


Lisp Data Structure


Lisp Symbol

Lisp Misc

Working with Elisp