[Top][All Lists]

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

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

From: Stefan Monnier
Subject: Re: find-file-noselect needs save-match-data
Date: Thu, 14 Jun 2007 12:19:17 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

>>>>> "Herbert" == Herbert Euler <address@hidden> writes:

> If `find-file-noselect' is without `save-match-data', there will be a
> bug when `type-break-mode' is turned on.  To reproduce the bug, start
> emacs with the -Q option and execute the following expressions:

> (type-break-mode 1)
> (setq s "This is a sentence")
> (string-match "sen" s)
> (substring s (match-beginning 0) (match-end 0))

How do you execute it?

I tried M-x type-break-mode RET
and then M-: (progn (setq s "This is a sentence")
                    (string-match "sen" s)
                    (substring s (match-beginning 0) (match-end 0))) RET

and it worked just fine.  I guess what you did is to use a separate M-: (or
C-x C-e or M-C-x) for each line.  Then the result is completely expected:
there's a lot of code executed between each interactive command, so of
course the match data can't be assumed to be preserved.


reply via email to

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