From: Drew Adams <drew.adams@oracle.com>
To: Alan Mackenzie <acm@muc.de>
Cc: Eli Zaretskii <eliz@gnu.org>, dgutov@yandex.ru, emacs-devel@gnu.org
Subject: RE: A vision for multiple major modes: some design notes
Date: Fri, 22 Apr 2016 10:04:42 -0700 (PDT) [thread overview]
Message-ID: <698fdcc8-c6f9-4e71-b5c0-202e6a5c71ba@default> (raw)
In-Reply-To: <20160422081344.GA1873@acm.fritz.box>
> > For search, at least, I don't see why you don't make use of
> > `isearch-filter-predicate'. That's what I do in my code, to
> > search only within (or without: complement) a set of zones
> > (~chain of islands). That seems simple and cheap.
>
> Thanks, I didn't know about that variable. But it may not be
> widely applicable enough.
I guess you're referring to point movements, among other things.
`isearch-filter-predicate', or similar, could presumably be made
so (more widely applicable). It is also used by `perform-replace'
(e.g. `query-replace'), BTW - not just search.
The point is that a predicate is more general than a regexp, and
it doesn't interfere with the use of a regexp (and vice versa).
> > > On the other hand, when a user does C-s or C-M-s, the Right Thing is
> > > surely to search the buffer as a whole, without regard to islands. We
> > > therefore need a flag which instructs the primitives how to behave
> > > when there are islands.
> >
> > `isearch-filter-predicate'. It can let code know whether
> > you are island-searching or not.
>
> That would only work for isearch.
Not if other code takes it into account. It only worked for
search until `perform-replace' started taking it into account.
> > > The user will, from time to time, delete the delimiters
> > > which define islands, and will insert other ones.
>
> > FWIW, markers as delimiters do not have that problem.
>
> I think they do. What happens when you have two islands bounded by four
> markers, and you delete a region containing the two middle markers;
>
> MaaaaaaaaaaaM MbbbbbbbbbbbbbM
> dddddddddddddddddd
>
> ? You might well not want the two islands a and b to be coalesced.
What's the alternative? If you're worried about different
modes (for example) for aaaaaa and bbbbbb then consider
keeping lists of markers per mode (or whatever) - like we
sometimes handle overlays using one or more lists.
Anyway, it was only a "FWIW". I use both text properties
and markers. There are advantages and disadvantages to
any implementation.
Also, where I use markers I allow extra info in a given
zone, in addition to the markers:
;; A "basic zone" is a list of two buffer positions followed
;; by a possibly empty list of extra information:
;; (POS1 POS2 . EXTRA).
IOW, some info is location-specific (buffer and position),
and other info (EXTRA) is zone-specific.
In your scenario, if a zone's second marker is deleted
then code could decide, based on whatever (including whether
or not aaaaaaaa and bbbbbbbb are in the same mode or have
compatible "EXTRA" island info), whether to: coalesce them,
delete them (as islands, not the text), or keep them separate.
The point is that the code can do anything. But yes, a
single marker does not record more than a buffer and a
position. I think, however, that the additional info
you are wanting to associate here is really (typically, at
least) info to associate with the island, and not info to
associate with an individual marker.
next prev parent reply other threads:[~2016-04-22 17:04 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-20 19:44 A vision for multiple major modes: some design notes Alan Mackenzie
2016-04-20 21:06 ` Drew Adams
2016-04-20 23:00 ` Drew Adams
2016-04-21 12:43 ` Alan Mackenzie
2016-04-21 14:24 ` Stefan Monnier
2016-04-23 2:20 ` zhanghj
2016-04-23 22:36 ` Dmitry Gutov
2016-04-21 16:05 ` Drew Adams
2016-04-21 16:31 ` Eli Zaretskii
[not found] ` <<64f1d39a-dfd0-44ca-86c1-b4d6104b5702@default>
[not found] ` <<83oa926i0e.fsf@gnu.org>
2016-04-21 16:59 ` Drew Adams
2016-04-21 19:55 ` Eli Zaretskii
[not found] ` <<<64f1d39a-dfd0-44ca-86c1-b4d6104b5702@default>
[not found] ` <<<83oa926i0e.fsf@gnu.org>
[not found] ` <<791d74d1-2b1d-4304-8e7e-d6c31af7aa41@default>
[not found] ` <<83eg9y68jy.fsf@gnu.org>
2016-04-21 20:26 ` Drew Adams
2016-04-20 22:27 ` Phillip Lord
2016-04-21 9:14 ` Alan Mackenzie
2016-04-22 12:45 ` Phillip Lord
2016-04-21 14:17 ` Eli Zaretskii
2016-04-21 21:33 ` Alan Mackenzie
2016-04-21 22:01 ` Drew Adams
2016-04-22 8:13 ` Alan Mackenzie
2016-04-22 17:04 ` Drew Adams [this message]
2016-04-22 9:04 ` Eli Zaretskii
2016-06-13 21:17 ` John Wiegley
2016-06-14 13:13 ` Alan Mackenzie
2016-06-14 16:27 ` John Wiegley
2016-04-21 22:19 ` Alan Mackenzie
2016-04-22 8:48 ` Eli Zaretskii
2016-04-22 22:35 ` Alan Mackenzie
2016-04-23 7:39 ` Eli Zaretskii
2016-04-23 17:02 ` Alan Mackenzie
2016-04-23 18:12 ` Eli Zaretskii
2016-04-23 18:26 ` Dmitry Gutov
2016-04-23 21:08 ` Alan Mackenzie
2016-04-24 6:29 ` Eli Zaretskii
2016-04-24 16:57 ` Alan Mackenzie
2016-04-24 19:59 ` Eli Zaretskii
2016-04-25 6:49 ` Andreas Röhler
2016-04-22 13:42 ` Andy Moreton
2016-04-23 17:14 ` Alan Mackenzie
2016-04-22 14:33 ` Dmitry Gutov
2016-04-22 18:58 ` Richard Stallman
2016-04-22 20:22 ` Alan Mackenzie
2016-04-23 12:27 ` Andreas Röhler
2016-04-23 12:38 ` Richard Stallman
2016-04-23 17:31 ` Alan Mackenzie
2016-04-24 9:22 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=698fdcc8-c6f9-4e71-b5c0-202e6a5c71ba@default \
--to=drew.adams@oracle.com \
--cc=acm@muc.de \
--cc=dgutov@yandex.ru \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.