www.delorie.com/gnu/docs/emacs-lisp-intro/emacs-lisp-intro_202.html   search  
Buy the book!

Programming in Emacs Lisp

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.6 Review

Here is a brief summary of some recently introduced functions.

Repeatedly evaluate the body of the expression so long as the first element of the body tests true. Then return nil. (The expression is evaluated only for its side effects.)

For example:

(let ((foo 2))
  (while (> foo 0)
    (insert (format "foo is %d.\n" foo))
    (setq foo (1- foo))))

     =>      foo is 2.
             foo is 1.
(The insert function inserts its arguments at point; the format function returns a string formatted from its arguments the way message formats its arguments; \n produces a new line.)

Search for a pattern, and if the pattern is found, move point to rest just after it.

Takes four arguments, like search-forward:

  1. A regular expression that specifies the pattern to search for.

  2. Optionally, the limit of the search.

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

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

Bind some variables locally to particular values, and then evaluate the remaining arguments, returning the value of the last one. While binding the local variables, use the local values of variables bound earlier, if any.

For example:

(let* ((foo 7)
      (bar (* 3 foo)))
  (message "`bar' is %d." bar))
     => `bar' is 21.

Return the position of the start of the text found by the last regular expression search.

Return t for true if the text after point matches the argument, which should be a regular expression.

Return t for true if point is at the end of the accessible part of a buffer. The end of the accessible part is the end of the buffer if the buffer is not narrowed; it is the end of the narrowed part if the buffer is narrowed.

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

For example:

(prog1 1 2 3 4)
     => 1

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003