Files
dotdenote/assets/docker/notes/20240310T083000--elisp-fundamentals__emacs_elisp.org
andros 9ddd118a49 Redesign UI with flat retro Emacs aesthetic
Replace standard iOS components with a terminal-inspired design:
monospaced typography throughout, flat square borders, Emacs-style
modeline header, filetag keyword format (:kw1:kw2:), and custom
flat form replacing the iOS Form component. Set Emacs as default
theme. Replace non-Emacs demo notes with Emacs ecosystem content
and rename screenshots.
2026-06-17 12:54:41 +02:00

1.1 KiB

Elisp Fundamentals

Data types

;; Numbers
42
3.14

;; Strings
"Hello, Emacs!"

;; Symbols
'my-symbol

;; Lists
'(1 2 3)
'(a b c)

;; Cons cells
(cons 1 2)   ; => (1 . 2)

Defining functions

(defun greet (name)
  "Return a greeting for NAME."
  (format "Hello, %s!" name))

(greet "Emacs")  ; => "Hello, Emacs!"

let and let*

(let ((x 10)
      (y 20))
  (+ x y))  ; => 30

;; let* allows forward references
(let* ((x 10)
       (y (* x 2)))
  y)  ; => 20

Useful built-ins

Function Description
car / cdr Head / tail of a list
mapcar Map function over list
seq-filter Filter list by predicate
string-join Join list of strings
number-to-string Convert number to string
message Print to minibuffer