Add ability to detect reverts to git prompt
This commit is contained in:
parent
b9852d2942
commit
9abf3bd469
14
init.el
14
init.el
@ -914,14 +914,24 @@ If no name is given, list all bookmarks instead."
|
||||
(when branch-status
|
||||
(push branch-status status-arr))
|
||||
(apply 'string status-arr)))
|
||||
(defun my/-eshell-prompt-git-get-operation ()
|
||||
"Return the current git operation. For example, a revert."
|
||||
(let ((git-dir (expand-file-name ".git" (vc-git-root default-directory))))
|
||||
(cond
|
||||
((file-exists-p (expand-file-name "REVERT_HEAD" git-dir))
|
||||
"REVERTING"))))
|
||||
(defun my/-eshell-prompt-git-status ()
|
||||
"Get git status for `my/-eshell-prompt-function'"
|
||||
(let ((branch (car (vc-git-branches)))
|
||||
(state (my/-eshell-prompt-git-state-chars)))
|
||||
(state (my/-eshell-prompt-git-state-chars))
|
||||
(operation (my/-eshell-prompt-git-get-operation)))
|
||||
(concat
|
||||
(propertize (concat " " branch) 'face '(:foreground "medium purple"))
|
||||
(unless (string-empty-p state)
|
||||
(propertize (concat " [" state "]") 'face '(:foreground "red"))))))
|
||||
(propertize (concat " [" state "]") 'face '(:foreground "red")))
|
||||
(when operation
|
||||
(concat " (" (propertize operation 'face
|
||||
'(:weight 'bold :foreground "yellow")) ")")))))
|
||||
(defun my/-eshell-prompt-vc-status ()
|
||||
"Get vc status for `my/-eshell-prompt-function'."
|
||||
(if-let (backend (vc-responsible-backend default-directory t))
|
||||
|
Loading…
Reference in New Issue
Block a user