comparison src/keyboard.c @ 13770:197ada595605

(Fcommand_execute): Allow function + args list as cmd. (cmd_error_internal): Use print_error_message.
author Karl Heuer <kwzh@gnu.org>
date Thu, 21 Dec 1995 17:08:30 +0000
parents eae7f6d657be
children 7d0b87f737f9
comparison
equal deleted inserted replaced
13769:a17778d3f5f3 13770:197ada595605
898 898
899 cmd_error_internal (data, context) 899 cmd_error_internal (data, context)
900 Lisp_Object data; 900 Lisp_Object data;
901 char *context; 901 char *context;
902 { 902 {
903 Lisp_Object errmsg, tail, errname, file_error;
904 Lisp_Object stream; 903 Lisp_Object stream;
905 struct gcpro gcpro1;
906 int i;
907 904
908 Vquit_flag = Qnil; 905 Vquit_flag = Qnil;
909 Vinhibit_quit = Qt; 906 Vinhibit_quit = Qt;
910 echo_area_glyphs = 0; 907 echo_area_glyphs = 0;
911 908
923 } 920 }
924 921
925 if (context != 0) 922 if (context != 0)
926 write_string_1 (context, -1, stream); 923 write_string_1 (context, -1, stream);
927 924
928 errname = Fcar (data); 925 print_error_message (data, stream);
929
930 if (EQ (errname, Qerror))
931 {
932 data = Fcdr (data);
933 if (!CONSP (data)) data = Qnil;
934 errmsg = Fcar (data);
935 file_error = Qnil;
936 }
937 else
938 {
939 errmsg = Fget (errname, Qerror_message);
940 file_error = Fmemq (Qfile_error,
941 Fget (errname, Qerror_conditions));
942 }
943
944 /* Print an error message including the data items.
945 This is done by printing it into a scratch buffer
946 and then making a copy of the text in the buffer. */
947
948 if (!CONSP (data)) data = Qnil;
949 tail = Fcdr (data);
950 GCPRO1 (tail);
951
952 /* For file-error, make error message by concatenating
953 all the data items. They are all strings. */
954 if (!NILP (file_error) && !NILP (tail))
955 errmsg = XCONS (tail)->car, tail = XCONS (tail)->cdr;
956
957 if (STRINGP (errmsg))
958 Fprinc (errmsg, stream);
959 else
960 write_string_1 ("peculiar error", -1, stream);
961
962 for (i = 0; CONSP (tail); tail = Fcdr (tail), i++)
963 {
964 write_string_1 (i ? ", " : ": ", 2, stream);
965 if (!NILP (file_error))
966 Fprinc (Fcar (tail), stream);
967 else
968 Fprin1 (Fcar (tail), stream);
969 }
970 UNGCPRO;
971 926
972 /* If the window system or terminal frame hasn't been initialized 927 /* If the window system or terminal frame hasn't been initialized
973 yet, or we're in -batch mode, this error should cause Emacs to exit. */ 928 yet, or we're in -batch mode, this error should cause Emacs to exit. */
974 if (! FRAME_MESSAGE_BUF (selected_frame) 929 if (! FRAME_MESSAGE_BUF (selected_frame)
975 || noninteractive) 930 || noninteractive)
6443 if (!NILP (tem)) 6398 if (!NILP (tem))
6444 return call1 (Vrun_hooks, Qdisabled_command_hook); 6399 return call1 (Vrun_hooks, Qdisabled_command_hook);
6445 } 6400 }
6446 } 6401 }
6447 6402
6448 while (1) 6403 while (! CONSP (cmd) || EQ (XCONS (cmd)->car, Qlambda)
6404 || EQ (XCONS (cmd)->car, Qautoload))
6449 { 6405 {
6450 final = Findirect_function (cmd); 6406 final = Findirect_function (cmd);
6451 6407
6452 if (CONSP (final) && (tem = Fcar (final), EQ (tem, Qautoload))) 6408 if (CONSP (final) && (tem = Fcar (final), EQ (tem, Qautoload)))
6453 do_autoload (final, cmd); 6409 do_autoload (final, cmd);