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

Knowing when a buffer is modified, when point is moved, ...

Howdy. I am building a mechanism that displays editable text and
non-editable textual representations of objects in a FRED buffer. The
non-text reps show in a different font to disginguish them from
editable text. I have two issues:

1) To insert text in the proper style I thought I'd use
buffer-insert-with-style, which takes a style vector. However, it
seemst the only way to get a style is via buffer-get-style, which
assumes I've already set the style! I'm now using buffer-set-font-spec
then buffer-insert to simulate a buffer-insert-with-font-spec, which
is really what I want. Would someone please tell me the accepted way
to do this?

2) I need *general* ways to be informed when certain editing
conditions take place:

a) when the cursor mark is moved within a non-editable
range (which I know via start and end marks I create for each
non-editable item) so I can extend the selection to cover the entire

b) when non-editable text is deleted so I can delete the
internally-stored objects corresponding to the deleted text.

My question here is: Are there a few functions that I can tap that
tell me when these conditions happen? I thought move-mark and
buffer-delete might be them but they're non-generic functions so I'd
have to advise them, which means my functions get called whenever they
take place (often). I'm also thinking my start and end marks'
positions might tell me if their text has been deleted. Anyone have
a good solution?