help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: elisp questions for Advanced Closing brackets function


From: Drew Adams
Subject: RE: elisp questions for Advanced Closing brackets function
Date: Tue, 20 May 2008 11:24:44 -0700

> - How do I check if the character under (point) is a whitespace?

See function `looking-at'.

> - In an "if" statement, how do I put more than one expression 
> into the else case? Like this:
> (if condition (do-if-case) ((do-else-case) (do-more-else-case))

Just drop the parens around the else-case parts.

(if (some-test)
    (the-then-part)
  (an-else-part)
  (another-else-part)
  (and-another))

`if' allows any number of sexps in the else part. See also `cond' and `when'.

> - If I have a funcion like this:
> (defun adanced-closing-bracket (arg) ...)
> How do I compare (arg) to the character under point?

You can compare characters with `eq'. `char-after' picks up the character at a
given buffer position.

(eq arg (char-after (point)))

The onboard Elisp manual is your friend.
See also the onboard manual "Emacs Lisp Intro".





reply via email to

[Prev in Thread] Current Thread [Next in Thread]