Function: widget-image-find

widget-image-find is a byte-compiled function defined in wid-edit.el.gz.

Signature

(widget-image-find IMAGE)

Documentation

Create a graphical button from IMAGE.

IMAGE should either already be an image, or be a file name sans extension (xpm, xbm, gif, jpg, or png) located in widget-image-directory or otherwise where find-image will find it.

Source Code

;; Defined in /usr/src/emacs/lisp/wid-edit.el.gz
(defun widget-image-find (image)
  "Create a graphical button from IMAGE.
IMAGE should either already be an image, or be a file name sans
extension (xpm, xbm, gif, jpg, or png) located in
`widget-image-directory' or otherwise where `find-image' will find it."
  (cond ((not (and image widget-image-enable (display-graphic-p)))
	 ;; We don't want or can't use images.
	 nil)
	((and (consp image)
	      (eq 'image (car image)))
	 ;; Already an image spec.  Use it.
	 image)
	((stringp image)
	 ;; A string.  Look it up in relevant directories.
	 (let* ((load-path (cons widget-image-directory load-path))
		specs)
	   (dolist (elt widget-image-conversion)
	     (dolist (ext (cdr elt))
	       (push (list :type (car elt) :file (concat image ext))
		     specs)))
           (find-image (nreverse specs))))
	(t
	 ;; Oh well.
	 nil)))