[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C-M-r and C-M-s asymmetric [was: C - marking code between braces]
From: |
Dieter Wilhelm |
Subject: |
C-M-r and C-M-s asymmetric [was: C - marking code between braces] |
Date: |
Tue, 12 Dec 2006 23:49:17 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) |
bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
> Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
>
>> Another idea for one level could be
>>
>> C-M-r [^{}]+
>> C-M-s
>>
>> but to my astonishment C-M-r does not skip to the char behind {!
>
> I think the key is here:
>
> ,----[ C-h f search-backward-regexp RET ]
> | [...]
> | Search backward from point for match for regular expression REGEXP.
> | Set point to the beginning of the match, and return point.
> | The match found is the one starting last in the buffer
> | and yet ending before the origin of the search.
> | [...]
> `----
Sorry Johan, I don't get it, the behaviour might be consistent with
the description above but the fact is that + should be greedy. Please
search with C-M-s for "o.*o" in the following line
hans otto otto otto hans
When you C-M-r wouldn't you expect to find the same matches? This is
clearly not the case and I can't imagine why.
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany