From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: find-file-noselect needs save-match-data Date: Fri, 08 Jun 2007 12:31:28 +0200 Message-ID: <87ejkmpwjj.fsf@kfs-lx.testafd.dk> References: <46643852.6070709@gmx.at> <46665AD7.7040706@gmx.at> <87k5ueq23m.fsf@kfs-lx.testafd.dk> <4669246B.2060801@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1181298764 9269 80.91.229.12 (8 Jun 2007 10:32:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2007 10:32:44 +0000 (UTC) Cc: herberteuler@hotmail.com, rms@gnu.org, Stefan Monnier , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 08 12:32:42 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Hwblq-0001Ch-6j for ged-emacs-devel@m.gmane.org; Fri, 08 Jun 2007 12:32:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hwblp-0005rg-J1 for ged-emacs-devel@m.gmane.org; Fri, 08 Jun 2007 06:32:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hwbll-0005ra-V4 for emacs-devel@gnu.org; Fri, 08 Jun 2007 06:32:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hwblk-0005rO-D8 for emacs-devel@gnu.org; Fri, 08 Jun 2007 06:32:36 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hwblk-0005rL-7B for emacs-devel@gnu.org; Fri, 08 Jun 2007 06:32:36 -0400 Original-Received: from mail-relay.sonofon.dk ([212.88.64.25]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Hwblj-0002w6-M0 for emacs-devel@gnu.org; Fri, 08 Jun 2007 06:32:36 -0400 Original-Received: (qmail 87186 invoked from network); 8 Jun 2007 10:32:33 -0000 Original-Received: from unknown (HELO kfs-lx.testafd.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 8 Jun 2007 10:32:33 -0000 In-Reply-To: <4669246B.2060801@gmx.at> (martin rudalics's message of "Fri\, 08 Jun 2007 11\:42\:03 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-detected-kernel: FreeBSD 4.6-4.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:72485 Archived-At: martin rudalics writes: >> It's quite the opposite IMO. "safe" can mean many things, whereas >> "nodata" clearly indicates that it doesn't set (or modify) match-data. > > "-nodata" is good. > >> But in practice, we should have a macro to encapsulate calls: >> >> (preserve-match-data (string-match ...)) > > This would violate referential transparency. Consider > > (defvar foobar "foobar") > > (defun foo () > (string-match "foo" foobar) > (match-string 0 foobar)) > > (defun bar () > (string-match "bar" foobar) > (preserve-match-data > (foo))) Well, I specifically intended the preserve-match-data to be used in "closed contexts" like (preserve-match-data (looking-at ...)) (preserve-match-data (string-match ...)) etc. -- Kim F. Storm http://www.cua.dk