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

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

Re: Error-Free Navigation in Trees of Sub-Expressions (sexp) in Font-Loc


From: Nikolaj Schumacher
Subject: Re: Error-Free Navigation in Trees of Sub-Expressions (sexp) in Font-Locking Function Matchers
Date: Wed, 08 Oct 2008 16:15:49 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin)

Nordlöw <per.nordlow@gmail.com> wrote:

> What is the most clever way of checking when we are at the last sexp
> (forward-sexp will fail as mentioned above)?

You could use either:

(condition-case err
   (while t
     (forward-sexp)
     ...)
 (scan-error . nil))

to break the loop on an error, or:

(while (ignore-errors (forward-sexp) t)
  ...)

to get a nil when forward-sexp fails.


regards,
Nikolaj Schumacher




reply via email to

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