emacs-devel
[Top][All Lists]
Advanced

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

Re: Matches for multiline regexps


From: Richard Stallman
Subject: Re: Matches for multiline regexps
Date: Sat, 18 Jun 2005 23:50:51 -0400

    I will take a look at it, but first a decision has to be made on how
    we treat overlapping matches.

When not displaying context, it should display each line that contains
any part of one or more matches.  It should not display any line more
than once.

When context lines are specified, it is less clear.  One idea is to
display each group of lines that contains a match, plus context around
it.  When there are multiple matches within one line, that line should
only appear once.  However, if a line is partly matched by more than
one multiline match, it is not clear what the right thing is, do I'd say
don't spend much time on it.

    I propose to have occur treat overlapping matches the same as the
    other Emacs search functions do, which is also the way occur behaved
    before Emacs 22.

That would be a step backwards.  Please do not make that change.

    `M-x occur RET 11 C-q C-j 11 RET' will find two matches, one on line 1
    and one on line 3.  Those are the only matches that
    `C-M-s 11 C-q C-j 11 RET C-s C-s C-s...' at beginning of buffer is
    going to find.

These commands do different jobs; the right thing for one is not the right
thing for the other.  Consistency is not the right goal here.

    To be consistent with the way it currently treats multiline
    overlapping matches, occur should show the line enough times to
    highlight all overlapping matches without overlap in their highlighting.

    For example, with a buffer containing only "111", with the current
    occur,  after `M-x occur RET 11 RET", the highlighting only finds a
    match at position 1, not at position 2. 

Ideally it should show the line once, but highlight all matches in
that line.

    I am starting to wonder whether the change from the Emacs 21 behavior
    in the multiline case was really intentional.

The code appears to be designed for uniline matches.  However, the
Emacs 21 behavior you described is not desirable behavior.  It was
merely how things happened to be.  Returning to that should not be
the goal.




reply via email to

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