Go to the previous, next section.

Review

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))
     @result{} 1
(cdr '(1 2 3 4 5 6 7))
     @result{} (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))
     @result{} (1 2 3 4)

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))
     @result{} (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 '(1 2 3))

(setcar triple '37)

triple
     @result{} (37 2 3)

(setcdr triple '("foo" "bar"))

triple
     @result{} (37 "foo" "bar")

progn
Evaluate each argument in sequence and then return the value of the last.

For example:

(progn 1 2 3 4)
     @result{} 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.

Takes four arguments:

    The string to search for.

    Optionally, the limit of the search.

    Optionally, what to do if the search fails, return  nil or an error message.

    Optionally, how many times to repeat the search; if negative, the search goes backwards.

kill-region
delete-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.

 delete-region removes the text between point and mark from the buffer and throws it away. You cannot get it back.

 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.

Go to the previous, next section.