diff options
| author | Richard M. Stallman | 1994-11-28 20:31:00 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-11-28 20:31:00 +0000 |
| commit | e4c97a67e7ef26c39f33c5227e2aba0e07784f3d (patch) | |
| tree | 6e20eb102f93b8bc050e1b775e0c913d3513ea3a | |
| parent | c66587feff67603818ea49fe4b7bfafe77a93e89 (diff) | |
| download | emacs-e4c97a67e7ef26c39f33c5227e2aba0e07784f3d.tar.gz emacs-e4c97a67e7ef26c39f33c5227e2aba0e07784f3d.zip | |
(Fminibuffer_complete_and_exit): Catch errors in do_completion.
(complete_and_exit_1, complete_and_exit_2): New subroutines.
| -rw-r--r-- | src/minibuf.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index 7ca45ecad76..b9b7407987c 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1237,6 +1237,26 @@ scroll the window of possible completions.") | |||
| 1237 | 1237 | ||
| 1238 | return Qt; | 1238 | return Qt; |
| 1239 | } | 1239 | } |
| 1240 | |||
| 1241 | /* Subroutines of Fminibuffer_complete_and_exit. */ | ||
| 1242 | |||
| 1243 | /* This one is called by internal_condition_case to do the real work. */ | ||
| 1244 | |||
| 1245 | Lisp_Object | ||
| 1246 | complete_and_exit_1 () | ||
| 1247 | { | ||
| 1248 | return make_number (do_completion ()); | ||
| 1249 | } | ||
| 1250 | |||
| 1251 | /* This one is called by internal_condition_case if an error happens. | ||
| 1252 | Pretend the current value is an exact match. */ | ||
| 1253 | |||
| 1254 | Lisp_Object | ||
| 1255 | complete_and_exit_2 (ignore) | ||
| 1256 | Lisp_Object ignore; | ||
| 1257 | { | ||
| 1258 | return make_number (1); | ||
| 1259 | } | ||
| 1240 | 1260 | ||
| 1241 | DEFUN ("minibuffer-complete-and-exit", Fminibuffer_complete_and_exit, | 1261 | DEFUN ("minibuffer-complete-and-exit", Fminibuffer_complete_and_exit, |
| 1242 | Sminibuffer_complete_and_exit, 0, 0, "", | 1262 | Sminibuffer_complete_and_exit, 0, 0, "", |
| @@ -1246,6 +1266,7 @@ a repetition of this command will exit.") | |||
| 1246 | () | 1266 | () |
| 1247 | { | 1267 | { |
| 1248 | register int i; | 1268 | register int i; |
| 1269 | Lisp_Object val; | ||
| 1249 | 1270 | ||
| 1250 | /* Allow user to specify null string */ | 1271 | /* Allow user to specify null string */ |
| 1251 | if (BEGV == ZV) | 1272 | if (BEGV == ZV) |
| @@ -1254,7 +1275,11 @@ a repetition of this command will exit.") | |||
| 1254 | if (!NILP (test_completion (Fbuffer_string ()))) | 1275 | if (!NILP (test_completion (Fbuffer_string ()))) |
| 1255 | goto exit; | 1276 | goto exit; |
| 1256 | 1277 | ||
| 1257 | i = do_completion (); | 1278 | /* Call do_completion, but ignore errors. */ |
| 1279 | val = internal_condition_case (complete_and_exit_1, Qerror, | ||
| 1280 | complete_and_exit_2); | ||
| 1281 | |||
| 1282 | i = XFASTINT (val); | ||
| 1258 | switch (i) | 1283 | switch (i) |
| 1259 | { | 1284 | { |
| 1260 | case 1: | 1285 | case 1: |