[gnu.emacs.bug] Beginning of line Regex in selective-display

macrakis@UUNET.UU.NET (Stavros Macrakis) (12/29/88)

GNU Emacs 18.50.3 of Wed Aug 17 1988 on rigel (usg-unix-v)

In selective-display mode (used for instance in Outline mode), \r
represents a \n when the rest of the line is invisible.

However, the regex mechanism is not aware of this, so that "^" does
not match a hidden beginning-of-line.  This is often desirable, but
the opposite behavior is also desirable, that is, to allow "^" to
match \r as well as \n and beginning-of-buffer.

Simulating this with standard regexes means replacing "^" with
"\(^\|\r\)" (note that "[\n\r]" does not match beginning-of-buffer).
A simple regex like "^foo\|^bar" becomes "\(^\|\r\)foo\|\(^\|\r\)bar"
or alternatively "\(^\|\r\)\(foo\|bar\)", both of which are rather
daunting....

I can see two classes of solution:
  1. introduce a new regex construction
  2. parameterise the meaning of "^" by a global variable

The second seems handier for a variety of purposes, even though it's
not formally very pretty.

	-s