Function: mouse-posn-property
mouse-posn-property is a byte-compiled function defined in
mouse.el.gz.
Signature
(mouse-posn-property POS PROPERTY)
Documentation
Look for a property at click position.
POS may be either a buffer position or a click position like
those returned from event-start. 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.
Source Code
;; Defined in /usr/src/emacs/lisp/mouse.el.gz
(defun mouse-posn-property (pos property)
"Look for a property at click position.
POS may be either a buffer position or a click position like
those returned from `event-start'. 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)))
;; FIXME: When STR has a `category' property and there's another
;; `category' property at PT, we should probably disregard the
;; `category' property at PT while doing the (get-char-property
;; pt property w)!
(or (and str
(< (cdr str) (length (car str)))
(get-text-property (cdr str) property (car str)))
;; Mouse clicks in the fringe come with a position in
;; (nth 5). This is useful but is not exactly where we clicked, so
;; don't look up that position's properties!
(and pt (not (memq (posn-area pos)
'(left-fringe right-fringe
left-margin right-margin tab-bar)))
(get-char-property pt property w))))
(get-char-property pos property)))