diff --git a/lisp/simple.el b/lisp/simple.el index accc119e2b..7d47aba1ee 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -9125,7 +9125,7 @@ next-completion (unless (get-text-property (point) 'mouse-face) (goto-char (next-single-property-change (point) 'mouse-face nil end))) (setq n (1- n))) - (while (< n 0) + (while (and (< n 0) (< 1 (point))) (let ((prop (get-text-property (1- (point)) 'mouse-face))) ;; If in a completion, move to the start of it. (when (and prop (eq prop (get-text-property (point) 'mouse-face)))