[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fido-mode-fix 97213d7 1/2: minibuffer-force-complete-and-exit: Allow inp

From: Dmitry Gutov
Subject: fido-mode-fix 97213d7 1/2: minibuffer-force-complete-and-exit: Allow input with no matches
Date: Wed, 4 Mar 2020 18:59:18 -0500 (EST)

branch: fido-mode-fix
commit 97213d71f8773e9e04f7caa7f147442b2aec164d
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    minibuffer-force-complete-and-exit: Allow input with no matches
    * lisp/minibuffer.el (minibuffer--require-match): New variable.
    (completing-read-default): Bind it to the REQUIRE-MATCH value.
    (minibuffer-force-complete-and-exit): Consult it to allow input
    with no matches when a match is not required (bug#38992).
    * lisp/icomplete.el (icomplete-exhibit): Use it to render the
    correct parens around matches.
 lisp/icomplete.el  |  2 +-
 lisp/minibuffer.el | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index a1a67e2..efe64d8 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -541,7 +541,7 @@ See `icomplete-mode' and `minibuffer-setup-hook'."
                           (if (window-minibuffer-p)
-                              (not minibuffer-completion-confirm)))))
+                              (eq minibuffer--require-match t)))))
                  (buffer-undo-list t)
             ;; Do nothing if while-no-input was aborted.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 49daabc..7f5b597 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1400,7 +1400,11 @@ scroll the window of possible completions."
    (minibuffer-prompt-end) (point-max) #'exit-minibuffer
    ;; If the previous completion completed to an element which fails
    ;; test-completion, then we shouldn't exit, but that should be rare.
-   (lambda () (minibuffer-message "Incomplete"))))
+   (lambda ()
+     (if minibuffer--require-match
+         (minibuffer-message "Incomplete")
+       ;; If a match is not required, exit after all.
+       (exit-minibuffer)))))
 (defun minibuffer-force-complete (&optional start end dont-cycle)
   "Complete the minibuffer to an exact match.
@@ -1464,6 +1468,9 @@ DONT-CYCLE tells the function not to setup cycling."
   "List of commands which cause an immediately following
 `minibuffer-complete-and-exit' to ask for extra confirmation.")
+(defvar minibuffer--require-match nil
+  "Value of REQUIRE-MATCH passed to `completing-read'.")
 (defun minibuffer-complete-and-exit ()
   "Exit if the minibuffer contains a valid completion.
 Otherwise, try to complete the minibuffer contents.  If
@@ -3748,8 +3755,10 @@ See `completing-read' for the meaning of the arguments."
   (let* ((minibuffer-completion-table collection)
          (minibuffer-completion-predicate predicate)
+         ;; FIXME: Remove/rename this var, see the next one.
          (minibuffer-completion-confirm (unless (eq require-match t)
+         (minibuffer--require-match require-match)
          (base-keymap (if require-match

reply via email to

[Prev in Thread] Current Thread [Next in Thread]