From: David Kastrup <dak@gnu.org>
Subject: Re: Getting the click position in a string
Date: Wed, 26 Apr 2006 10:17:51 +0200 [thread overview]
Message-ID: <85fyk0rbrk.fsf@lola.goethe.zz> (raw)
In-Reply-To: <85fyk2ugle.fsf@lola.goethe.zz> (David Kastrup's message of "Tue, 25 Apr 2006 11:53:01 +0200")
[-- Attachment #1: Type: text/plain, Size: 800 bytes --]
David Kastrup <dak@gnu.org> writes:
> Hi,
>
> I am trying to fix mouse.el so that it can heed follow-link properties
> in display strings. But it does not appear that the mouse click info
> gives the requisite position information: there is posn-string, and
> there is posn-point, but it does not look like there is
> posn-string-pos or whatever else which would be able to pinpoint the
> actual position within a string that is used as a display property or
> before-string or after-string.
>
> Consequently, one can't fetch the text property at the position of the
> click in such a string.
>
> Am I wrong here?
On another tangent, is this change ok? For implementing follow-link,
I need to take a look at the follow-link binding in the keymap of a
click, not the binding of the click itself.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2081 bytes --]
*** help.el 25 Mar 2006 20:49:31 +0100 1.308
--- help.el 26 Apr 2006 10:08:16 +0200
***************
*** 525,541 ****
(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))
--- 525,542 ----
(princ string)))))
nil)
! (defun string-key-binding (event &optional key)
! "With some string EVENT, 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))
***************
*** 544,550 ****
(< 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)
--- 545,551 ----
(< 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 (or key event))))))
defn))
(defun help-key-description (key untranslated)
[-- Attachment #3: Type: text/plain, Size: 340 bytes --]
Incidentally, this function looks faulty: it should search the keymap
_and_ the local-map property (in _that_ order) instead of searching at
most one of the two, even if that search would fail.
Apart from fixing it and adding an optional key argument, is help.el
the right place for it?
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
[-- Attachment #4: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2006-04-26 8:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-25 9:53 Getting the click position in a string David Kastrup
2006-04-25 14:36 ` Kim F. Storm
2006-04-25 14:55 ` David Kastrup
2006-04-26 8:13 ` Kim F. Storm
2006-04-26 8:17 ` David Kastrup [this message]
2006-04-26 11:32 ` Kim F. Storm
2006-04-26 11:56 ` David Kastrup
2006-04-26 12:52 ` David Kastrup
2006-04-26 12:54 ` David Kastrup
2006-04-26 13:58 ` Stefan Monnier
2006-04-27 12:08 ` David Kastrup
2006-04-27 16:05 ` Stefan Monnier
2006-04-27 18:33 ` David Kastrup
2006-04-27 21:24 ` Stefan Monnier
2006-04-27 21:39 ` David Kastrup
2006-04-28 16:16 ` Stefan Monnier
2006-04-29 21:55 ` David Kastrup
2006-04-29 23:33 ` Stefan Monnier
2006-04-30 21:55 ` David Kastrup
2006-05-01 0:48 ` Stefan Monnier
2006-05-01 5:55 ` David Kastrup
2006-05-01 12:52 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85fyk0rbrk.fsf@lola.goethe.zz \
--to=dak@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.