[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make-field suggestion
From: |
Jerry James |
Subject: |
Re: make-field suggestion |
Date: |
Wed, 08 Sep 2004 17:26:22 -0500 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (chayote, linux) |
Miles Bader <address@hidden> wrote:
> I think some attention should be paid to the issue of creating
> text-property fields vs. overlay fields -- both are useful in different
> circumstances, so any `make-field' function should allow creating both
> (or there should be multiple `make...field' functions).
That makes sense. How about something like this?
(defun make-field (from to value &optional buffer front-advance rear-advance
use-text-props)
"Make a field with value VALUE over the range [FROM, TO) in BUFFER.
If omitted, BUFFER defaults to the current buffer.
FROM and TO may be integers or markers.
The fifth argument, FRONT-ADVANCE, if non-nil, makes the front delimiter
advance when text is inserted there.
The sixth argument, REAR-ADVANCE, if non-nil, makes the rear delimiter
advance when text is inserted there.
If USE-TEXT-PROPS is non-nil, then the field is created using text properties.
Otherwise, it is created using an overlay."
(if use-text-props
(add-text-properties from to
(list 'field value
'front-sticky (not front-advance)
'rear-nonsticky (not rear-advance))
buffer)
(overlay-put (make-overlay from to buffer front-advance rear-advance)
'field value))
value)
I'm not sure what this function could usefully return. It ought to
return a reference to a field object, but there is no such thing.
Regards,
--
Jerry James
http://www.ittc.ku.edu/~james/