From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: Combining face and map stuff
Date: Mon, 04 Oct 2010 01:37:26 +0200 [thread overview]
Message-ID: <jwvsk0muahj.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <m3hbh4isk3.fsf@quimbies.gnus.org> (Lars Magne Ingebrigtsen's message of "Sat, 02 Oct 2010 16:21:32 +0200")
> Which reminds me of another thing. I would like to define some commands
> local to a region, which can be done with 'local-map in overlays or
> 'keymap in text properties. But can I combine them, too, in possibly
> overlapping regions, and get the aggregate keymap?
Here's an idea with which I've beeing toying:
- rather than have just one set of text-properties per char, make it
possible to have several. E.g. font-lock would use its own set of
text properties. One way to do that is that a `property' can now be
a cons whose car is a "plane" and whose cdr is a property.
So for example, the special font-lock-face (which currently gets
"mapped" to face' via char-property-alias-alist) would just be `face'
because font-lock would use (font-lock . face).
A property like `face' would really be equivalent to (nil . face).
- then you add property-specific merge functions. I.e. when looking up
`face' you'd get the merge of all the `face' properties of the various
text-property planes. You'd probably want those merge functions to be
written in Elisp and customizable. So merging `keymap' properties
becomes easy (well, it may benefit from multiple-keymap inheritance,
which is a completely different topic).
- now font-lock can erase all the properties of the `font-lock' plane
without worrying about erasing properties installed by other packages.
- to avoid calling Elisp code to merge things during text-property
lookups, the merge would take place in put-text-property (i.e. no need
to change the redisplay code at all).
- modifying a plane other than the default (nil) one could be considered
as "not modifying the buffer" (just like adding/removing overlays).
- we could obsolete char-property-alias-alist which is only ever used
by/for font-lock-face.
- maybe outline-minor-mode could use text-properties rather than
overlays to make text invisible (tho it would make it impossible(?) to
use outline-minor-mode in an indirect buffer without affecting the
base buffer and the other indirect buffers). So it might reduce the
need for overlays (which have the disadvantage of being
algorithmically slow/costly).
Stefan
next prev parent reply other threads:[~2010-10-03 23:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-02 14:21 Combining face and map stuff Lars Magne Ingebrigtsen
2010-10-02 16:21 ` Chong Yidong
2010-10-02 16:41 ` Lars Magne Ingebrigtsen
2010-10-03 2:04 ` Miles Bader
2010-10-03 4:16 ` Chong Yidong
2010-10-03 13:08 ` Lars Magne Ingebrigtsen
2010-10-03 23:37 ` Stefan Monnier [this message]
2010-10-04 7:56 ` Eli Zaretskii
2010-10-04 9:03 ` Miles Bader
2010-10-04 9:42 ` Eli Zaretskii
2010-10-05 0:12 ` Miles Bader
2010-10-05 23:43 ` Stefan Monnier
2010-10-06 3:57 ` Eli Zaretskii
2010-10-07 7:40 ` Stefan Monnier
2010-10-07 13:56 ` Eli Zaretskii
2010-10-07 18:08 ` Stefan Monnier
2010-10-12 19:09 ` Eli Zaretskii
2010-10-12 20:23 ` Stefan Monnier
2010-10-13 11:41 ` Eli Zaretskii
2010-10-13 12:42 ` Stefan Monnier
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvsk0muahj.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).