From: Charles A. Roelli Date: Mon, 18 Dec 2017 19:51:30 +0000 (+0100) Subject: Fix infinite loop in vc-dir-mark-unmark X-Git-Tag: emacs-27.0.90~6012 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9685774e38dc6f5670c8e57dc9f49335f4f738b6;p=emacs.git 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) --- 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." (defun vc-dir-mark-unmark (mark-unmark-function) (if (use-region-p) - (let (;; (firstl (line-number-at-pos (region-beginning))) + (let ((processed-line nil) (lastl (line-number-at-pos (region-end)))) (save-excursion (goto-char (region-beginning)) - (while (<= (line-number-at-pos) lastl) + (while (and (<= (line-number-at-pos) lastl) + ;; We make sure to not get stuck processing the + ;; same line in an infinite loop. + (not (eq processed-line (line-number-at-pos)))) + (setq processed-line (line-number-at-pos)) (condition-case nil (funcall mark-unmark-function) ;; `vc-dir-mark-file' signals an error if we try marking