From 386000d47fe7d64a26a9a1d3089c5689984b0ea3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 28 Feb 2019 14:55:49 -0500 Subject: [PATCH] Hide checker segment when disabled/empty For buffers that don't have either mode enabled or a valid checker present. --- doom-modeline-segments.el | 48 ++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index 5a1eafd..e8dab97 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -831,29 +831,31 @@ icons." `(,doom-modeline--flymake-icon . ,doom-modeline--flymake-text)) ((bound-and-true-p flycheck-mode) `(,doom-modeline--flycheck-icon . ,doom-modeline--flycheck-text))))) - (let ((icon (car seg)) - (text (cdr seg))) - (concat - (propertize (if vc-mode " " " ") - 'face (if active 'mode-line 'mode-line-inactive)) - (if active - (concat icon - (when (and icon text) doom-modeline-vspc) - text) - (concat - (when icon - (propertize icon - 'face - (if doom-modeline-icon - `(:height - ,(doom-modeline-icon-height 1.3) - :family - ,(all-the-icons-icon-family icon) - :inherit mode-line-inactive) - 'mode-line-inactive))) - (when (and icon text) doom-modeline-inactive-vspc) - (when text (propertize text 'face 'mode-line-inactive)))) - (propertize " " 'face (if active 'mode-line 'mode-line-inactive)))))) + (if seg + (let ((icon (car seg)) + (text (cdr seg))) + (concat + (propertize (if vc-mode " " " ") + 'face (if active 'mode-line 'mode-line-inactive)) + (if active + (concat icon + (when (and icon text) doom-modeline-vspc) + text) + (concat + (when icon + (propertize icon + 'face + (if doom-modeline-icon + `(:height + ,(doom-modeline-icon-height 1.3) + :family + ,(all-the-icons-icon-family icon) + :inherit mode-line-inactive) + 'mode-line-inactive))) + (when (and icon text) doom-modeline-inactive-vspc) + (when text (propertize text 'face 'mode-line-inactive)))) + (propertize " " 'face (if active 'mode-line 'mode-line-inactive)))) + ""))) ;;