From 9ed38a849d4fb7b7c9446fa7f557c8c107ea9741 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Wed, 20 Sep 2006 04:56:58 +0000 Subject: [PATCH] (mouse-posn-property): Improve doc string. (mouse-on-link-p): Change buffers for function calls on links. --- lisp/ChangeLog | 3 +++ lisp/mouse.el | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5ce0d6d18f2..736adf706fc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2006-09-20 David Kastrup + * mouse.el (mouse-posn-property): Improve doc string. + (mouse-on-link-p): Change buffers for function calls on links. + * menu-bar.el (clipboard-yank): bomb out in interactive use if buffer is read-only. diff --git a/lisp/mouse.el b/lisp/mouse.el index 2510888f468..18b16c6460d 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -776,7 +776,14 @@ If the click is in the echo area, display the `*Messages*' buffer." (defun mouse-posn-property (pos property) - "Look for a property at click position." + "Look for a property at click position. +POS may be either a buffer position or a click position like +those returned from `start-event'. If the click position is on +a string, the text property PROPERTY is examined. +If this is nil or the click is not on a string, then +the corresponding buffer position is searched for PROPERTY. +If PROPERTY is encountered in one of those places, +its value is returned." (if (consp pos) (let ((w (posn-window pos)) (pt (posn-point pos)) (str (posn-string pos))) @@ -835,9 +842,12 @@ at the same position." ((eq action 'mouse-face) (and (mouse-posn-property pos 'mouse-face) t)) ((functionp action) - ;; FIXME: This is wrong if the click is in a different buffer. + ;; FIXME: This seems questionable if the click is not in a buffer. ;; Should we instead decide that `action' takes a `posn'? - (funcall action (if (consp pos) (posn-point pos) pos))) + (if (consp pos) + (with-current-buffer (window-buffer (posn-window pos)) + (funcall action (posn-point pos))) + (funcall action pos))) (t action)))) (defun mouse-fixup-help-message (msg) -- 2.39.2