# HG changeset patch # User Miles Bader # Date 998936019 0 # Node ID 3037adea8353b0051656b8ee7401f5210ecab3ed # Parent 96abf5ad6f42629a05441d3d208cafdc2a8535da (comint-next-prompt): Don't loop infinitely if {next,previous}-single-char-property-change returns its input position when the search fails. diff -r 96abf5ad6f42 -r 3037adea8353 lisp/comint.el --- a/lisp/comint.el Mon Aug 27 18:12:46 2001 +0000 +++ b/lisp/comint.el Mon Aug 27 18:13:39 2001 +0000 @@ -2140,14 +2140,21 @@ (comint-skip-prompt)) ;; Use input fields (let ((pos (point)) - (input-pos nil)) + (input-pos nil) + prev-pos) (while (/= n 0) + (setq prev-pos pos) (setq pos (if (> n 0) (next-single-char-property-change pos 'field) (previous-single-char-property-change pos 'field))) - (cond ((null pos) + (cond ((or (null pos) (= pos prev-pos)) ;; Ran off the end of the buffer. + (when (> n 0) + ;; There's always an input field at the end of the + ;; buffer, but it has a `field' property of nil. + (setq input-pos (point-max))) + ;; stop iterating (setq n 0)) ((eq (get-char-property pos 'field) 'input) (setq n (if (< n 0) (1+ n) (1- n)))