Language Specifications
Table of Contents
set, setq, setq-default reference
is equivalent to:
(defvar xxx ...) ;; declare xxx with global scope
(make-local-variable 'xxx) ;; make xxx local in this buffer onlyIf a variable is buffer-local:
setqsets its local value in the current buffersetq-defaultsets the global default value.
?<character> reference
- Prefix
?before a character.
?Q ⇒ 81 ?q ⇒ 113
?\a ⇒ 7 ; control-g, C-g
?\b ⇒ 8 ; backspace, BS, C-h
?\t ⇒ 9 ; tab, TAB, C-i
?\n ⇒ 10 ; newline, C-j
?\v ⇒ 11 ; vertical tab, C-k
?\f ⇒ 12 ; formfeed character, C-l
?\r ⇒ 13 ; carriage return, RET, C-m
?\e ⇒ 27 ; escape character, ESC, C-[
?\s ⇒ 32 ; space character, SPC
?\\ ⇒ 92 ; backslash character, \
?\d ⇒ 127 ; delete character, DEL?Q
81
let reference
- Use
letfor local variables
(setq y 2)
⇒ 2
(let ((y 1)
(z y)) ; 'z' is bound to the old value of 'y'
(list y z))
⇒ (1 2)
(let* ((y 1)
(z y)) ; Use the just-established value of y.
(list y z))
⇒ (1 1)(interactive) reference
Argument-List(&optional, &rest) discussion
- Binds
aandbto the first two actual arguments, which are required. - If one or two more arguments are provided,
canddare bound to them respectively; - Any arguments after the first four are collected into a list and
eis bound to that list.
(funcall (lambda (n) (1+ n)) ; One required:
1) ; requires exactly one argument.
⇒ 2
(funcall (lambda (n &optional n1) ; One required and one optional:
(if n1 (+ n n1) (1+ n))) ; 1 or 2 arguments.
1 2)
⇒ 3
(funcall (lambda (n &rest ns) ; One required and one rest:
(+ n (apply '+ ns))) ; 1 or more arguments.
1 2 3 4 5)
⇒ 15