minmo : add space before un/tracked status

This commit is contained in:
bth 2026-05-27 12:40:46 -07:00
commit 6a2f2f38f0

View file

@ -89,7 +89,7 @@ Uses the fast `vc-state' cache rather than synchronous git calls."
(let* ((state (vc-state file))) (let* ((state (vc-state file)))
(setq minmo--vc-branch-cache (minmo--fetch-vc-branch file)) (setq minmo--vc-branch-cache (minmo--fetch-vc-branch file))
(setq minmo--vc-tracked-cache (setq minmo--vc-tracked-cache
(pcase state (concat " " (pcase state
;; NOTE: vc-mode adds its own space prefix to vc-git-mode-line-string: ;; NOTE: vc-mode adds its own space prefix to vc-git-mode-line-string:
('up-to-date (minmo--status 'unmodified 'git)) ('up-to-date (minmo--status 'unmodified 'git))
('edited (minmo--status 'modified/staged 'git)) ('edited (minmo--status 'modified/staged 'git))
@ -97,7 +97,7 @@ Uses the fast `vc-state' cache rather than synchronous git calls."
('needs-merge (minmo--status 'modified/staged 'git)) ('needs-merge (minmo--status 'modified/staged 'git))
('conflict (minmo--status 'modified/staged 'git)) ('conflict (minmo--status 'modified/staged 'git))
(_ (minmo--status 'unmodified 'git)) (_ (minmo--status 'unmodified 'git))
)))) )))))
;; NOTE: :override replaces the function ;; NOTE: :override replaces the function
(advice-add #'vc-git-mode-line-string :override #'minmo--vc-tracked-status-override) (advice-add #'vc-git-mode-line-string :override #'minmo--vc-tracked-status-override)
@ -128,11 +128,11 @@ Uses the fast `vc-state' cache rather than synchronous git calls."
(let ((state (vc-git-state buffer-file-name))) (let ((state (vc-git-state buffer-file-name)))
(setq minmo--vc-branch-cache (minmo--fetch-vc-branch buffer-file-name)) (setq minmo--vc-branch-cache (minmo--fetch-vc-branch buffer-file-name))
(setq minmo--vc-untracked-cache (setq minmo--vc-untracked-cache
(pcase state (concat " " (pcase state
;; NOTE: we need the space prefix to match the output of vc-mode: ;; NOTE: we need the space prefix to match the output of vc-mode:
('unregistered (minmo--status 'nofile/untracked 'git)) ('unregistered (minmo--status 'nofile/untracked 'git))
('ignored (minmo--status 'readonly/ignored 'git)) ('ignored (minmo--status 'readonly/ignored 'git))
(_ nil)))))) (_ nil)))))))
;; NOTE: update the state when the file state changes ;; NOTE: update the state when the file state changes
;; this is the only remaining part of this approach which is somewhat hacky, in ;; this is the only remaining part of this approach which is somewhat hacky, in