From c06b5961ee447780fb5dc15ec8ed38d14c2398df Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 24 Oct 2022 10:33:41 +0300 Subject: * 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): Allow to easy add new image props by using 'apply' on them. Add :margin. --- lisp/emacs-lisp/icons.el | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/icons.el b/lisp/emacs-lisp/icons.el index a08ac7463ce..86c44830308 100644 --- a/lisp/emacs-lisp/icons.el +++ b/lisp/emacs-lisp/icons.el @@ -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) -- cgit v1.2.3