help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: efficiently viewing Unix timestamps as dates


From: Stefan Monnier
Subject: Re: efficiently viewing Unix timestamps as dates
Date: Tue, 24 May 2011 20:01:21 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> I was definitely not paying careful attention to that discussion when it
> happened on emacs-devel.  Can you give some references so I can catch up
> with what needs to be done, since "display" and "properties" return too
> many matches?  Even if I don't work on it I can at least understand the
> history.

The idea is the following:

We add a notion of "plane" to text-properties.  So, for example,
font-lock would set the `face' property (and any other property it feels
like setting) in the `font-lock' plane.  When font-lock needs to erase
the properties it has set, it just erases the `font-lock' plane which
guarantees that all the properties in that plane are removed (so you
don't need font-lock-extra-managed-props any more) and none of the
properties of other planes are affected (so you don't risk erasing
other packages's properties).

The text-property value at a particular point is the combination of the
value for each existing plane.  The combination can be done via `or' or
via some more sophisticated merge operator (the merge operator can be
specified on a per-property basis, so `face' can be merged differently
from `keymap' or `invisible').

The implementation would go something like:

(defun new-put-text-property (start end prop val &optional object)
  (let ((plane (if (consp prop) (prog1 (car prop) (setq prop (cdr prop))))))
    (old-put-text-property start end (cons plane prop) val object)
    (re-merge-property start end prop object)))

(defun re-merge-property (start end prop object)
  (for all i from start to end
    (old-put-text-property x (1+ x) prop
                           (funcall (merger-function prop)
                                    (collect-values-from-planes i prop)))))

-- Stefan


reply via email to

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