Function: posnp

posnp is a byte-compiled function defined in subr.el.gz.

Signature

(posnp OBJ)

Documentation

Return non-nil if OBJ appears to be a valid posn object specifying a window.

A posn object is returned from functions such as event-start. If OBJ is a valid posn object, but specifies a frame rather than a window, return nil.

Probably introduced at or before Emacs version 24.3.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
;;;; Extracting fields of the positions in an event.

(defun posnp (obj)
  "Return non-nil if OBJ appears to be a valid `posn' object specifying a window.
A `posn' object is returned from functions such as `event-start'.
If OBJ is a valid `posn' object, but specifies a frame rather
than a window, return nil."
  ;; FIXME: Correct the behavior of this function so that all valid
  ;; `posn' objects are recognized, after updating other code that
  ;; depends on its present behavior.
  (and (windowp (car-safe obj))
       (atom (car-safe (setq obj (cdr obj))))                ;AREA-OR-POS.
       (integerp (car-safe (car-safe (setq obj (cdr obj))))) ;XOFFSET.
       (integerp (car-safe (cdr obj)))))                     ;TIMESTAMP.