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."
  (pcase-let* ((backend-name (symbol-name backend))
               (state (vc-state file backend))
               (rev (vc-working-revision file backend))
               (`(,state-echo ,face ,indicator)
                (vc-mode-line-state state))
               (state-string (concat (unless (eq vc-display-status 'no-backend)
                                       backend-name)
                                     indicator rev)))
    (propertize state-string 'face face 'help-echo
                (concat state-echo " under the " backend-name
                        " version control system"))))