Function: vc-git-dir--stash-headers

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

Signature

(vc-git-dir--stash-headers)

Documentation

Return headers describing the current stashes.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-git.el.gz
(defun vc-git-dir--stash-headers ()
  "Return headers describing the current stashes."
  (list
   (concat
    (propertize "Stash      : " 'face 'vc-dir-header)
    (if-let* ((stash-list (vc-git-stash-list)))
        (let* ((len (length stash-list))
               (limit
                (if (integerp vc-git-show-stash)
                    (min vc-git-show-stash len)
                  len))
               (shown-stashes (cl-subseq stash-list 0 limit))
               (hidden-stashes (cl-subseq stash-list limit))
               (all-hideable (or (eq vc-git-show-stash t)
                                 (<= len vc-git-show-stash))))
          (concat
           ;; Button to toggle visibility.
           (if all-hideable
               (vc-git-make-stash-button nil limit limit)
             (vc-git-make-stash-button t vc-git-show-stash len))
           ;; Stash list.
           (when shown-stashes
             (concat
              (propertize "\n"
                          'vc-git-hideable all-hideable)
              (mapconcat
               (lambda (x)
                 (propertize x
                             'face 'vc-dir-header-value
                             'mouse-face 'highlight
                             'vc-git-hideable all-hideable
                             'help-echo vc-git-stash-list-help
                             'keymap vc-git-stash-map))
               shown-stashes
               (propertize "\n"
                           'vc-git-hideable all-hideable))))
           (when hidden-stashes
             (concat
              (propertize "\n"
                          'invisible t
                          'vc-git-hideable t)
              (mapconcat
               (lambda (x)
                 (propertize x
                             'face 'vc-dir-header-value
                             'mouse-face 'highlight
                             'invisible t
                             'vc-git-hideable t
                             'help-echo vc-git-stash-list-help
                             'keymap vc-git-stash-map))
               hidden-stashes
               (propertize "\n"
                           'invisible t
                           'vc-git-hideable t))))))
      (propertize "Nothing stashed"
		  'help-echo vc-git-stash-shared-help
                  'keymap vc-git-stash-shared-map
		  'face 'vc-dir-header-value)))))