diff options
author | Juri Linkov <juri@linkov.net> | 2022-10-24 10:33:41 +0300 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2022-10-24 10:33:41 +0300 |
commit | c06b5961ee447780fb5dc15ec8ed38d14c2398df (patch) | |
tree | dfb7c89d6281222438531ea7d9b5bb10eacf6c36 /lisp/emacs-lisp/icons.el | |
parent | 590086339f4082d85d670893364677efebe44b02 (diff) | |
download | emacs-c06b5961ee447780fb5dc15ec8ed38d14c2398df.tar.gz emacs-c06b5961ee447780fb5dc15ec8ed38d14c2398df.tar.bz2 emacs-c06b5961ee447780fb5dc15ec8ed38d14c2398df.zip |
* 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.
Diffstat (limited to 'lisp/emacs-lisp/icons.el')
-rw-r--r-- | lisp/emacs-lisp/icons.el | 25 |
1 files changed, 14 insertions, 11 deletions
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) |