]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix infinite loop in vc-dir-mark-unmark
authorCharles A. Roelli <charles@aurox.ch>
Mon, 18 Dec 2017 19:51:30 +0000 (20:51 +0100)
committerCharles A. Roelli <charles@aurox.ch>
Mon, 18 Dec 2017 19:56:03 +0000 (20:56 +0100)
* lisp/vc/vc-dir.el (vc-dir-mark-unmark): Prevent from getting
stuck on the same line in an infinite loop.  (Bug#24017)

lisp/vc/vc-dir.el

index 41c44e2c24a3e7f20da3dc8391eb5a9cdc2a72b6..52c7d3e658b3428a3b41526fe8ba3e26bc03c229 100644 (file)
@@ -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