aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-09-06 12:15:33 +0100
committerSean Whitton2025-09-06 12:15:33 +0100
commit2ecced627bc6553003bc32e282629273d2f9c454 (patch)
treedadc83eaeafe25ac71136ca174f5703954c2b994
parent6c150961fd07e19b6c871d8963d6b9826ec8140f (diff)
downloademacs-2ecced627bc6553003bc32e282629273d2f9c454.tar.gz
emacs-2ecced627bc6553003bc32e282629273d2f9c454.zip
Fix log-view--mark-unmark interactive arguments
* lisp/vc/log-view.el (log-view--mark-unmark): New BEG and END arguments. Don't call region-beginning and region-end here. (log-view-mark-entry, log-view-unmark-entry): Pass BEG and END to log-view--mark-unmark, non-nil when the region is active.
-rw-r--r--lisp/vc/log-view.el30
1 files changed, 20 insertions, 10 deletions
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index d428ccad00f..1cb8b935ab5 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -344,14 +344,16 @@ See `log-view-mark-entry'."
344 (log-view-unmark-entry) 344 (log-view-unmark-entry)
345 (log-view-mark-entry))))) 345 (log-view-mark-entry)))))
346 346
347(defun log-view--mark-unmark (mark-unmark-function arg) 347(defun log-view--mark-unmark (mark-unmark-function arg beg end)
348 "Call MARK-UNMARK-FUNCTION on each line of an active region or ARG times. 348 "Call MARK-UNMARK-FUNCTION on each line of an active region or ARG times.
349MARK-UNMARK-FUNCTION should end by advancing point to the next line to 349MARK-UNMARK-FUNCTION should end by advancing point to the next line to
350be processed. 350be processed.
351The last line of an active region is excluded in the case that the 351The last line of an active region is excluded in the case that the
352region ends right at the beginning of the line, or after only non-word 352region ends right at the beginning of the line, or after only non-word
353characters." 353characters."
354 (if (use-region-p) 354 (when (xor beg end)
355 (error "log-view--mark-unmark called with invalid arguments"))
356 (if (and beg end)
355 (let ((processed-line nil) 357 (let ((processed-line nil)
356 ;; Exclude the region's last line if the region ends right 358 ;; Exclude the region's last line if the region ends right
357 ;; at the beginning of that line or almost at the beginning. 359 ;; at the beginning of that line or almost at the beginning.
@@ -359,13 +361,13 @@ characters."
359 ;; We don't want to include the last line unless the region 361 ;; We don't want to include the last line unless the region
360 ;; visually includes that revision. 362 ;; visually includes that revision.
361 (lastl (save-excursion 363 (lastl (save-excursion
362 (goto-char (region-end)) 364 (goto-char end)
363 (skip-syntax-backward "^w") 365 (skip-syntax-backward "^w")
364 (if (bolp) 366 (if (bolp)
365 (1- (line-number-at-pos)) 367 (1- (line-number-at-pos))
366 (line-number-at-pos))))) 368 (line-number-at-pos)))))
367 (save-excursion 369 (save-excursion
368 (goto-char (region-beginning)) 370 (goto-char beg)
369 (while-let ((n (line-number-at-pos)) 371 (while-let ((n (line-number-at-pos))
370 ;; Make sure we don't get stuck processing the 372 ;; Make sure we don't get stuck processing the
371 ;; same line infinitely. 373 ;; same line infinitely.
@@ -377,10 +379,12 @@ characters."
377 (dotimes (_ arg) 379 (dotimes (_ arg)
378 (funcall mark-unmark-function)))) 380 (funcall mark-unmark-function))))
379 381
380(defun log-view-mark-entry (&optional arg) 382(defun log-view-mark-entry (&optional arg beg end)
381 "Mark the log entry at point. 383 "Mark the log entry at point.
382If the region is active in Transient Mark mode, mark all entries. 384If the region is active in Transient Mark mode, mark all entries.
383When called with a prefix argument, mark that many log entries. 385When called with a prefix argument, mark that many log entries.
386When called from Lisp, mark ARG entries or all entries between lying
387between BEG and END. If BEG and END are supplied, ARG is ignored.
384 388
385When entries are marked, some commands that usually operate on the entry 389When entries are marked, some commands that usually operate on the entry
386at point will instead operate on all marked entries. 390at point will instead operate on all marked entries.
@@ -388,8 +392,10 @@ Use \\[log-view-unmark-entry] to unmark an entry.
388 392
389Lisp programs can use `log-view-get-marked' to obtain a list of all 393Lisp programs can use `log-view-get-marked' to obtain a list of all
390marked revisions." 394marked revisions."
391 (interactive "p") 395 (interactive (list (prefix-numeric-value current-prefix-arg)
392 (log-view--mark-unmark #'log-view--mark-entry arg)) 396 (use-region-beginning)
397 (use-region-end)))
398 (log-view--mark-unmark #'log-view--mark-entry arg beg end))
393 399
394(defun log-view--mark-entry () 400(defun log-view--mark-entry ()
395 "Mark the log entry at point." 401 "Mark the log entry at point."
@@ -409,14 +415,18 @@ marked revisions."
409 (overlay-put ov 'log-view-marked (nth 1 entry))))) 415 (overlay-put ov 'log-view-marked (nth 1 entry)))))
410 (log-view-msg-next 1))) 416 (log-view-msg-next 1)))
411 417
412(defun log-view-unmark-entry (&optional arg) 418(defun log-view-unmark-entry (&optional arg beg end)
413 "Unmark the log entry at point. 419 "Unmark the log entry at point.
414If the region is active in Transient Mark mode, unmark all entries. 420If the region is active in Transient Mark mode, unmark all entries.
415When called with a prefix argument, unmark that many log entries. 421When called with a prefix argument, unmark that many log entries.
422When called from Lisp, mark ARG entries or all entries between lying
423between BEG and END. If BEG and END are supplied, ARG is ignored.
416 424
417See `log-view-mark-entry'." 425See `log-view-mark-entry'."
418 (interactive "p") 426 (interactive (list (prefix-numeric-value current-prefix-arg)
419 (log-view--mark-unmark #'log-view--unmark-entry arg)) 427 (use-region-beginning)
428 (use-region-end)))
429 (log-view--mark-unmark #'log-view--unmark-entry arg beg end))
420 430
421(defun log-view--unmark-entry () 431(defun log-view--unmark-entry ()
422 "Unmark the log entry at point." 432 "Unmark the log entry at point."