Function: vc-print-log-setup-buttons

vc-print-log-setup-buttons is a byte-compiled function defined in vc.el.gz.

Signature

(vc-print-log-setup-buttons WORKING-REVISION IS-START-REVISION LIMIT PL-RETURN)

Documentation

Insert at the end of the current buffer buttons to show more log entries.

In the new log, leave point at WORKING-REVISION (if non-nil). LIMIT is the current maximum number of entries shown, or the revision (string) before which to stop. Does nothing if IS-START-REVISION is non-nil and LIMIT is 1, or if LIMIT is nil, or if PL-RETURN is limit-unsupported.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
(defun vc-print-log-setup-buttons (working-revision is-start-revision limit pl-return)
  "Insert at the end of the current buffer buttons to show more log entries.
In the new log, leave point at WORKING-REVISION (if non-nil).
LIMIT is the current maximum number of entries shown, or the
revision (string) before which to stop.  Does nothing if
IS-START-REVISION is non-nil and LIMIT is 1, or if LIMIT is nil,
or if PL-RETURN is `limit-unsupported'."
  ;; LIMIT=1 is set by vc-annotate-show-log-revision-at-line
  ;; or by vc-print-root-log with current-prefix-arg=1.
  ;; In either case only one revision is wanted, no buttons.
  (when (and limit (not (eq 'limit-unsupported pl-return))
             (not (and is-start-revision
                       (eql limit 1))))
    (let ((entries 0))
      (goto-char (point-min))
      (while (re-search-forward log-view-message-re nil t)
        (incf entries))
      (if (or (stringp limit)
              (< entries limit))
          ;; The log has been printed in full.  Perhaps it started
          ;; with a copy or rename?
          ;; FIXME: We'd probably still want this button even when
          ;; vc-log-show-limit is customized to 0 (should be rare).
          (let* ((last-revision (log-view-current-tag (point-max)))
                 ;; XXX: Could skip this when vc-git-print-log-follow = t.
                 (name-changes
                  (condition-case nil
                      (vc-call-backend log-view-vc-backend
                                       'file-name-changes last-revision)
                    (vc-not-supported nil)))
                 (matching-changes
                  (cl-delete-if-not (lambda (f) (member f log-view-vc-fileset))
                                    name-changes :key #'cdr))
                 (old-names (delq nil (mapcar #'car matching-changes))))
            (when old-names
              (goto-char (point-max))
              (unless (looking-back "\n\n" (- (point) 2))
                (insert "\n"))
              (vc-print-log-renamed-add-button old-names log-view-vc-backend
                                               log-view-vc-fileset
                                               working-revision
                                               last-revision
                                               limit)))
        ;; Perhaps there are more entries in the log.
        (goto-char (point-max))
        (insert "\n")
        (insert-text-button
         "Show 2X entries"
         'action (lambda (&rest _ignore)
                   (vc-print-log-internal
                    log-view-vc-backend log-view-vc-fileset
                    working-revision nil (* 2 limit)))
         'help-echo
         "Show the log again, and double the number of log entries shown")
        (insert "    ")
        (insert-text-button
         "Show unlimited entries"
         'action (lambda (&rest _ignore)
                   (vc-print-log-internal
                    log-view-vc-backend log-view-vc-fileset
                    working-revision nil nil))
         'help-echo "Show the log again, including all entries")
        (insert "\n")))))