Subject: Re: bug#43120: 28.0.50; fido-mode: M-j before completions appear selects wrong choice

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 04 Sep 2020 04:11:58 +0200

Sean Whitton <[email-masked]> writes:

> The docstring for that function says it exits from a require-match
> minibuffer.  But completion gets used in other minibuffers too.  So we
> need to clear the variable somewhere which gets called for every
> minibuffer exit.

Yeah, following the exit logic (from the multiple number of code paths)
isn't trivial here.  But as far as I can tell, the exit-minibuffer
function is called in all the relevant code paths?

Does this fix the problem for you?

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 864726e3cc..8984440576 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2062,6 +2062,9 @@ exit-minibuffer
   ;; (or to turn it into a list of buffers, ...), but in the mean time,
   ;; this should do the trick in most cases.
   (setq deactivate-mark nil)
+  ;; Clear any computed default values (so that they're not used on
+  ;; the next invocation).
+  (setq completion-content-when-empty nil)
   (throw 'exit nil))
 
 (defun self-insert-and-exit ()

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no