unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Henrik Enberg <henrik.enberg@telia.com>
Subject: Re: forward-sexp for strings
Date: Thu, 10 Nov 2005 22:04:09 +0100 (CET)	[thread overview]
Message-ID: <20051110210409.AD5053F4F@rocksteady.printf.se> (raw)
In-Reply-To: <m37jbg9qge.fsf@tfkp07.physik.uni-erlangen.de> (message from Roland Winkler on Thu, 10 Nov 2005 21:51:29 +0100)

> From: Roland Winkler <winkler@tfkp07.physik.uni-erlangen.de>
> Date: Thu, 10 Nov 2005 21:51:29 +0100

> Pascal Bourguignon <spam@mouse-potato.com> writes:
>> Roland Winkler <roland.winkler@physik.uni-erlangen.de> writes:
>>
>>> The function forward-sexp requires a buffer. Is there something
>>> similar for parsing strings? Of course, I can always use
>>> with-temp-buffer.
>>
>> (require 'cl)
>> (loop with s = "(sexp 1) (sexp 2) \"sexp 3\" sexp-4" 
>>       with e = 0
>>       for oe = (read-from-string s e)
>>       do (print (car oe))
>>       while (< (setf e (cdr oe)) (length s)))

> Do I need here the (require 'cl)? It seems to me that
> read-from-string is really the important thing in your example. And
> if this function obeys the current syntax-table (the doc string
> doesn't say anything about that) it should be exactly what I am
> looking for.

the `loop' macro is defined in cl.el, so you'll need it.  Personally,
I'd just use with-temp-buffer.  It's far more straightforward.

  reply	other threads:[~2005-11-10 21:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-10 18:43 forward-sexp for strings Roland Winkler
2005-11-10 20:01 ` Pascal Bourguignon
2005-11-10 20:51   ` Roland Winkler
2005-11-10 21:04     ` Henrik Enberg [this message]
     [not found]     ` <mailman.14777.1131656654.20277.help-gnu-emacs@gnu.org>
2005-11-10 21:16       ` Roland Winkler
2005-11-22 20:14   ` Stefan Monnier

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=20051110210409.AD5053F4F@rocksteady.printf.se \
    --to=henrik.enberg@telia.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).