[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting the click position in a string
From: |
David Kastrup |
Subject: |
Re: Getting the click position in a string |
Date: |
Wed, 26 Apr 2006 14:54:20 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
David Kastrup <address@hidden> writes:
> Well, here is the current patch.
Uh, actually here.
*** help.el 25 Mar 2006 20:49:31 +0100 1.308
--- help.el 26 Apr 2006 14:09:59 +0200
***************
*** 525,550 ****
(princ string)))))
nil)
! (defun string-key-binding (key)
! "Value is the binding of KEY in a string.
! If KEY is an event on a string, and that string has a `local-map'
! or `keymap' property, return the binding of KEY in the string's keymap."
(let* ((defn nil)
! (start (when (vectorp key)
! (if (memq (aref key 0)
'(mode-line header-line left-margin right-margin))
! (event-start (aref key 1))
! (and (consp (aref key 0))
! (event-start (aref key 0))))))
(string-info (and (consp start) (nth 4 start))))
(when string-info
(let* ((string (car string-info))
(pos (cdr string-info))
! (local-map (and (>= pos 0)
! (< pos (length string))
! (or (get-text-property pos 'local-map string)
! (get-text-property pos 'keymap string)))))
! (setq defn (and local-map (lookup-key local-map key)))))
defn))
(defun help-key-description (key untranslated)
--- 525,554 ----
(princ string)))))
nil)
! (defun string-key-binding (event &optional key)
! "With some EVENT on a string, return the local binding of KEY.
! If EVENT is an event on a string, and that string has a `local-map'
! or `keymap' property, return the binding of KEY in the string's keymap.
! If KEY is not specified, it is taken from the event."
(let* ((defn nil)
! (start (when (vectorp event)
! (if (memq (aref event 0)
'(mode-line header-line left-margin right-margin))
! (event-start (aref event 1))
! (and (consp (aref event 0))
! (event-start (aref event 0))))))
(string-info (and (consp start) (nth 4 start))))
(when string-info
(let* ((string (car string-info))
(pos (cdr string-info))
! (maps '(keymap local-map))
! local-map)
! (when (and (>= pos 0)
! (< pos (length string)))
! (while (and maps (not defn))
! (when
! (setq local-map (get-text-property pos (pop maps) string))
! (setq defn (lookup-key local-map (or key event))))))))
defn))
(defun help-key-description (key untranslated)
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
- Getting the click position in a string, David Kastrup, 2006/04/25
- Re: Getting the click position in a string, Kim F. Storm, 2006/04/25
- Re: Getting the click position in a string, David Kastrup, 2006/04/26
- Re: Getting the click position in a string, Kim F. Storm, 2006/04/26
- Re: Getting the click position in a string, David Kastrup, 2006/04/26
- Re: Getting the click position in a string, David Kastrup, 2006/04/26
- Re: Getting the click position in a string,
David Kastrup <=
- Re: Getting the click position in a string, Stefan Monnier, 2006/04/26
- Re: Getting the click position in a string, David Kastrup, 2006/04/27
- Re: Getting the click position in a string, Stefan Monnier, 2006/04/27
- Re: Getting the click position in a string, David Kastrup, 2006/04/27
- Re: Getting the click position in a string, Stefan Monnier, 2006/04/27
- Re: Getting the click position in a string, David Kastrup, 2006/04/27
- Re: Getting the click position in a string, Stefan Monnier, 2006/04/28
- Re: Getting the click position in a string, David Kastrup, 2006/04/29
- Re: Getting the click position in a string, Stefan Monnier, 2006/04/29
- Re: Getting the click position in a string, David Kastrup, 2006/04/30