[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scan of regexps in emacs
From: |
Mattias Engdegård |
Subject: |
Re: Scan of regexps in emacs |
Date: |
Mon, 11 Mar 2019 09:39:20 +0100 |
11 mars 2019 kl. 04.37 skrev Paul Eggert <address@hidden>:
>
> Clément Pit-Claudel wrote:
>> On 10/03/2019 22.45, Paul Eggert wrote:
>>> - (while (string-match (concat "\\(^" comint-prompt-regexp
>>> + (while (string-match (concat "\\(" comint-prompt-regexp
>>> "\\)\\1+")
>>> string)
>> I think your change altered the meaning of that regexp.
>
> Yes and no. Yes, it altered the meaning of the regexp, but no it should fix a
> bug rather than introduce one because comint-prompt-regexp in practice always
> seems to be anchored to a line start. For example, comint-prompt-regexp
> defaults to "^", which meant that the above code's entire regexp was this:
>
> \(^^\)\1+
One way would be to replace the "\\(^" prefix with "\\(?:^\\)\\(", which should
work whether or not comint-prompt-regexp begins with a ^. However, as you say,
comint-prompt-regexp always seems to include the ^ and I think it is used
elsewhere with the tacit assumption that it does, so the committed change
should be fine.