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 ()
  "testing"
  (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

Basics

Lisp Data Structure

Function

Lisp Symbol

Lisp Misc

Working with Elisp