aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-01-19 17:26:01 +0100
committerLars Ingebrigtsen2021-01-19 17:26:01 +0100
commit3c584438552f8d01651d7b9358eae5ce8da81fae (patch)
treed89d8737ab1cbc26509839f47ce9cf563e6b72df
parent5369b69bd86ee6d9565a82842cbeb37749cd5a6b (diff)
downloademacs-3c584438552f8d01651d7b9358eae5ce8da81fae.tar.gz
emacs-3c584438552f8d01651d7b9358eae5ce8da81fae.zip
Only show "2x entries" i vc log buffers if needed
* lisp/vc/vc.el (vc-print-log-setup-buttons): Only show the "more" buttons if we got more or equal to the number of entries we asked for (bug#18959).
-rw-r--r--lisp/vc/vc.el42
1 files changed, 27 insertions, 15 deletions
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 6c96d8ca7c4..bc9f11202b1 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2392,6 +2392,7 @@ If it contains `file', show short logs for files.
2392Not all VC backends support short logs!") 2392Not all VC backends support short logs!")
2393 2393
2394(defvar log-view-vc-fileset) 2394(defvar log-view-vc-fileset)
2395(defvar log-view-message-re)
2395 2396
2396(defun vc-print-log-setup-buttons (working-revision is-start-revision limit pl-return) 2397(defun vc-print-log-setup-buttons (working-revision is-start-revision limit pl-return)
2397 "Insert at the end of the current buffer buttons to show more log entries. 2398 "Insert at the end of the current buffer buttons to show more log entries.
@@ -2401,21 +2402,32 @@ Does nothing if IS-START-REVISION is non-nil, or if LIMIT is nil,
2401or if PL-RETURN is `limit-unsupported'." 2402or if PL-RETURN is `limit-unsupported'."
2402 (when (and limit (not (eq 'limit-unsupported pl-return)) 2403 (when (and limit (not (eq 'limit-unsupported pl-return))
2403 (not is-start-revision)) 2404 (not is-start-revision))
2404 (goto-char (point-max)) 2405 (let ((entries 0))
2405 (insert "\n") 2406 (goto-char (point-min))
2406 (insert-text-button "Show 2X entries" 2407 (while (re-search-forward log-view-message-re nil t)
2407 'action (lambda (&rest _ignore) 2408 (cl-incf entries))
2408 (vc-print-log-internal 2409 ;; If we got fewer entries than we asked for, then displaying
2409 log-view-vc-backend log-view-vc-fileset 2410 ;; the "more" buttons isn't useful.
2410 working-revision nil (* 2 limit))) 2411 (when (>= entries limit)
2411 'help-echo "Show the log again, and double the number of log entries shown") 2412 (goto-char (point-max))
2412 (insert " ") 2413 (insert "\n")
2413 (insert-text-button "Show unlimited entries" 2414 (insert-text-button
2414 'action (lambda (&rest _ignore) 2415 "Show 2X entries"
2415 (vc-print-log-internal 2416 'action (lambda (&rest _ignore)
2416 log-view-vc-backend log-view-vc-fileset 2417 (vc-print-log-internal
2417 working-revision nil nil)) 2418 log-view-vc-backend log-view-vc-fileset
2418 'help-echo "Show the log again, including all entries"))) 2419 working-revision nil (* 2 limit)))
2420 'help-echo
2421 "Show the log again, and double the number of log entries shown")
2422 (insert " ")
2423 (insert-text-button
2424 "Show unlimited entries"
2425 'action (lambda (&rest _ignore)
2426 (vc-print-log-internal
2427 log-view-vc-backend log-view-vc-fileset
2428 working-revision nil nil))
2429 'help-echo "Show the log again, including all entries")
2430 (insert "\n")))))
2419 2431
2420(defun vc-print-log-internal (backend files working-revision 2432(defun vc-print-log-internal (backend files working-revision
2421 &optional is-start-revision limit type) 2433 &optional is-start-revision limit type)