ui/modeline: minor refactor

Add +modeline-segment-active-p predicate function.
This commit is contained in:
Henrik Lissner
2018-07-31 18:40:11 +02:00
parent b62e40b10b
commit b3f2a8cd54
2 changed files with 20 additions and 10 deletions

View File

@@ -316,8 +316,7 @@ buffers.")
(let ((face 'mode-line-inactive)
(active (active))
(all-the-icons-default-adjust -0.1))
(concat " "
(cond ((memq state '(edited added))
(concat (cond ((memq state '(edited added))
(if active (setq face 'doom-modeline-info))
(all-the-icons-octicon
"git-compare"
@@ -340,8 +339,7 @@ buffers.")
:v-adjust -0.05)))
" "
(propertize (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))
'face (if active face))
" ")))))
'face (if active face)))))))
(def-modeline-segment! +modeline-encoding
:on-hooks (after-revert-hook after-save-hook find-file-hook)
@@ -495,9 +493,10 @@ segment.")
+modeline-buffer-state
+modeline-buffer-id
" %2l:%c %p ")
'(+modeline-encoding
+modeline-major-mode
+modeline-vcs))
`(+modeline-encoding
+modeline-major-mode " "
mode-line-misc-info
(+modeline-vcs (" " +modeline-vcs " "))))
(def-modeline-format! :minimal
'(+modeline-matches " "