unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Nikolaj Schumacher <me@nschum.de>
To: Nordlöw <per.nordlow@gmail.com>
Cc: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <m2tzbnkwa2.fsf@nschum.de> (raw)
In-Reply-To: <bb2699ec-1d05-46eb-939b-d2387a56ac5a@p10g2000prf.googlegroups.com> ("Nordlöw"'s message of "Wed\, 8 Oct 2008 05\:24\:16 -0700 \(PDT\)")

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




  parent reply	other threads:[~2008-10-08 14:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-08 12:24 Error-Free Navigation in Trees of Sub-Expressions (sexp) in Font-Locking Function Matchers Nordlöw
2008-10-08 12:31 ` Nordlöw
2008-10-08 14:15 ` Nikolaj Schumacher [this message]
     [not found] ` <mailman.565.1223475359.25473.help-gnu-emacs@gnu.org>
2008-10-08 14:30   ` Nordlöw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2tzbnkwa2.fsf@nschum.de \
    --to=me@nschum.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=per.nordlow@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).