Function: vc-dir-headers

vc-dir-headers is a byte-compiled function defined in vc-dir.el.gz.

Signature

(vc-dir-headers BACKEND DIR)

Documentation

Display the headers in the *VC-Dir* buffer.

It calls the dir-extra-hints backend method to display backend-specific key binding hints. It calls the dir-extra-headers backend method to display backend-specific headers.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-dir.el.gz
(defun vc-dir-headers (backend dir)
  "Display the headers in the *VC-Dir* buffer.
It calls the `dir-extra-hints' backend method to display
backend-specific key binding hints.
It calls the `dir-extra-headers' backend method to display
backend-specific headers."
  (kill-local-variable 'vc-dir-async-header-values)
  (setq-local
   vc-dir--key-binding-hints
   (substitute-command-keys
    (concat
     (propertize "Act  " 'font-lock-face 'vc-dir-key-binding-hint-label)
     " "
     "(\\[vc-revert]) Revert, "
     "(\\[vc-dir-delete-file]) Delete, "
     "(\\[vc-dir-ignore]) Ignore, "
     ;; "this/these/all" is too long.
     "(\\[vc-next-action]/\\[vc-dir-root-next-action]) DWIM next this/all, "
     "(\\[vc-push]) Push"
     "\n"
     (propertize "Marks" 'font-lock-face 'vc-dir-key-binding-hint-label)
     "  "
     "(\\[vc-dir-mark]) Mark, "
     "(\\[vc-dir-unmark]) Unmark, "
     "(\\[vc-dir-unmark-all-files]) Unmark same state/dir, "
     "(\\[universal-argument] \\[vc-dir-unmark-all-files]) Unmark all"
     "\n"
     (propertize "View " 'font-lock-face 'vc-dir-key-binding-hint-label)
     "              "
     "(\\[vc-diff]) Diff, "
     "(\\[revert-buffer]) Refresh, "
     "(\\[vc-dir-hide-up-to-date]) Hide up-to-date"
     "\n"
     (vc-call-backend backend 'dir-extra-hints)
     "\n" (make-separator-line) "\n")))
  (concat
   (and vc-dir-show-key-binding-hints vc-dir--key-binding-hints)
   (propertize "VC backend : " 'face 'vc-dir-header)
   (propertize (format "%s" backend) 'face 'vc-dir-header-value)
   (let ((label (substitute-command-keys "\
[toggle hints (\\[vc-dir-toggle-hints])]")))
     (concat
      (propertize " " 'display
                  `(space
                    :align-to
                    ,(- (length (car (string-split vc-dir--key-binding-hints
                                                   "\n")))
                        (length label))))
      (with-temp-buffer
        (insert-text-button label 'action #'vc-dir-toggle-hints
                            'help-echo "Toggle display of key binding hints")
        (buffer-string))))
   "\n"
   (propertize "Working dir: " 'face 'vc-dir-header)
   (propertize (format "%s\n" (abbreviate-file-name dir))
               'face 'vc-dir-header-value)
   (vc-call-backend backend 'dir-extra-headers dir)
   "\n"
   (mapconcat (pcase-lambda (`(,header . ,_))
                (concat (propertize (format "%-11s: " header)
                                    'face 'vc-dir-header)
                        "\n"))
              vc-dir-async-header-values)))