unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Nordlöw <per.nordlow@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Error-Free Navigation in Trees of Sub-Expressions (sexp) in  Font-Locking Function Matchers
Date: Wed, 8 Oct 2008 07:30:56 -0700 (PDT)	[thread overview]
Message-ID: <a741603a-3235-4428-ad6a-232621182a60@g17g2000prg.googlegroups.com> (raw)
In-Reply-To: mailman.565.1223475359.25473.help-gnu-emacs@gnu.org

On 8 Okt, 16:15, Nikolaj Schumacher <m...@nschum.de> wrote:
> Nordlöw <per.nord...@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

Superb!

One can do everything in elisp, if you only know how ;)

/Nordlöw


      parent reply	other threads:[~2008-10-08 14:30 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
     [not found] ` <mailman.565.1223475359.25473.help-gnu-emacs@gnu.org>
2008-10-08 14:30   ` Nordlöw [this message]

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=a741603a-3235-4428-ad6a-232621182a60@g17g2000prg.googlegroups.com \
    --to=per.nordlow@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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).