[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: local keymap patch for key-binding
From: |
Chong Yidong |
Subject: |
Re: local keymap patch for key-binding |
Date: |
Sun, 10 Sep 2006 08:44:19 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
David Kastrup <address@hidden> writes:
> It does too little. Check out what read-key-sequence (defined in
> keyboard.c) does with regard to mouse events (EVENT_HAS_PARAMETERS).
> The problem is that read-key-sequence does such a load of other stuff
> that it is hard to extract the material and transfer it to
> key-binding.
>
> The problem is that keymaps may be provided by text properties and
> overlays, and by keymap properties on strings that display as the
> display or before-string or after-string properties of text properties
> or overlays.
I just verified that my patch truly works for keymaps on display
strings, text properties, and overlays. For example, with
(with-output-to-temp-buffer "Testo"
(set-buffer "Testo")
(erase-buffer)
(let* ((map (make-sparse-keymap))
(str (propertize "foostring" 'keymap map 'mouse-face 'highlight))
ovr)
(define-key map [mouse-1] 'delete-window)
(insert "1234567890")
(setq ovr (make-overlay 2 3))
(overlay-put ovr 'keymap map)
(overlay-put ovr 'mouse-face 'highlight)
(put-text-property 5 6 'display str)
(put-text-property 8 9 'keymap map)
(put-text-property 8 9 'mouse-face 'highlight)))
C-h k followed by mouse-1 on the overlay, display string, or text
propertized region all report the correct action for the given local
keymap. The reason is that the mouse event passed to `key-binding'
contains all the information you need to reconstruct the binding
directly (including whether or not the object we are looking at is a
buffer position or a string.)
So it seems like there's no problem.
- local keymap patch for key-binding, Chong Yidong, 2006/09/09
- Re: local keymap patch for key-binding, David Kastrup, 2006/09/09
- Re: local keymap patch for key-binding, Chong Yidong, 2006/09/09
- Re: local keymap patch for key-binding,
Chong Yidong <=
- Re: local keymap patch for key-binding, David Kastrup, 2006/09/10
- Re: local keymap patch for key-binding, Chong Yidong, 2006/09/10
- Re: local keymap patch for key-binding, David Kastrup, 2006/09/11
- Re: local keymap patch for key-binding, David Kastrup, 2006/09/11
- Re: local keymap patch for key-binding, Kim F. Storm, 2006/09/11
- Re: local keymap patch for key-binding, David Kastrup, 2006/09/11
- Re: local keymap patch for key-binding, David Kastrup, 2006/09/11
- Re: local keymap patch for key-binding, Kim F. Storm, 2006/09/11
- Re: local keymap patch for key-binding, David Kastrup, 2006/09/11
- Re: local keymap patch for key-binding, Chong Yidong, 2006/09/11