[Top][All Lists]

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

Re: Question about copy-region-as-kill

From: Colin Walters
Subject: Re: Question about copy-region-as-kill
Date: 07 Apr 2002 03:46:33 -0400

[ No need to CC me, by the way; I read this list ]

On Sun, 2002-04-07 at 01:53, Miles Bader wrote:

> I don't think the concept of a `primary purpose' is all that useful,
> since it's rather objective; the original reason may be different that
> current thinking, and one person's view may differ from another's.

Fair enough.

> >From my point of view, the _most_ important thing about overlays is that
> they are distinct objects that are distinct from the text, and interact
> with text properties and other overlays.

Indeed.  But extents provide these same advantages.  And it should not
be difficult to write a text properties API on top of an extents
mechanism.  So extents give you the best of all possible worlds, AFAICS.

Since I have the feeling that we are at this point arguing by repeated
assertion, let me paste here the description of the problem I ran into
using overlays for ibuffer, when RMS originally asked me why I thought
overlays had a poor interface:

> [ RMS asks why the overlay interface is bad ]

I don't like it because it forces me to use a completely different API
depending on whether or not I want the properties to be specific to the
buffer or not, despite the fact that I want the properties to actually
be associated with the text, not a specific region of the buffer.

As an example, when you define an ibuffer column, you can optionally
specify properties along with the text.  For example:

(define-ibuffer-column mode (:inline t
                             ('mouse-face 'highlight
                              'keymap ibuffer-mode-name-map
                              'help-echo "mouse-2: filter by this mode"))
  (format "%s" mode-name))

This macroexpands to code that does:

(propertize (format "%s" mode-name) 'mouse-face 'highlight ...)

And then the ibuffer display function calls that bit of code, which
simply inserts the text, and it will have those associated properties. 
However, I *do* want those properties to be specific to the ibuffer

To achieve both effects, I could make the code macroexpand to something

(list (format "%s" mode-name) '(mouse-face highlight ...))

And then the ibuffer display algorithm could save the value of point,
insert the text, make an overlay between the old value of point, and
finally put the properties on that overlay.  But that's pretty ugly. 
And ugly code leads me to conclude that I have the wrong approach.

reply via email to

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