Function: icons--create

icons--create is a byte-compiled function defined in icons.el.gz.

Signature

(icons--create ARG &rest ARGS)

Implementations

(icons--create (TYPE (eql 'text)) ICON KEYWORDS) in `icons.el'.

Undocumented

(icons--create (TYPE (eql 'symbol)) ICON KEYWORDS) in `icons.el'.

Undocumented

(icons--create (TYPE (eql 'emoji)) ICON KEYWORDS) in `icons.el'.

Undocumented

(icons--create (TYPE (eql 'image)) ICON KEYWORDS) in `icons.el'.

Undocumented

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/icons.el.gz
(cl-defmethod icons--create ((_type (eql 'image)) icon keywords)
  (let* ((file (if (file-name-absolute-p icon)
                   icon
                 (and (fboundp 'image-search-load-path)
                      (image-search-load-path icon))))
         (file-exists (and (stringp file) (file-readable-p file))))
    (and file-exists
         (display-images-p)
         (fboundp 'image-supported-file-p)
         (image-supported-file-p file)
         (propertize
          " " 'display
          (let ((props
                 (append
                  (if-let ((height (plist-get keywords :height)))
                      (list :height (if (eq height 'line)
                                        (window-default-line-height)
                                      height)))
                  (if-let ((width (plist-get keywords :width)))
                      (list :width (if (eq width 'font)
                                       (default-font-width)
                                     width)))
                  '(:scale 1)
                  (if-let ((rotation (plist-get keywords :rotation)))
                      (list :rotation rotation))
                  (if-let ((margin (plist-get keywords :margin)))
                      (list :margin margin))
                  (list :ascent (if (plist-member keywords :ascent)
                                    (plist-get keywords :ascent)
                                  'center)))))
            (apply 'create-image file nil nil props))))))