]> code.delx.au - gnu-emacs/commitdiff
(Fcompleting_read): New value `confirm-only' for `require-match'.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 1 Jul 2007 01:57:21 +0000 (01:57 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 1 Jul 2007 01:57:21 +0000 (01:57 +0000)
src/ChangeLog
src/minibuf.c

index 1c13ade00d31c52b6fe04055e5f65530a5d40bd1..b87b05f8e2742c87116a6a6b2bf8cb71e94dc5fe 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuf.c (Fcompleting_read): New value `confirm-only'
+       for `require-match'.
+
 2007-06-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * fileio.c (Fdo_auto_save): Revert last patch installed unwillingly as
index 94e06365a917d9bd1641fc0a6ea560ebdce0b395..c2654d02b04a2b2b734068216ebb7e0348c07bfa 100644 (file)
@@ -1717,9 +1717,15 @@ PREDICATE limits completion to a subset of COLLECTION.
 See `try-completion' and `all-completions' for more details
  on completion, COLLECTION, and PREDICATE.
 
-If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless
- the input is (or completes to) an element of COLLECTION or is null.
- If it is also not t, typing RET does not exit if it does non-null completion.
+REQUIRE-MATCH can take the following values:
+- t means that the user is not allowed to exit unless
+  the input is (or completes to) an element of COLLECTION or is null.
+- nil means that the user can exit with any input.
+- `confirm-only' means that the user can exit with any input, but she will
+  need to confirm her choice if the input is not an element of COLLECTION.
+- anything else behaves like t except that typing RET does not exit if it
+  does non-null completion.
+
 If the input is null, `completing-read' returns DEF, or an empty string
  if DEF is nil, regardless of the value of REQUIRE-MATCH.
 
@@ -2230,6 +2236,18 @@ a repetition of this command will exit.  */)
       goto exit;
     }
 
+  if (EQ (Vminibuffer_completion_confirm, intern ("confirm-only")))
+    { /* The user is permitted to exit with an input that's rejected
+        by test-completion, but at the condition to confirm her choice.  */
+      if (EQ (current_kboard->Vlast_command, Vthis_command))
+       goto exit;
+      else
+       {
+         temp_echo_area_glyphs (build_string (" [Confirm]"));
+         return Qnil;
+       }
+    }
+
   /* Call do_completion, but ignore errors.  */
   SET_PT (ZV);
   val = internal_condition_case (complete_and_exit_1, Qerror,