[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find-file-noselect needs save-match-data

From: Kim F. Storm
Subject: Re: find-file-noselect needs save-match-data
Date: Fri, 08 Jun 2007 12:31:28 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

martin rudalics <address@hidden> 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 ...))


Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]