emacs-devel
[Top][All Lists]
Advanced

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

Re: feature request: text property to prevent font-locking


From: Alan Mackenzie
Subject: Re: feature request: text property to prevent font-locking
Date: Sun, 31 Aug 2014 21:43:24 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, All.

On Sun, Aug 31, 2014 at 03:57:14PM -0400, Stefan Monnier wrote:
> >> By, the way, these kinds of problems are the reason why I suggested
> >> adding "planes" to text-properties.
> >> It should be relatively easy to implement.
> > Sorry, that's too vague for me.  But I guess it further confirms that
> > I am not missing something simple.
> 
> I suggested that there be several planes of properties, so font-lock
> would place its properties in the plane `font-lock' while other packages
> can use their own plane.  Then you'd separately specify rules for how to
> merge the various planes (with rules that can be distinct for each kind
> of property).
> The merge of properties would not take place during redisplay but
> instead would take place when the properties are added/removed.
> 
> 
>         Stefan
> 

I think you mean this:

#########################################################################
From: Stefan Monnier <address@hidden>
To: address@hidden
Date: Mon, 04 Oct 2010 01:37:26 +0200
Subject: Re: Combining face and map stuff

> 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
#########################################################################

This might be "relatively simple" to implement, but relative to what,
I'm not sure.  ;-)

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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