From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philippe M. Coatmeur Newsgroups: gmane.emacs.help Subject: How to properly parse a buffer into a list ? Date: Mon, 11 Jun 2012 13:15:37 +0000 Organization: A noiseless patient Spider Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: dough.gmane.org 1339417516 23271 80.91.229.3 (11 Jun 2012 12:25:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2012 12:25:16 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 11 14:25:16 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Se3gK-0000KW-1Y for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Jun 2012 14:25:16 +0200 Original-Received: from localhost ([::1]:44937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Se3gJ-0007oN-Qa for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Jun 2012 08:25:15 -0400 Original-Path: usenet.stanford.edu!newsfeed.esat.net!feeder.news.heanet.ie!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 42 Injection-Info: mx04.eternal-september.org; posting-host="/tg5ZGRW9lHD7rFwAtm3dQ"; logging-data="8538"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180y7HBkRvGEQ6TG1kMQRmEGKr8kwb/fTQ=" User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/24.1 Mule/6.0 (HANACHIRUSATO) Cancel-Lock: sha1:gw4z4WbjAEUwu4F2UyshY9r7j/E= Original-Xref: usenet.stanford.edu gnu.emacs.help:192798 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85202 Archived-At: Hi ; I have this perl-script that prints email elements separated by the string : "|_|". When I start-process-shell-command it I get a buffer containing my elements, and I then parse this buffer using this function : (defun buffer-to-list (buf) "Make & return a list (of lists) LINES from lines in a buffer BUF" (with-current-buffer buf (save-excursion (goto-char (point-min)) (let ((lines '())) (while (not (eobp)) (push (split-string (buffer-substring (point) (point-at-eol)) "\|_\|") lines) (beginning-of-line 2)) lines)))) Problem is, this function moves in terms of lines (it puts evey single line in a list cell), but my elements can easily span over several lines, and I'd still wouldlike one such element to be a single list cell..? I'm trying to simplify it to ignore the notion of line, and just search for the separator string, like this : (with-current-buffer buf (goto-char (point-min)) (let ((cells '())) (while (not (eobp)) (push (buffer-substring (point) (re-search-forward "|_|")) cells)) cells)) But it always returns "string not found" (when I explicitly run (re-search-forward "|_|") in said buffer it founds it) so apparently I'm not positioning the point where it should be, so my question really is : What is the mecanics of search-looping through elements between a separator string ? Philippe