diff options
| author | Charles A. Roelli | 2017-12-18 20:51:30 +0100 |
|---|---|---|
| committer | Charles A. Roelli | 2017-12-18 20:56:03 +0100 |
| commit | 9685774e38dc6f5670c8e57dc9f49335f4f738b6 (patch) | |
| tree | 9bc6e162b7e79e28e6dd2031b9c229fa4712427e | |
| parent | 5f17472574565ac10bfcacb7058f3684296c8e7d (diff) | |
| download | emacs-9685774e38dc6f5670c8e57dc9f49335f4f738b6.tar.gz emacs-9685774e38dc6f5670c8e57dc9f49335f4f738b6.zip | |
Fix infinite loop in vc-dir-mark-unmark
* lisp/vc/vc-dir.el (vc-dir-mark-unmark): Prevent from getting
stuck on the same line in an infinite loop. (Bug#24017)
| -rw-r--r-- | lisp/vc/vc-dir.el | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 41c44e2c24a..52c7d3e658b 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el | |||
| @@ -554,11 +554,15 @@ If a prefix argument is given, move by that many lines." | |||
| 554 | 554 | ||
| 555 | (defun vc-dir-mark-unmark (mark-unmark-function) | 555 | (defun vc-dir-mark-unmark (mark-unmark-function) |
| 556 | (if (use-region-p) | 556 | (if (use-region-p) |
| 557 | (let (;; (firstl (line-number-at-pos (region-beginning))) | 557 | (let ((processed-line nil) |
| 558 | (lastl (line-number-at-pos (region-end)))) | 558 | (lastl (line-number-at-pos (region-end)))) |
| 559 | (save-excursion | 559 | (save-excursion |
| 560 | (goto-char (region-beginning)) | 560 | (goto-char (region-beginning)) |
| 561 | (while (<= (line-number-at-pos) lastl) | 561 | (while (and (<= (line-number-at-pos) lastl) |
| 562 | ;; We make sure to not get stuck processing the | ||
| 563 | ;; same line in an infinite loop. | ||
| 564 | (not (eq processed-line (line-number-at-pos)))) | ||
| 565 | (setq processed-line (line-number-at-pos)) | ||
| 562 | (condition-case nil | 566 | (condition-case nil |
| 563 | (funcall mark-unmark-function) | 567 | (funcall mark-unmark-function) |
| 564 | ;; `vc-dir-mark-file' signals an error if we try marking | 568 | ;; `vc-dir-mark-file' signals an error if we try marking |