Function: vc-default-mode-line-string
vc-default-mode-line-string is a byte-compiled function defined in
vc-hooks.el.gz.
Signature
(vc-default-mode-line-string BACKEND FILE)
Documentation
Return a string for vc-mode-line to put in the mode line for FILE.
Format:
"BACKEND-REV" if the file is up-to-date
"BACKEND:REV" if the file is edited (or locked by the calling user)
"BACKEND:LOCKER:REV" if the file is locked by somebody else
"BACKEND@REV" if the file was locally added
"BACKEND!REV" if the file contains conflicts or was removed
"BACKEND?REV" if the file is under VC, but is missing
This function assumes that the file is registered.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-hooks.el.gz
(defun vc-default-mode-line-string (backend file)
"Return a string for `vc-mode-line' to put in the mode line for FILE.
Format:
\"BACKEND-REV\" if the file is up-to-date
\"BACKEND:REV\" if the file is edited (or locked by the calling user)
\"BACKEND:LOCKER:REV\" if the file is locked by somebody else
\"BACKEND@REV\" if the file was locally added
\"BACKEND!REV\" if the file contains conflicts or was removed
\"BACKEND?REV\" if the file is under VC, but is missing
This function assumes that the file is registered."
(let* ((backend-name (symbol-name backend))
(state (vc-state file backend))
(state-echo nil)
(face nil)
(rev (vc-working-revision file backend)))
(propertize
(cond ((or (eq state 'up-to-date)
(eq state 'needs-update))
(setq state-echo "Up to date file")
(setq face 'vc-up-to-date-state)
(concat backend-name "-" rev))
((stringp state)
(setq state-echo (concat "File locked by" state))
(setq face 'vc-locked-state)
(concat backend-name ":" state ":" rev))
((eq state 'added)
(setq state-echo "Locally added file")
(setq face 'vc-locally-added-state)
(concat backend-name "@" rev))
((eq state 'conflict)
(setq state-echo "File contains conflicts after the last merge")
(setq face 'vc-conflict-state)
(concat backend-name "!" rev))
((eq state 'removed)
(setq state-echo "File removed from the VC system")
(setq face 'vc-removed-state)
(concat backend-name "!" rev))
((eq state 'missing)
(setq state-echo "File tracked by the VC system, but missing from the file system")
(setq face 'vc-missing-state)
(concat backend-name "?" rev))
(t
;; Not just for the 'edited state, but also a fallback
;; for all other states. Think about different symbols
;; for 'needs-update and 'needs-merge.
(setq state-echo "Locally modified file")
(setq face 'vc-edited-state)
(concat backend-name ":" rev)))
'face face
'help-echo (concat state-echo " under the " backend-name
" version control system"))))