Subject: RE: [External] : Re: bug#27896: 25.2; `C-M-%' with `rectangle-mark-mode'

From: Drew Adams <[email-masked]>
Date: Tue, 9 Feb 2021 21:01:52 +0000

> > My approach is to do, for each zone,
> > what I currently do for the active region
> > as a whole, which is what vanilla Emacs
> > does for the buffer as a whole.
> >
> > IOW, instead of always using `point-min'
> > and `point-max' for _matching_, use the
> > limits of each zone.  IOW, just limit
> > matching to the search space.
> 
> Is this similar to how multiple major modes work?
> i.e.
> https://urldefense.com/v3/__https://www.emacswiki.org/emacs/MultipleMod
> es__;!!GqivPVa7Brio!L1gKnae4wuMn0F1d58axUCx08NTPDOSKxu5AJGwkvZB2eQ04tfi
> 0Xcu6DJtQGsq_$

Maybe, I don't know.  I've never looked into
`mmm-mode' or MuMaMo or any other such.  I
have a vague recollection/impression that
they may rely on text or overlay properties
in some way.  There's also Alan Mackenzie's
proposal a couple of years back for "islands"
as a way of handling multiple major modes.

As to "how", I said nothing really about the
actual how, beyond saying that the general
idea is to handle zone limits analogously to
how we currently handle buffer limits.

I didn't say "analogously", but perhaps I
should have.  My own approach (started but
not finished, and I'd pretty much need to
start over if I resumed) did, yes, amount to
more than an analogy.

In isearch+.el I do what I described, in
order to treat the active region the same
way vanilla Isearch treats the whole buffer:
bind variables at search start to the region
limits, and then replace `point-(min|max)'
with those variable values when non-nil.

My thoughts and initial attempts to handle
zones (~noncontiguous region) were to do
the same thing: limit search to the limits
of each zone.

(I currently use a filter to limit search
that way, but filtering is after the fact.
What's needed is to limit search _matching_.)