From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Henrik Enberg Newsgroups: gmane.emacs.help Subject: Re: forward-sexp for strings Date: Thu, 10 Nov 2005 22:04:09 +0100 (CET) Message-ID: <20051110210409.AD5053F4F@rocksteady.printf.se> References: <87k6fg1ddq.fsf@thalassa.informatimago.com> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1131656796 29908 80.91.229.2 (10 Nov 2005 21:06:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 10 Nov 2005 21:06:36 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 10 22:06:35 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EaJao-0003kF-Ef for geh-help-gnu-emacs@m.gmane.org; Thu, 10 Nov 2005 22:04:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EaJan-0006X0-BM for geh-help-gnu-emacs@m.gmane.org; Thu, 10 Nov 2005 16:04:21 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EaJaf-0006Wv-GB for help-gnu-emacs@gnu.org; Thu, 10 Nov 2005 16:04:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EaJad-0006VT-VJ for help-gnu-emacs@gnu.org; Thu, 10 Nov 2005 16:04:13 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EaJad-0006VH-RU for help-gnu-emacs@gnu.org; Thu, 10 Nov 2005 16:04:11 -0500 Original-Received: from [81.228.8.164] (helo=pne-smtpout2-sn2.hy.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EaJad-0007an-IS for help-gnu-emacs@gnu.org; Thu, 10 Nov 2005 16:04:11 -0500 Original-Received: from rocksteady.printf.se (81.224.154.131) by pne-smtpout2-sn2.hy.skanova.net (7.2.060.1) id 436F401B0012C052 for help-gnu-emacs@gnu.org; Thu, 10 Nov 2005 22:04:09 +0100 Original-Received: by rocksteady.printf.se (Postfix, from userid 1000) id AD5053F4F; Thu, 10 Nov 2005 22:04:09 +0100 (CET) Original-To: help-gnu-emacs@gnu.org In-reply-to: (message from Roland Winkler on Thu, 10 Nov 2005 21:51:29 +0100) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:30971 Archived-At: > From: Roland Winkler > Date: Thu, 10 Nov 2005 21:51:29 +0100 > Pascal Bourguignon writes: >> Roland Winkler 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.