From b40e435f539fdac0c9f4dfe70fbda26a70f30da2 Mon Sep 17 00:00:00 2001 From: Sean Farley Date: Thu, 28 Sep 2023 21:19:22 -0700 Subject: [PATCH] feat(mu4e): add space-right argument to `+mu4e-normalised-icon' This allows a tiny (but equal) amount of space to the right of the icon. In the next patch, we'll use this for some icons in the modeline. --- modules/email/mu4e/autoload/email.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/email/mu4e/autoload/email.el b/modules/email/mu4e/autoload/email.el index c9c65b586..42e356a18 100644 --- a/modules/email/mu4e/autoload/email.el +++ b/modules/email/mu4e/autoload/email.el @@ -113,7 +113,7 @@ will also be the width of all other printable characters." (insert str) (car (window-text-pixel-size))))) -(cl-defun +mu4e-normalised-icon (name &key set color height v-adjust) +(cl-defun +mu4e-normalised-icon (name &key set color height v-adjust space-right) "Convert :icon declaration to icon" (let* ((icon-set (intern (concat "nerd-icons-" (or set "faicon")))) (v-adjust (or v-adjust 0.02)) @@ -125,8 +125,10 @@ will also be the width of all other printable characters." (space-width (+mu4e--get-string-width " ")) (space-factor (- 2 (/ (float icon-width) space-width))) ;; always pad the left - (space-left (propertize " " 'display `(space . (:width ,space-factor))))) - (format "%s%s" space-left icon))) + (space-left (propertize " " 'display `(space . (:width ,space-factor)))) + ;; optionally pad the right + (space-right (if space-right space-left ""))) + (format "%s%s%s" space-left icon space-right))) ;; Set up all the fancy icons ;;;###autoload