# HG changeset patch # User Richard M. Stallman # Date 786054660 0 # Node ID 77b5eb8fc9e3943598691016e43bb0d2d5e38e82 # Parent f7b9813ea757724a01f9801eed39a2f951c2f6f9 (Fminibuffer_complete_and_exit): Catch errors in do_completion. (complete_and_exit_1, complete_and_exit_2): New subroutines. diff -r f7b9813ea757 -r 77b5eb8fc9e3 src/minibuf.c --- a/src/minibuf.c Mon Nov 28 19:44:16 1994 +0000 +++ b/src/minibuf.c Mon Nov 28 20:31:00 1994 +0000 @@ -1237,6 +1237,26 @@ return Qt; } + +/* Subroutines of Fminibuffer_complete_and_exit. */ + +/* This one is called by internal_condition_case to do the real work. */ + +Lisp_Object +complete_and_exit_1 () +{ + return make_number (do_completion ()); +} + +/* This one is called by internal_condition_case if an error happens. + Pretend the current value is an exact match. */ + +Lisp_Object +complete_and_exit_2 (ignore) + Lisp_Object ignore; +{ + return make_number (1); +} DEFUN ("minibuffer-complete-and-exit", Fminibuffer_complete_and_exit, Sminibuffer_complete_and_exit, 0, 0, "", @@ -1246,6 +1266,7 @@ () { register int i; + Lisp_Object val; /* Allow user to specify null string */ if (BEGV == ZV) @@ -1254,7 +1275,11 @@ if (!NILP (test_completion (Fbuffer_string ()))) goto exit; - i = do_completion (); + /* Call do_completion, but ignore errors. */ + val = internal_condition_case (complete_and_exit_1, Qerror, + complete_and_exit_2); + + i = XFASTINT (val); switch (i) { case 1: