emacs-devel
[Top][All Lists]
Advanced

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

Missing display object API...


From: David Kastrup
Subject: Missing display object API...
Date: Tue, 29 Aug 2006 11:29:14 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Hi,

I just took a look at making use of the new `posn-object' and similar
functions in order to make preview-latex more efficient and, well,
found that it does not yet help.

There are a couple of instances of code like

    (overlay-put ov 'preview-map
                 (preview-make-clickable
                  nil nil nil
                  `(lambda(event) (interactive "e")
                     (preview-toggle ,ov 'toggle event))
                  `(lambda(event) (interactive "e")
                     (preview-context-menu ,ov event))))

Now instead of creating individual lambda functions, it would be nice
to write something like

    (overlay-put ov 'preview-map
                 (preview-make-clickable
                  nil nil nil
                  (lambda(event) (interactive "e")
                     (preview-toggle (posn-overlay (event-start event)
                                        'toggle event))
                  (lambda(event) (interactive "e")
                     (preview-context-menu (posn-overlay (event-start event)
                        event))))

However, it turns out that we can't get back to the overlay from
`posn-object': it merely returns the string or image used as display,
before-string or after-string property of the overlay.

Maybe one should have something like `posn-object-overlay' returning
#<some overlay>
for a click from an overlay, and something like
`posn-object-type'
returning 'after-string, 'before-string or 'display
for a click on an overlay or text property inherited stuff?

The rest of the coordinates for a text property can be gotten with
(window-buffer (posn-buffer ...)) and (posn-point ...) when necessary.

But for an overlay, most bets are off, unless we want to cycle
overlays-at searching for the origin.  And this will not work reliably
if there are several overlays using the same string or image, or of
the buffer changed since the click.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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