9ddd118a49
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.
60 lines
1.1 KiB
Org Mode
60 lines
1.1 KiB
Org Mode
#+title: Elisp Fundamentals
|
|
#+date: [2024-03-10 Sun]
|
|
#+filetags: :emacs:elisp:
|
|
#+identifier: 20240310T083000
|
|
|
|
* Data types
|
|
|
|
#+begin_src emacs-lisp
|
|
;; Numbers
|
|
42
|
|
3.14
|
|
|
|
;; Strings
|
|
"Hello, Emacs!"
|
|
|
|
;; Symbols
|
|
'my-symbol
|
|
|
|
;; Lists
|
|
'(1 2 3)
|
|
'(a b c)
|
|
|
|
;; Cons cells
|
|
(cons 1 2) ; => (1 . 2)
|
|
#+end_src
|
|
|
|
* Defining functions
|
|
|
|
#+begin_src emacs-lisp
|
|
(defun greet (name)
|
|
"Return a greeting for NAME."
|
|
(format "Hello, %s!" name))
|
|
|
|
(greet "Emacs") ; => "Hello, Emacs!"
|
|
#+end_src
|
|
|
|
* let and let*
|
|
|
|
#+begin_src emacs-lisp
|
|
(let ((x 10)
|
|
(y 20))
|
|
(+ x y)) ; => 30
|
|
|
|
;; let* allows forward references
|
|
(let* ((x 10)
|
|
(y (* x 2)))
|
|
y) ; => 20
|
|
#+end_src
|
|
|
|
* 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 |
|