minmo : split staged and modified status

This commit is contained in:
bth 2026-06-02 21:55:02 -07:00
commit 6a650670ec

View file

@ -29,27 +29,23 @@
;; disk git ;; disk git
;; unmodified : ◻ : grey grey ;; unmodified : ◻ : grey grey
;; -- ;; --
;; modified/staged : ◱ : red orange ;; modified : ◱ : red orange
;; readonly/ignored : ◳ : green green ;; readonly/ignored : ◳ : green green
;; -- ;; --
;; new : ◰ : blue ;; staged : ◰ : blue
;; nofile/untracked : ◲ : blue red ;; nofile/untracked : ◲ : blue red
;; left ◱◰ : staged/new : indexed ;; left ◱◰ : modified/staged : indexed
;; right ◳◲ : ignored/untracked : unindexed ;; right ◳◲ : ignored/untracked : unindexed
;; top ◰◳ : new/ignored : clean ;; top ◰◳ : staged/ignored : ready
;; bottom ◱◲ : staged/untracked : dirty ;; bottom ◱◲ : modified/untracked : dirty
;; NOTE: "clean" is not quite right, since a newly added file, staged, is still
;; a dirty repo. but vc-state doesn't tell us whether a modified file is staged
;; or unstaged.
(defconst minmo-status-alist (defconst minmo-status-alist
'( '(
(unmodified . (((unicode . "◻") (ascii . ".")) . ((disk . nil) (git . nil)))) (unmodified . (((unicode . "◻") (ascii . ".")) . ((disk . nil) (git . nil))))
(modified/staged . (((unicode . "◱") (ascii . "*")) . ((disk . error) (git . warning)))) (modified . (((unicode . "◱") (ascii . "*")) . ((disk . error) (git . warning))))
(readonly/ignored . (((unicode . "◳") (ascii . "_")) . ((disk . success) (git . success)))) (readonly/ignored . (((unicode . "◳") (ascii . "_")) . ((disk . success) (git . success))))
(new . (((unicode . "◰") (ascii . "+")) . ((disk . link) (git . link)))) (staged . (((unicode . "◰") (ascii . "+")) . ((disk . link) (git . link))))
(nofile/untracked . (((unicode . "◲") (ascii . "!")) . ((disk . link) (git . error)))) (nofile/untracked . (((unicode . "◲") (ascii . "!")) . ((disk . link) (git . error))))
) )
"Unified symbol set for git and disk status with unicode and ascii variants "Unified symbol set for git and disk status with unicode and ascii variants
@ -136,13 +132,10 @@ single space.")
(cond (cond
((string= status " ") (minmo--status 'unmodified 'git)) ((string= status " ") (minmo--status 'unmodified 'git))
((string= status "!!") (minmo--status 'readonly/ignored 'git)) ((string= status "!!") (minmo--status 'readonly/ignored 'git))
((string= status "A ") (minmo--status 'new 'git))
((string= status "??") (minmo--status 'nofile/untracked 'git)) ((string= status "??") (minmo--status 'nofile/untracked 'git))
;; TODO: split modified/staged: ;; report modified whether partially staged or not:
;; staged: ((eq char-work ?M) (minmo--status 'modified 'git))
((memq char-index '(?M ?A)) (minmo--status 'modified/staged 'git)) ((memq char-index '(?M ?A)) (minmo--status 'staged 'git))
;; modified:
((and (eq char-index ?\s) (eq char-work ?M)) (minmo--status 'modified/staged 'git))
(t (minmo--status 'unmodified 'git)))))) (t (minmo--status 'unmodified 'git))))))
(defun minmo--update-vc-cache () (defun minmo--update-vc-cache ()
@ -221,7 +214,7 @@ single space.")
(defun minmo-disk-status () (defun minmo-disk-status ()
(cond (cond
((and buffer-file-name (buffer-modified-p)) ((and buffer-file-name (buffer-modified-p))
(minmo--status 'modified/staged 'disk)) (minmo--status 'modified 'disk))
;; for buffers with no file, like *scratch*: ;; for buffers with no file, like *scratch*:
((and (not buffer-file-name) (buffer-modified-p)) ((and (not buffer-file-name) (buffer-modified-p))
(minmo--status 'nofile/untracked 'disk)) (minmo--status 'nofile/untracked 'disk))