Next: search Exercises, Previous: defvar, Up: Cutting & Storing Text [Contents][Index]
Here is a brief summary of some recently introduced functions.
car
cdr
car
returns the first element of a list; cdr
returns the
second and subsequent elements of a list.
For example:
(car '(1 2 3 4 5 6 7)) ⇒ 1 (cdr '(1 2 3 4 5 6 7)) ⇒ (2 3 4 5 6 7)
cons
cons
constructs a list by prepending its first argument to its second
argument.
For example:
(cons 1 '(2 3 4)) ⇒ (1 2 3 4)
funcall
funcall
evaluates its first argument as a function. It passes its
remaining arguments to its first argument.
nthcdr
Return the result of taking CDR n times on a list. The “rest of the rest”, as it were.
For example:
(nthcdr 3 '(1 2 3 4 5 6 7)) ⇒ (4 5 6 7)
setcar
setcdr
setcar
changes the first element of a list; setcdr
changes the
second and subsequent elements of a list.
For example:
(setq triple (list 1 2 3)) (setcar triple '37) triple ⇒ (37 2 3) (setcdr triple '("foo" "bar")) triple ⇒ (37 "foo" "bar")
progn
Evaluate each argument in sequence and then return the value of the last.
For example:
(progn 1 2 3 4) ⇒ 4
save-restriction
Record whatever narrowing is in effect in the current buffer, if any, and restore that narrowing after evaluating the arguments.
search-forward
Search for a string, and if the string is found, move point. With a regular
expression, use the similar re-search-forward
. (See Regular Expression Searches, for an explanation of regular expression
patterns and searches.)
search-forward
and re-search-forward
take four arguments:
nil
or an error
message.
kill-region
delete-and-extract-region
copy-region-as-kill
kill-region
cuts the text between point and mark from the buffer and
stores that text in the kill ring, so you can get it back by yanking.
copy-region-as-kill
copies the text between point and mark into the
kill ring, from which you can get it by yanking. The function does not cut
or remove the text from the buffer.
delete-and-extract-region
removes the text between point and mark
from the buffer and throws it away. You cannot get it back. (This is not
an interactive command.)
Next: search Exercises, Previous: defvar, Up: Cutting & Storing Text [Contents][Index]