[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnu.emacs.help] display margins
From: |
Oliver Scholz |
Subject: |
Re: [gnu.emacs.help] display margins |
Date: |
Fri, 21 Dec 2001 22:33:56 +0100 |
* "Dave" == Dave Love <address@hidden> writes:
[...]
> The margins aren't useful for typical applications with the current
> API, as you found. That seems basically to be dictated by the
> redisplay code, which must display glyph contents either inline or
> in one margin as far as I remember. I suspect marginal stuff would
> best be done from a display list keyed by markers, but I don't know
> how that would fit into the redisplay and whether there are any
> applications for which you really want the current API.
> [I looked at porting an IDE thingy, written for XEmacs, which uses
> icons in the margins.]
Gerd Möllmann suggested in off-list mail to me that the "natural" way
to put text on the margin would be to use an overlay with a
before-string that has the according 'display property, analogous to
what is done for images with put-image.
This is fine for me.
I tried to put buttons on the margin. But unfortunately text there
does not seem to react on the mouse. I was going to send a bug-report,
but I had not yet found the time for it. Anyway: this is the code I
tried, that did not work but that *should* work IMHO.
(defun my-test ()
(interactive)
(message "hello"))
(let ((map (make-sparse-keymap)))
(define-key map [mouse-1] 'my-test)
(setq my-keymap map))
(setq my-string
(propertize "test"
'face '(:foreground "blue")
'mouse-face 'highlight
'keymap my-keymap))
(setq left-margin-width 5)
(set-window-buffer
(get-buffer-window (current-buffer)) (current-buffer)) ; updating the buffer
(setq my-overlay (make-overlay 1 10))
(overlay-put my-overlay 'before-string
(propertize "test" 'display `((margin left-margin) ,my-string)))
'oliver
--
Oliver Scholz 1 Nivôse an 210 de la Révolution
Taunusstr. 25
60329 Frankfurt a. M.
Tel. (069) 97 40 99 42