modeline: refactor vc segment

This commit is contained in:
Henrik Lissner 2016-10-04 23:48:10 +02:00
parent 099e6a9b52
commit 9e2fdc5aba

View file

@ -234,10 +234,9 @@ directory, the file name, and its state (modified, read-only or non-existent)."
(defun *vc () (defun *vc ()
"Displays the current branch, colored based on its state." "Displays the current branch, colored based on its state."
(when vc-mode (when vc-mode
(let ((backend vc-mode) (let ((state (vc-state buffer-file-name))
(state (vc-state buffer-file-name))
(face 'mode-line-inactive) (face 'mode-line-inactive)
(all-the-icons-scale-factor 1.2) (all-the-icons-scale-factor 1.0)
(all-the-icons-default-adjust -0.1)) (all-the-icons-default-adjust -0.1))
(concat (propertize " " 'face 'variable-pitch) (concat (propertize " " 'face 'variable-pitch)
(cond ((memq state '(edited added)) (cond ((memq state '(edited added))
@ -245,31 +244,25 @@ directory, the file name, and its state (modified, read-only or non-existent)."
(all-the-icons-octicon (all-the-icons-octicon
"git-branch" "git-branch"
:face face :face face
:height 1.2
:v-adjust -0.05)) :v-adjust -0.05))
((eq state 'needs-merge) ((eq state 'needs-merge)
(if active (setq face 'doom-modeline-info)) (if active (setq face 'doom-modeline-info))
(all-the-icons-octicon (all-the-icons-octicon "git-merge" :face face))
"git-merge"
:face face
:height 1.0))
((eq state 'needs-update) ((eq state 'needs-update)
(if active (setq face 'doom-modeline-warning)) (if active (setq face 'doom-modeline-warning))
(all-the-icons-octicon (all-the-icons-octicon "arrow-down" :face face))
"arrow-down"
:face face
:height 1.0))
((memq state '(removed conflict unregistered)) ((memq state '(removed conflict unregistered))
(if active (setq face 'doom-modeline-urgent)) (if active (setq face 'doom-modeline-urgent))
(all-the-icons-octicon (all-the-icons-octicon "alert" :face face))
"alert"
:face face
:height 1.0))
(t (t
(if active (setq face 'mode-line)) (if active (setq face 'mode-line))
(all-the-icons-octicon (all-the-icons-octicon
"git-branch" "git-branch"
:face face))) :face face
(propertize backend 'face (if active face)) :height 1.2
:v-adjust -0.05)))
(propertize vc-mode 'face (if active face))
" ")))) " "))))
(defvar-local doom--flycheck-err-cache nil "") (defvar-local doom--flycheck-err-cache nil "")