From: João Távora Date: Wed, 23 Jan 2019 16:17:03 +0000 (+0000) Subject: Avoid cycling in minibuffer-force-complete-and-exit (bug#34116) X-Git-Tag: emacs-27.0.90~3752 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=210e592e55ade154c8d58bd467711fb69368f6cb;p=emacs.git Avoid cycling in minibuffer-force-complete-and-exit (bug#34116) * lisp/minibuffer.el (minibuffer-force-complete-and-exit): Check completion-cycling before minibuffer-force-complete. --- diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 5760a2e49de..99cb66926bb 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1257,7 +1257,13 @@ scroll the window of possible completions." (defun minibuffer-force-complete-and-exit () "Complete the minibuffer with first of the matches and exit." (interactive) - (minibuffer-force-complete) + ;; If `completion-cycling' is t, then surely a + ;; `minibuffer-force-complete' has already executed. This is not + ;; just for speed: the extra rotation caused by the second + ;; unnecessary call would mess up the final result value + ;; (bug#34116). + (unless completion-cycling + (minibuffer-force-complete)) (completion--complete-and-exit (minibuffer-prompt-end) (point-max) #'exit-minibuffer ;; If the previous completion completed to an element which fails