From: Andreas Schwab Date: Sat, 14 Dec 2002 14:27:23 +0000 (+0000) Subject: (widget-move): Don't loop infinitely when there is X-Git-Url: http://git.hcoop.net/bpt/emacs.git/commitdiff_plain/ea13a2b4d4cd201b87c3271a087f1e02205ad68b (widget-move): Don't loop infinitely when there is no field or button. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ecc2ee2f3a..50550908b9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2002-12-14 Andreas Schwab + + * wid-edit.el (widget-move): Don't loop infinitely when there is + no field or button. + 2002-12-13 Stefan Monnier * uniquify.el (uniquify-rationalize-file-buffer-names, rename-buffer) diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 4e97f9ad8c..068b805d18 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -1002,19 +1002,20 @@ This is much faster, but doesn't work reliably on Emacs 19.34.") "Move point to the ARG next field or button. ARG may be negative to move backward." (or (bobp) (> arg 0) (backward-char)) - (let ((pos (point)) + (let ((wrapped 0) (number arg) (old (widget-tabable-at)) new) ;; Forward. (while (> arg 0) (cond ((eobp) - (goto-char (point-min))) + (goto-char (point-min)) + (setq wrapped (1+ wrapped))) (widget-use-overlay-change (goto-char (next-overlay-change (point)))) (t (forward-char 1))) - (and (eq pos (point)) + (and (= wrapped 2) (eq arg number) (error "No buttons or fields found")) (let ((new (widget-tabable-at))) @@ -1025,12 +1026,13 @@ ARG may be negative to move backward." ;; Backward. (while (< arg 0) (cond ((bobp) - (goto-char (point-max))) + (goto-char (point-max)) + (setq wrapped (1+ wrapped))) (widget-use-overlay-change (goto-char (previous-overlay-change (point)))) (t (backward-char 1))) - (and (eq pos (point)) + (and (= wrapped 2) (eq arg number) (error "No buttons or fields found")) (let ((new (widget-tabable-at)))