Function: image--get-image

image--get-image is a byte-compiled function defined in image.el.gz.

Signature

(image--get-image &optional POSITION)

Documentation

Return the image at POSITION.

POSITION can be a buffer position or a marker, and defaults to point.

Source Code

;; Defined in /usr/src/emacs/lisp/image.el.gz
(defun image--get-image (&optional position)
  "Return the image at POSITION.
POSITION can be a buffer position or a marker, and defaults to point."
  (let* ((image (get-char-property (or position (point)) 'display
                                   (when (markerp position)
                                     (marker-buffer position))))
         (image-car (car-safe image))
         (image
          (cond ((eq image-car 'image)
                 image)
                ;; The value of the display property could be a sliced
                ;; image of the form ((slice ...) (image ...)).
                ;; FIXME: can we have more than 2 members in the list,
                ;; so that the (image ...) part is NOT the cadr?
                ((and (listp image) (consp image-car))
                 (cadr image))
                (t nil))))
    (unless (eq (car-safe image) 'image)
      (error "No recognizable image under point"))
    image))