diff options
| author | Stefan Monnier | 2007-07-01 01:57:21 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-07-01 01:57:21 +0000 |
| commit | 4d02fc25640fe8f43702df874f107d7100d80a17 (patch) | |
| tree | 24aad3ba3a17be08258bd8635943e054ae2de6b8 | |
| parent | f61fd6b7c3de95c2fafceca66c153933b2535b4e (diff) | |
| download | emacs-4d02fc25640fe8f43702df874f107d7100d80a17.tar.gz emacs-4d02fc25640fe8f43702df874f107d7100d80a17.zip | |
(Fcompleting_read): New value `confirm-only' for `require-match'.
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/minibuf.c | 24 |
2 files changed, 26 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1c13ade00d3..b87b05f8e27 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-07-01 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * minibuf.c (Fcompleting_read): New value `confirm-only' | ||
| 4 | for `require-match'. | ||
| 5 | |||
| 1 | 2007-06-28 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2007-06-28 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | * fileio.c (Fdo_auto_save): Revert last patch installed unwillingly as | 8 | * fileio.c (Fdo_auto_save): Revert last patch installed unwillingly as |
diff --git a/src/minibuf.c b/src/minibuf.c index 94e06365a91..c2654d02b04 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1717,9 +1717,15 @@ PREDICATE limits completion to a subset of COLLECTION. | |||
| 1717 | See `try-completion' and `all-completions' for more details | 1717 | See `try-completion' and `all-completions' for more details |
| 1718 | on completion, COLLECTION, and PREDICATE. | 1718 | on completion, COLLECTION, and PREDICATE. |
| 1719 | 1719 | ||
| 1720 | If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless | 1720 | REQUIRE-MATCH can take the following values: |
| 1721 | the input is (or completes to) an element of COLLECTION or is null. | 1721 | - t means that the user is not allowed to exit unless |
| 1722 | If it is also not t, typing RET does not exit if it does non-null completion. | 1722 | the input is (or completes to) an element of COLLECTION or is null. |
| 1723 | - nil means that the user can exit with any input. | ||
| 1724 | - `confirm-only' means that the user can exit with any input, but she will | ||
| 1725 | need to confirm her choice if the input is not an element of COLLECTION. | ||
| 1726 | - anything else behaves like t except that typing RET does not exit if it | ||
| 1727 | does non-null completion. | ||
| 1728 | |||
| 1723 | If the input is null, `completing-read' returns DEF, or an empty string | 1729 | If the input is null, `completing-read' returns DEF, or an empty string |
| 1724 | if DEF is nil, regardless of the value of REQUIRE-MATCH. | 1730 | if DEF is nil, regardless of the value of REQUIRE-MATCH. |
| 1725 | 1731 | ||
| @@ -2230,6 +2236,18 @@ a repetition of this command will exit. */) | |||
| 2230 | goto exit; | 2236 | goto exit; |
| 2231 | } | 2237 | } |
| 2232 | 2238 | ||
| 2239 | if (EQ (Vminibuffer_completion_confirm, intern ("confirm-only"))) | ||
| 2240 | { /* The user is permitted to exit with an input that's rejected | ||
| 2241 | by test-completion, but at the condition to confirm her choice. */ | ||
| 2242 | if (EQ (current_kboard->Vlast_command, Vthis_command)) | ||
| 2243 | goto exit; | ||
| 2244 | else | ||
| 2245 | { | ||
| 2246 | temp_echo_area_glyphs (build_string (" [Confirm]")); | ||
| 2247 | return Qnil; | ||
| 2248 | } | ||
| 2249 | } | ||
| 2250 | |||
| 2233 | /* Call do_completion, but ignore errors. */ | 2251 | /* Call do_completion, but ignore errors. */ |
| 2234 | SET_PT (ZV); | 2252 | SET_PT (ZV); |
| 2235 | val = internal_condition_case (complete_and_exit_1, Qerror, | 2253 | val = internal_condition_case (complete_and_exit_1, Qerror, |