[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3c58443: Only show "2x entries" i vc log buffers if needed
From: |
Lars Ingebrigtsen |
Subject: |
master 3c58443: Only show "2x entries" i vc log buffers if needed |
Date: |
Tue, 19 Jan 2021 11:26:09 -0500 (EST) |
branch: master
commit 3c584438552f8d01651d7b9358eae5ce8da81fae
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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).
---
lisp/vc/vc.el | 42 +++++++++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 6c96d8c..bc9f112 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2392,6 +2392,7 @@ If it contains `file', show short logs for files.
Not all VC backends support short logs!")
(defvar log-view-vc-fileset)
+(defvar log-view-message-re)
(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.
@@ -2401,21 +2402,32 @@ Does nothing if IS-START-REVISION is non-nil, or if
LIMIT is nil,
or if PL-RETURN is `limit-unsupported'."
(when (and limit (not (eq 'limit-unsupported pl-return))
(not is-start-revision))
- (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")))
+ (let ((entries 0))
+ (goto-char (point-min))
+ (while (re-search-forward log-view-message-re nil t)
+ (cl-incf entries))
+ ;; If we got fewer entries than we asked for, then displaying
+ ;; the "more" buttons isn't useful.
+ (when (>= entries limit)
+ (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")))))
(defun vc-print-log-internal (backend files working-revision
&optional is-start-revision limit type)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 3c58443: Only show "2x entries" i vc log buffers if needed,
Lars Ingebrigtsen <=