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. Mouse events in areas listed in mouse-event-areas-with-no-buffer-positions always return nil because such events do not contain buffer positions.

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.  Mouse events in areas listed in
`mouse-event-areas-with-no-buffer-positions' always return nil
because such events do not contain buffer positions."
  (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)))
            (and pt
                 (not (memq (posn-area pos)
                            ;; Don't return position of these mouse
                            ;; events because they don't describe the
                            ;; position of the click.
                            mouse-event-areas-with-no-buffer-positions))
                 (get-char-property pt property w))))
    (get-char-property pos property)))