* lisp/tab-bar.el: Use customizable button icons (bug#51309, bug#51648)

* lisp/tab-bar.el (tab-bar--load-buttons): Use 'define-icon' to
define icons for tab-bar-new, tab-bar-close, tab-bar-menu-bar.
Also set tab-bar-new-button, tab-bar-close-button, tab-bar-menu-bar-button
to the specified icon-string.
(tab-bar-history-mode): Use 'define-icon' to
define icons for tab-bar-back, tab-bar-forward.
Also set tab-bar-back-button, tab-bar-forward-button
to the specified icon-string.

* lisp/emacs-lisp/icons.el (icons--create)<image>: Allow to easy
add new image props by using 'apply' on them.  Add :margin.
This commit is contained in:
Juri Linkov 2022-10-24 10:33:41 +03:00
parent 590086339f
commit c06b5961ee
2 changed files with 74 additions and 47 deletions

View file

@ -196,18 +196,21 @@ present if the icon is represented by an image."
(image-supported-file-p file)
(propertize
" " 'display
(if-let ((height (plist-get keywords :height)))
(create-image file
nil nil
:height (if (eq height 'line)
(let ((props
(append
(if-let ((height (plist-get keywords :height)))
(list :height (if (eq height 'line)
(window-default-line-height)
height)
:scale 1
:rotation (or (plist-get keywords :rotation) 0)
:ascent (if (plist-member keywords :ascent)
(plist-get keywords :ascent)
'center))
(create-image file))))))
height)))
'(: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))))))
(cl-defmethod icons--create ((_type (eql 'emoji)) icon _keywords)
(when-let ((font (and (display-multi-font-p)