Mercurial > emacs
comparison src/emacs.c @ 40372:72f4688f560f
Fix typos in comments.
Remove unnecessary spaces.
Change doc-string comments to `new style' [w/`doc:' keyword].
(USAGE2): Fix typos in usage string.
author | Pavel Janík <Pavel@Janik.cz> |
---|---|
date | Sat, 27 Oct 2001 10:40:07 +0000 |
parents | 66e0816837a8 |
children | ea36983f19d3 |
comparison
equal
deleted
inserted
replaced
40371:7b9010de35d6 | 40372:72f4688f560f |
---|---|
89 #else | 89 #else |
90 EMACS_INT gdb_data_seg_bits = 0; | 90 EMACS_INT gdb_data_seg_bits = 0; |
91 #endif | 91 #endif |
92 EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG; | 92 EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG; |
93 | 93 |
94 /* Command line args from shell, as list of strings */ | 94 /* Command line args from shell, as list of strings. */ |
95 Lisp_Object Vcommand_line_args; | 95 Lisp_Object Vcommand_line_args; |
96 | 96 |
97 /* The name under which Emacs was invoked, with any leading directory | 97 /* The name under which Emacs was invoked, with any leading directory |
98 names discarded. */ | 98 names discarded. */ |
99 Lisp_Object Vinvocation_name; | 99 Lisp_Object Vinvocation_name; |
110 | 110 |
111 /* An empty lisp string. To avoid having to build any other. */ | 111 /* An empty lisp string. To avoid having to build any other. */ |
112 Lisp_Object empty_string; | 112 Lisp_Object empty_string; |
113 | 113 |
114 #ifdef SIGUSR1 | 114 #ifdef SIGUSR1 |
115 /* Hooks for signal USR1 and USR2 handing */ | 115 /* Hooks for signal USR1 and USR2 handling. */ |
116 Lisp_Object Vsignal_USR1_hook; | 116 Lisp_Object Vsignal_USR1_hook; |
117 #ifdef SIGUSR2 | 117 #ifdef SIGUSR2 |
118 Lisp_Object Vsignal_USR2_hook; | 118 Lisp_Object Vsignal_USR2_hook; |
119 #endif | 119 #endif |
120 #endif | 120 #endif |
121 | 121 |
122 /* Search path separator. */ | 122 /* Search path separator. */ |
123 Lisp_Object Vpath_separator; | 123 Lisp_Object Vpath_separator; |
124 | 124 |
157 Lisp_Object Vprevious_system_messages_locale; | 157 Lisp_Object Vprevious_system_messages_locale; |
158 Lisp_Object Vsystem_time_locale; | 158 Lisp_Object Vsystem_time_locale; |
159 Lisp_Object Vprevious_system_time_locale; | 159 Lisp_Object Vprevious_system_time_locale; |
160 | 160 |
161 /* If non-zero, emacs should not attempt to use an window-specific code, | 161 /* If non-zero, emacs should not attempt to use an window-specific code, |
162 but instead should use the virtual terminal under which it was started */ | 162 but instead should use the virtual terminal under which it was started. */ |
163 int inhibit_window_system; | 163 int inhibit_window_system; |
164 | 164 |
165 /* If nonzero, set Emacs to run at this priority. This is also used | 165 /* If nonzero, set Emacs to run at this priority. This is also used |
166 in child_setup and sys_suspend to make sure subshells run at normal | 166 in child_setup and sys_suspend to make sure subshells run at normal |
167 priority; Those functions have their own extern declaration. */ | 167 priority; those functions have their own extern declaration. */ |
168 int emacs_priority; | 168 int emacs_priority; |
169 | 169 |
170 /* If non-zero a filter or a sentinel is running. Tested to save the match | 170 /* If non-zero, a filter or a sentinel is running. Tested to save the match |
171 data on the first attempt to change it inside asynchronous code. */ | 171 data on the first attempt to change it inside asynchronous code. */ |
172 int running_asynch_code; | 172 int running_asynch_code; |
173 | 173 |
174 #ifdef BSD_PGRPS | 174 #ifdef BSD_PGRPS |
175 /* See sysdep.c. */ | 175 /* See sysdep.c. */ |
176 extern int inherited_pgroup; | 176 extern int inherited_pgroup; |
177 #endif | 177 #endif |
178 | 178 |
179 #ifdef HAVE_X_WINDOWS | 179 #ifdef HAVE_X_WINDOWS |
180 /* If non-zero, -d was specified, meaning we're using some window system. */ | 180 /* If non-zero, -d was specified, meaning we're using some window system. */ |
181 int display_arg; | 181 int display_arg; |
182 #endif | 182 #endif |
183 | 183 |
184 /* An address near the bottom of the stack. | 184 /* An address near the bottom of the stack. |
185 Tells GC how to save a copy of the stack. */ | 185 Tells GC how to save a copy of the stack. */ |
263 --background-color, -bg COLOR window background color\n\ | 263 --background-color, -bg COLOR window background color\n\ |
264 --border-color, -bd COLOR main border color\n\ | 264 --border-color, -bd COLOR main border color\n\ |
265 --border-width, -bw WIDTH width of main border\n\ | 265 --border-width, -bw WIDTH width of main border\n\ |
266 --cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\ | 266 --cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\ |
267 --display, -d DISPLAY use X server DISPLAY\n\ | 267 --display, -d DISPLAY use X server DISPLAY\n\ |
268 --font, -fn FONT default font; must be fixed-widthp\n\ | 268 --font, -fn FONT default font; must be fixed-width\n\ |
269 --foreground-color, -fg COLOR window foreground color\n\ | 269 --foreground-color, -fg COLOR window foreground color\n\ |
270 --geometry, -g GEOMETRY window geometry\n\ | 270 --geometry, -g GEOMETRY window geometry\n\ |
271 --iconic start Emacs in iconified state\n\ | 271 --iconic start Emacs in iconified state\n\ |
272 --icon-type, -i use picture of gnu for Emacs icon\n\ | 272 --icon-type, -i use picture of gnu for Emacs icon\n\ |
273 --internal-border, -ib WIDTH width between text and main border\n\ | 273 --internal-border, -ib WIDTH width between text and main border\n\ |
274 --line-spacing, -lsp PIXELS additional space to put between lines\n\ | 274 --line-spacing, -lsp PIXELS additional space to put between lines\n\ |
275 --mouse-color, -ms COLOR mouse cursor color in Emacs window\n\ | 275 --mouse-color, -ms COLOR mouse cursor color in Emacs window\n\ |
276 --name NAME title of main Emacs window\n\ | 276 --name NAME title of main Emacs window\n\ |
277 --reverse-video, -r, -rv switch foreground and background\n\ | 277 --reverse-video, -r, -rv switch foreground and background\n\ |
278 --title, -T, -wn, TITLE title for Emacs windows\n\ | 278 --title, -T, -wn TITLE title for Emacs windows\n\ |
279 --vertical-scroll-bars, -vb enable vertical scroll bars\n\ | 279 --vertical-scroll-bars, -vb enable vertical scroll bars\n\ |
280 --xrm XRESOURCES set additional X resources\n\ | 280 --xrm XRESOURCES set additional X resources\n\ |
281 \n\ | 281 \n\ |
282 You can generally also specify long option names with a single -; for\n\ | 282 You can generally also specify long option names with a single -; for\n\ |
283 example, -batch as well as --batch. You can use any unambiguous\n\ | 283 example, -batch as well as --batch. You can use any unambiguous\n\ |
288 \n\ | 288 \n\ |
289 Report bugs to bug-gnu-emacs@gnu.org. First, please see the Bugs\n\ | 289 Report bugs to bug-gnu-emacs@gnu.org. First, please see the Bugs\n\ |
290 section of the Emacs manual or the file BUGS.\n" | 290 section of the Emacs manual or the file BUGS.\n" |
291 | 291 |
292 | 292 |
293 /* Signal code for the fatal signal that was received */ | 293 /* Signal code for the fatal signal that was received. */ |
294 int fatal_error_code; | 294 int fatal_error_code; |
295 | 295 |
296 /* Nonzero if handling a fatal error already */ | 296 /* Nonzero if handling a fatal error already. */ |
297 int fatal_error_in_progress; | 297 int fatal_error_in_progress; |
298 | 298 |
299 /* If non-null, call this function from fata_error_signal before | 299 /* If non-null, call this function from fatal_error_signal before |
300 committing suicide. */ | 300 committing suicide. */ |
301 | 301 |
302 void (*fatal_error_signal_hook) P_ ((void)); | 302 void (*fatal_error_signal_hook) P_ ((void)); |
303 | 303 |
304 | 304 |
331 | 331 |
332 kbd_buffer_store_event (&buf); | 332 kbd_buffer_store_event (&buf); |
333 } | 333 } |
334 #endif /* SIGUSR2 */ | 334 #endif /* SIGUSR2 */ |
335 | 335 |
336 /* Handle bus errors, invalid instruction, etc. */ | 336 /* Handle bus errors, invalid instruction, etc. */ |
337 SIGTYPE | 337 SIGTYPE |
338 fatal_error_signal (sig) | 338 fatal_error_signal (sig) |
339 int sig; | 339 int sig; |
340 { | 340 { |
341 fatal_error_code = sig; | 341 fatal_error_code = sig; |
362 sigunblock (sigmask (fatal_error_code)); | 362 sigunblock (sigmask (fatal_error_code)); |
363 #endif | 363 #endif |
364 | 364 |
365 if (fatal_error_signal_hook) | 365 if (fatal_error_signal_hook) |
366 fatal_error_signal_hook (); | 366 fatal_error_signal_hook (); |
367 | 367 |
368 kill (getpid (), fatal_error_code); | 368 kill (getpid (), fatal_error_code); |
369 #endif /* not VMS */ | 369 #endif /* not VMS */ |
370 } | 370 } |
371 | 371 |
372 #ifdef SIGDANGER | 372 #ifdef SIGDANGER |
385 } | 385 } |
386 #endif | 386 #endif |
387 | 387 |
388 /* We define abort, rather than using it from the library, | 388 /* We define abort, rather than using it from the library, |
389 so that GDB can return from a breakpoint here. | 389 so that GDB can return from a breakpoint here. |
390 MSDOS has its own definition on msdos.c */ | 390 MSDOS has its own definition in msdos.c. */ |
391 | 391 |
392 #if ! defined (DOS_NT) && ! defined (NO_ABORT) | 392 #if ! defined (DOS_NT) && ! defined (NO_ABORT) |
393 | 393 |
394 #ifndef ABORT_RETURN_TYPE | 394 #ifndef ABORT_RETURN_TYPE |
395 #define ABORT_RETURN_TYPE void | 395 #define ABORT_RETURN_TYPE void |
403 exit (1); | 403 exit (1); |
404 } | 404 } |
405 #endif | 405 #endif |
406 | 406 |
407 | 407 |
408 /* Code for dealing with Lisp access to the Unix command line */ | 408 /* Code for dealing with Lisp access to the Unix command line. */ |
409 | 409 |
410 static void | 410 static void |
411 init_cmdargs (argc, argv, skip_args) | 411 init_cmdargs (argc, argv, skip_args) |
412 int argc; | 412 int argc; |
413 char **argv; | 413 char **argv; |
545 | 545 |
546 unbind_to (count, Qnil); | 546 unbind_to (count, Qnil); |
547 } | 547 } |
548 | 548 |
549 DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0, | 549 DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0, |
550 "Return the program name that was used to run Emacs.\n\ | 550 doc: /* Return the program name that was used to run Emacs. |
551 Any directory names are omitted.") | 551 Any directory names are omitted. */) |
552 () | 552 () |
553 { | 553 { |
554 return Fcopy_sequence (Vinvocation_name); | 554 return Fcopy_sequence (Vinvocation_name); |
555 } | 555 } |
556 | 556 |
557 DEFUN ("invocation-directory", Finvocation_directory, Sinvocation_directory, | 557 DEFUN ("invocation-directory", Finvocation_directory, Sinvocation_directory, |
558 0, 0, 0, | 558 0, 0, 0, |
559 "Return the directory name in which the Emacs executable was located") | 559 doc: /* Return the directory name in which the Emacs executable was located. */) |
560 () | 560 () |
561 { | 561 { |
562 return Fcopy_sequence (Vinvocation_directory); | 562 return Fcopy_sequence (Vinvocation_directory); |
563 } | 563 } |
564 | 564 |
565 | 565 |
802 printf ("malloc jumpstart failed!\n"); | 802 printf ("malloc jumpstart failed!\n"); |
803 } | 803 } |
804 #endif /* NeXT */ | 804 #endif /* NeXT */ |
805 | 805 |
806 #ifdef VMS | 806 #ifdef VMS |
807 /* If -map specified, map the data file in */ | 807 /* If -map specified, map the data file in. */ |
808 { | 808 { |
809 char *file; | 809 char *file; |
810 if (argmatch (argv, argc, "-map", "--map-data", 3, &mapin_file, &skip_args)) | 810 if (argmatch (argv, argc, "-map", "--map-data", 3, &mapin_file, &skip_args)) |
811 mapin_data (file); | 811 mapin_data (file); |
812 } | 812 } |
813 | 813 |
814 #ifdef LINK_CRTL_SHARE | 814 #ifdef LINK_CRTL_SHARE |
815 #ifdef SHARABLE_LIB_BUG | 815 #ifdef SHARABLE_LIB_BUG |
816 /* Bletcherous shared libraries! */ | 816 /* Bletcherous shared libraries! */ |
817 if (!stdin) | 817 if (!stdin) |
818 stdin = fdopen (0, "r"); | 818 stdin = fdopen (0, "r"); |
819 if (!stdout) | 819 if (!stdout) |
820 stdout = fdopen (1, "w"); | 820 stdout = fdopen (1, "w"); |
821 if (!stderr) | 821 if (!stderr) |
932 EXTRA_INITIALIZE; | 932 EXTRA_INITIALIZE; |
933 #endif | 933 #endif |
934 | 934 |
935 inhibit_window_system = 0; | 935 inhibit_window_system = 0; |
936 | 936 |
937 /* Handle the -t switch, which specifies filename to use as terminal */ | 937 /* Handle the -t switch, which specifies filename to use as terminal. */ |
938 while (1) | 938 while (1) |
939 { | 939 { |
940 char *term; | 940 char *term; |
941 if (argmatch (argv, argc, "-t", "--terminal", 4, &term, &skip_args)) | 941 if (argmatch (argv, argc, "-t", "--terminal", 4, &term, &skip_args)) |
942 { | 942 { |
971 /* Handle the -batch switch, which means don't do interactive display. */ | 971 /* Handle the -batch switch, which means don't do interactive display. */ |
972 noninteractive = 0; | 972 noninteractive = 0; |
973 if (argmatch (argv, argc, "-batch", "--batch", 5, NULL, &skip_args)) | 973 if (argmatch (argv, argc, "-batch", "--batch", 5, NULL, &skip_args)) |
974 noninteractive = 1; | 974 noninteractive = 1; |
975 | 975 |
976 /* Handle the --help option, which gives a usage message.. */ | 976 /* Handle the --help option, which gives a usage message. */ |
977 if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args)) | 977 if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args)) |
978 { | 978 { |
979 printf (USAGE1, argv[0]); | 979 printf (USAGE1, argv[0]); |
980 printf (USAGE2); | 980 printf (USAGE2); |
981 exit (0); | 981 exit (0); |
1096 #endif /* AIX */ | 1096 #endif /* AIX */ |
1097 } | 1097 } |
1098 | 1098 |
1099 noninteractive1 = noninteractive; | 1099 noninteractive1 = noninteractive; |
1100 | 1100 |
1101 /* Perform basic initializations (not merely interning symbols) */ | 1101 /* Perform basic initializations (not merely interning symbols). */ |
1102 | 1102 |
1103 if (!initialized) | 1103 if (!initialized) |
1104 { | 1104 { |
1105 init_alloc_once (); | 1105 init_alloc_once (); |
1106 init_obarray (); | 1106 init_obarray (); |
1107 init_eval_once (); | 1107 init_eval_once (); |
1108 init_charset_once (); | 1108 init_charset_once (); |
1109 init_coding_once (); | 1109 init_coding_once (); |
1110 init_syntax_once (); /* Create standard syntax table. */ | 1110 init_syntax_once (); /* Create standard syntax table. */ |
1111 init_category_once (); /* Create standard category table. */ | 1111 init_category_once (); /* Create standard category table. */ |
1112 /* Must be done before init_buffer */ | 1112 /* Must be done before init_buffer. */ |
1113 init_casetab_once (); | 1113 init_casetab_once (); |
1114 init_buffer_once (); /* Create buffer table and some buffers */ | 1114 init_buffer_once (); /* Create buffer table and some buffers. */ |
1115 init_minibuf_once (); /* Create list of minibuffers */ | 1115 init_minibuf_once (); /* Create list of minibuffers. */ |
1116 /* Must precede init_window_once */ | 1116 /* Must precede init_window_once. */ |
1117 | 1117 |
1118 /* Call syms_of_xfaces before init_window_once because that | 1118 /* Call syms_of_xfaces before init_window_once because that |
1119 function creates Vterminal_frame. Termcap frames now use | 1119 function creates Vterminal_frame. Termcap frames now use |
1120 faces, and the face implementation uses some symbols as | 1120 faces, and the face implementation uses some symbols as |
1121 face names. */ | 1121 face names. */ |
1122 syms_of_xfaces (); | 1122 syms_of_xfaces (); |
1140 syms_of_macterm (); | 1140 syms_of_macterm (); |
1141 syms_of_macmenu (); | 1141 syms_of_macmenu (); |
1142 syms_of_data (); | 1142 syms_of_data (); |
1143 syms_of_search (); | 1143 syms_of_search (); |
1144 syms_of_frame (); | 1144 syms_of_frame (); |
1145 | 1145 |
1146 x_term_init (); | 1146 x_term_init (); |
1147 init_keyboard (); | 1147 init_keyboard (); |
1148 #endif | 1148 #endif |
1149 | 1149 |
1150 init_window_once (); /* Init the window system */ | 1150 init_window_once (); /* Init the window system. */ |
1151 init_fileio_once (); /* Must precede any path manipulation. */ | 1151 init_fileio_once (); /* Must precede any path manipulation. */ |
1152 } | 1152 } |
1153 | 1153 |
1154 init_alloc (); | 1154 init_alloc (); |
1155 | 1155 |
1192 /* Actually this shouldn't be needed as of 20.4 in a generally | 1192 /* Actually this shouldn't be needed as of 20.4 in a generally |
1193 unibyte environment. As handa says, environment values | 1193 unibyte environment. As handa says, environment values |
1194 aren't now decoded; also existing buffers are now made | 1194 aren't now decoded; also existing buffers are now made |
1195 unibyte during startup if .emacs sets unibyte. Tested with | 1195 unibyte during startup if .emacs sets unibyte. Tested with |
1196 8-bit data in environment variables and /etc/passwd, setting | 1196 8-bit data in environment variables and /etc/passwd, setting |
1197 unibyte and Latin-1 in .emacs. -- Dave Love */ | 1197 unibyte and Latin-1 in .emacs. -- Dave Love */ |
1198 if (argmatch (argv, argc, "-unibyte", "--unibyte", 4, NULL, &skip_args) | 1198 if (argmatch (argv, argc, "-unibyte", "--unibyte", 4, NULL, &skip_args) |
1199 || argmatch (argv, argc, "-no-multibyte", "--no-multibyte", 4, NULL, &skip_args) | 1199 || argmatch (argv, argc, "-no-multibyte", "--no-multibyte", 4, NULL, &skip_args) |
1200 || (getenv ("EMACS_UNIBYTE") && !inhibit_unibyte)) | 1200 || (getenv ("EMACS_UNIBYTE") && !inhibit_unibyte)) |
1201 { | 1201 { |
1202 Lisp_Object old_log_max; | 1202 Lisp_Object old_log_max; |
1300 #endif /* MSDOS */ | 1300 #endif /* MSDOS */ |
1301 | 1301 |
1302 #ifdef WINDOWSNT | 1302 #ifdef WINDOWSNT |
1303 /* Initialize environment from registry settings. */ | 1303 /* Initialize environment from registry settings. */ |
1304 init_environment (argv); | 1304 init_environment (argv); |
1305 init_ntproc (); /* must precede init_editfns */ | 1305 init_ntproc (); /* must precede init_editfns. */ |
1306 #endif | 1306 #endif |
1307 | 1307 |
1308 /* egetenv is a pretty low-level facility, which may get called in | 1308 /* egetenv is a pretty low-level facility, which may get called in |
1309 many circumstances; it seems flimsy to put off initializing it | 1309 many circumstances; it seems flimsy to put off initializing it |
1310 until calling init_callproc. */ | 1310 until calling init_callproc. */ |
1315 /* Setting LANG here will defeat the startup locale processing... */ | 1315 /* Setting LANG here will defeat the startup locale processing... */ |
1316 #ifdef AIX3_2 | 1316 #ifdef AIX3_2 |
1317 putenv ("LANG=C"); | 1317 putenv ("LANG=C"); |
1318 #endif | 1318 #endif |
1319 | 1319 |
1320 init_buffer (); /* Init default directory of main buffer */ | 1320 init_buffer (); /* Init default directory of main buffer. */ |
1321 | 1321 |
1322 init_callproc_1 (); /* Must precede init_cmdargs and init_sys_modes. */ | 1322 init_callproc_1 (); /* Must precede init_cmdargs and init_sys_modes. */ |
1323 init_cmdargs (argc, argv, skip_args); /* Must precede init_lread. */ | 1323 init_cmdargs (argc, argv, skip_args); /* Must precede init_lread. */ |
1324 | 1324 |
1325 if (initialized) | 1325 if (initialized) |
1326 { | 1326 { |
1327 /* Erase any pre-dump messages in the message log, to avoid confusion */ | 1327 /* Erase any pre-dump messages in the message log, to avoid confusion. */ |
1328 Lisp_Object old_log_max; | 1328 Lisp_Object old_log_max; |
1329 old_log_max = Vmessage_log_max; | 1329 old_log_max = Vmessage_log_max; |
1330 XSETFASTINT (Vmessage_log_max, 0); | 1330 XSETFASTINT (Vmessage_log_max, 0); |
1331 message_dolog ("", 0, 1, 0); | 1331 message_dolog ("", 0, 1, 0); |
1332 Vmessage_log_max = old_log_max; | 1332 Vmessage_log_max = old_log_max; |
1338 /* Intern the names of all standard functions and variables; | 1338 /* Intern the names of all standard functions and variables; |
1339 define standard keys. */ | 1339 define standard keys. */ |
1340 | 1340 |
1341 if (!initialized) | 1341 if (!initialized) |
1342 { | 1342 { |
1343 /* The basic levels of Lisp must come first */ | 1343 /* The basic levels of Lisp must come first. */ |
1344 /* And data must come first of all | 1344 /* And data must come first of all |
1345 for the sake of symbols like error-message */ | 1345 for the sake of symbols like error-message. */ |
1346 #ifndef macintosh | 1346 #ifndef macintosh |
1347 /* Called before init_window_once for Mac OS. */ | 1347 /* Called before init_window_once for Mac OS. */ |
1348 syms_of_data (); | 1348 syms_of_data (); |
1349 #endif | 1349 #endif |
1350 syms_of_alloc (); | 1350 syms_of_alloc (); |
1455 } | 1455 } |
1456 | 1456 |
1457 if (!noninteractive) | 1457 if (!noninteractive) |
1458 { | 1458 { |
1459 #ifdef VMS | 1459 #ifdef VMS |
1460 init_vms_input ();/* init_display calls get_frame_size, that needs this */ | 1460 init_vms_input ();/* init_display calls get_frame_size, that needs this. */ |
1461 #endif /* VMS */ | 1461 #endif /* VMS */ |
1462 init_display (); /* Determine terminal type. init_sys_modes uses results */ | 1462 init_display (); /* Determine terminal type. init_sys_modes uses results. */ |
1463 } | 1463 } |
1464 #ifndef macintosh | 1464 #ifndef macintosh |
1465 /* Called before init_window_once for Mac OS. */ | 1465 /* Called before init_window_once for Mac OS. */ |
1466 init_keyboard (); /* This too must precede init_sys_modes */ | 1466 init_keyboard (); /* This too must precede init_sys_modes. */ |
1467 #endif | 1467 #endif |
1468 #ifdef VMS | 1468 #ifdef VMS |
1469 init_vmsproc (); /* And this too. */ | 1469 init_vmsproc (); /* And this too. */ |
1470 #endif /* VMS */ | 1470 #endif /* VMS */ |
1471 init_sys_modes (); /* Init system terminal modes (RAW or CBREAK, etc.) */ | 1471 init_sys_modes (); /* Init system terminal modes (RAW or CBREAK, etc.). */ |
1472 #ifdef HAVE_X_WINDOWS | 1472 #ifdef HAVE_X_WINDOWS |
1473 init_xfns (); | 1473 init_xfns (); |
1474 #endif /* HAVE_X_WINDOWS */ | 1474 #endif /* HAVE_X_WINDOWS */ |
1475 init_fns (); | 1475 init_fns (); |
1476 init_xdisp (); | 1476 init_xdisp (); |
1487 init_window (); | 1487 init_window (); |
1488 | 1488 |
1489 if (!initialized) | 1489 if (!initialized) |
1490 { | 1490 { |
1491 char *file; | 1491 char *file; |
1492 /* Handle -l loadup, args passed by Makefile. */ | 1492 /* Handle -l loadup, args passed by Makefile. */ |
1493 if (argmatch (argv, argc, "-l", "--load", 3, &file, &skip_args)) | 1493 if (argmatch (argv, argc, "-l", "--load", 3, &file, &skip_args)) |
1494 Vtop_level = Fcons (intern ("load"), | 1494 Vtop_level = Fcons (intern ("load"), |
1495 Fcons (build_string (file), Qnil)); | 1495 Fcons (build_string (file), Qnil)); |
1496 #ifdef CANNOT_DUMP | 1496 #ifdef CANNOT_DUMP |
1497 /* Unless next switch is -nl, load "loadup.el" first thing. */ | 1497 /* Unless next switch is -nl, load "loadup.el" first thing. */ |
1522 } | 1522 } |
1523 | 1523 |
1524 /* Set up for profiling. This is known to work on FreeBSD and | 1524 /* Set up for profiling. This is known to work on FreeBSD and |
1525 GNU/Linux. It might work on some other systems too. Give it a | 1525 GNU/Linux. It might work on some other systems too. Give it a |
1526 try and tell us if it works on your system. To compile for | 1526 try and tell us if it works on your system. To compile for |
1527 profiling use something like `make CFLAGS="-pg -g -O -DPROFILING=1'. */ | 1527 profiling use something like `make CFLAGS="-pg -g -O -DPROFILING=1'. */ |
1528 #if defined (__FreeBSD__) || defined (__linux) | 1528 #if defined (__FreeBSD__) || defined (__linux) |
1529 #ifdef PROFILING | 1529 #ifdef PROFILING |
1530 if (initialized) | 1530 if (initialized) |
1531 { | 1531 { |
1532 extern void _mcleanup (); | 1532 extern void _mcleanup (); |
1533 extern char etext; | 1533 extern char etext; |
1534 extern void safe_bcopy (); | 1534 extern void safe_bcopy (); |
1535 extern void dump_opcode_frequencies (); | 1535 extern void dump_opcode_frequencies (); |
1536 | 1536 |
1537 atexit (_mcleanup); | 1537 atexit (_mcleanup); |
1551 #ifdef LOCALTIME_CACHE | 1551 #ifdef LOCALTIME_CACHE |
1552 /* Some versions of localtime have a bug. They cache the value of the time | 1552 /* Some versions of localtime have a bug. They cache the value of the time |
1553 zone rather than looking it up every time. Since localtime() is | 1553 zone rather than looking it up every time. Since localtime() is |
1554 called to bolt the undumping time into the undumped emacs, this | 1554 called to bolt the undumping time into the undumped emacs, this |
1555 results in localtime ignoring the TZ environment variable. | 1555 results in localtime ignoring the TZ environment variable. |
1556 This flushes the new TZ value into localtime. */ | 1556 This flushes the new TZ value into localtime. */ |
1557 tzset (); | 1557 tzset (); |
1558 #endif /* defined (LOCALTIME_CACHE) */ | 1558 #endif /* defined (LOCALTIME_CACHE) */ |
1559 | 1559 |
1560 /* Enter editor command loop. This never returns. */ | 1560 /* Enter editor command loop. This never returns. */ |
1561 Frecursive_edit (); | 1561 Frecursive_edit (); |
1770 } | 1770 } |
1771 /* Skip option arguments--they are tied to the options. */ | 1771 /* Skip option arguments--they are tied to the options. */ |
1772 if (options[from] > 0) | 1772 if (options[from] > 0) |
1773 from += options[from]; | 1773 from += options[from]; |
1774 } | 1774 } |
1775 | 1775 |
1776 if (best < 0) | 1776 if (best < 0) |
1777 abort (); | 1777 abort (); |
1778 | 1778 |
1779 /* Copy the highest priority remaining option, with its args, to NEW. | 1779 /* Copy the highest priority remaining option, with its args, to NEW. |
1780 Unless it is a duplicate of the previous one. */ | 1780 Unless it is a duplicate of the previous one. */ |
1804 free (new); | 1804 free (new); |
1805 free (priority); | 1805 free (priority); |
1806 } | 1806 } |
1807 | 1807 |
1808 DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P", | 1808 DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P", |
1809 "Exit the Emacs job and kill it.\n\ | 1809 doc: /* Exit the Emacs job and kill it. |
1810 If ARG is an integer, return ARG as the exit program code.\n\ | 1810 If ARG is an integer, return ARG as the exit program code. |
1811 If ARG is a string, stuff it as keyboard input.\n\n\ | 1811 If ARG is a string, stuff it as keyboard input. |
1812 The value of `kill-emacs-hook', if not void,\n\ | 1812 |
1813 is a list of functions (of no args),\n\ | 1813 The value of `kill-emacs-hook', if not void, |
1814 all of which are called before Emacs is actually killed.") | 1814 is a list of functions (of no args), |
1815 (arg) | 1815 all of which are called before Emacs is actually killed. */) |
1816 (arg) | |
1816 Lisp_Object arg; | 1817 Lisp_Object arg; |
1817 { | 1818 { |
1818 struct gcpro gcpro1; | 1819 struct gcpro gcpro1; |
1819 | 1820 |
1820 GCPRO1 (arg); | 1821 GCPRO1 (arg); |
1869 Lisp_Object stuff; | 1870 Lisp_Object stuff; |
1870 { | 1871 { |
1871 /* Prevent running of hooks from now on. */ | 1872 /* Prevent running of hooks from now on. */ |
1872 Vrun_hooks = Qnil; | 1873 Vrun_hooks = Qnil; |
1873 | 1874 |
1874 /* If we are controlling the terminal, reset terminal modes */ | 1875 /* If we are controlling the terminal, reset terminal modes. */ |
1875 #ifdef EMACS_HAVE_TTY_PGRP | 1876 #ifdef EMACS_HAVE_TTY_PGRP |
1876 { | 1877 { |
1877 int pgrp = EMACS_GETPGRP (0); | 1878 int pgrp = EMACS_GETPGRP (0); |
1878 | 1879 |
1879 int tpgrp; | 1880 int tpgrp; |
1944 #ifndef CANNOT_DUMP | 1945 #ifndef CANNOT_DUMP |
1945 | 1946 |
1946 #ifdef HAVE_SHM | 1947 #ifdef HAVE_SHM |
1947 | 1948 |
1948 DEFUN ("dump-emacs-data", Fdump_emacs_data, Sdump_emacs_data, 1, 1, 0, | 1949 DEFUN ("dump-emacs-data", Fdump_emacs_data, Sdump_emacs_data, 1, 1, 0, |
1949 "Dump current state of Emacs into data file FILENAME.\n\ | 1950 doc: /* Dump current state of Emacs into data file FILENAME. |
1950 This function exists on systems that use HAVE_SHM.") | 1951 This function exists on systems that use HAVE_SHM. */) |
1951 (filename) | 1952 (filename) |
1952 Lisp_Object filename; | 1953 Lisp_Object filename; |
1953 { | 1954 { |
1954 extern char my_edata[]; | 1955 extern char my_edata[]; |
1955 Lisp_Object tem; | 1956 Lisp_Object tem; |
1956 | 1957 |
1960 | 1961 |
1961 tem = Vpurify_flag; | 1962 tem = Vpurify_flag; |
1962 Vpurify_flag = Qnil; | 1963 Vpurify_flag = Qnil; |
1963 | 1964 |
1964 fflush (stdout); | 1965 fflush (stdout); |
1965 /* Tell malloc where start of impure now is */ | 1966 /* Tell malloc where start of impure now is. */ |
1966 /* Also arrange for warnings when nearly out of space. */ | 1967 /* Also arrange for warnings when nearly out of space. */ |
1967 #ifndef SYSTEM_MALLOC | 1968 #ifndef SYSTEM_MALLOC |
1968 memory_warnings (my_edata, malloc_warning); | 1969 memory_warnings (my_edata, malloc_warning); |
1969 #endif | 1970 #endif |
1970 map_out_data (XSTRING (filename)->data); | 1971 map_out_data (XSTRING (filename)->data); |
1975 } | 1976 } |
1976 | 1977 |
1977 #else /* not HAVE_SHM */ | 1978 #else /* not HAVE_SHM */ |
1978 | 1979 |
1979 DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0, | 1980 DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0, |
1980 "Dump current state of Emacs into executable file FILENAME.\n\ | 1981 doc: /* Dump current state of Emacs into executable file FILENAME. |
1981 Take symbols from SYMFILE (presumably the file you executed to run Emacs).\n\ | 1982 Take symbols from SYMFILE (presumably the file you executed to run Emacs). |
1982 This is used in the file `loadup.el' when building Emacs.\n\ | 1983 This is used in the file `loadup.el' when building Emacs. |
1983 \n\ | 1984 |
1984 You must run Emacs in batch mode in order to dump it.") | 1985 You must run Emacs in batch mode in order to dump it. */) |
1985 (filename, symfile) | 1986 (filename, symfile) |
1986 Lisp_Object filename, symfile; | 1987 Lisp_Object filename, symfile; |
1987 { | 1988 { |
1988 extern char my_edata[]; | 1989 extern char my_edata[]; |
1989 Lisp_Object tem; | 1990 Lisp_Object tem; |
1990 Lisp_Object symbol; | 1991 Lisp_Object symbol; |
2023 | 2024 |
2024 fflush (stdout); | 2025 fflush (stdout); |
2025 #ifdef VMS | 2026 #ifdef VMS |
2026 mapout_data (XSTRING (filename)->data); | 2027 mapout_data (XSTRING (filename)->data); |
2027 #else | 2028 #else |
2028 /* Tell malloc where start of impure now is */ | 2029 /* Tell malloc where start of impure now is. */ |
2029 /* Also arrange for warnings when nearly out of space. */ | 2030 /* Also arrange for warnings when nearly out of space. */ |
2030 #ifndef SYSTEM_MALLOC | 2031 #ifndef SYSTEM_MALLOC |
2031 #ifndef WINDOWSNT | 2032 #ifndef WINDOWSNT |
2032 /* On Windows, this was done before dumping, and that once suffices. | 2033 /* On Windows, this was done before dumping, and that once suffices. |
2033 Meanwhile, my_edata is not valid on Windows. */ | 2034 Meanwhile, my_edata is not valid on Windows. */ |
2182 | 2183 |
2183 defsubr (&Sinvocation_name); | 2184 defsubr (&Sinvocation_name); |
2184 defsubr (&Sinvocation_directory); | 2185 defsubr (&Sinvocation_directory); |
2185 | 2186 |
2186 DEFVAR_LISP ("command-line-args", &Vcommand_line_args, | 2187 DEFVAR_LISP ("command-line-args", &Vcommand_line_args, |
2187 "Args passed by shell to Emacs, as a list of strings."); | 2188 doc: /* Args passed by shell to Emacs, as a list of strings. */); |
2188 | 2189 |
2189 DEFVAR_LISP ("system-type", &Vsystem_type, | 2190 DEFVAR_LISP ("system-type", &Vsystem_type, |
2190 "Value is symbol indicating type of operating system you are using."); | 2191 doc: /* Value is symbol indicating type of operating system you are using. */); |
2191 Vsystem_type = intern (SYSTEM_TYPE); | 2192 Vsystem_type = intern (SYSTEM_TYPE); |
2192 | 2193 |
2193 DEFVAR_LISP ("system-configuration", &Vsystem_configuration, | 2194 DEFVAR_LISP ("system-configuration", &Vsystem_configuration, |
2194 "Value is string indicating configuration Emacs was built for.\n\ | 2195 doc: /* Value is string indicating configuration Emacs was built for. |
2195 On MS-Windows, the value reflects the OS flavor and version on which\n\ | 2196 On MS-Windows, the value reflects the OS flavor and version on which |
2196 Emacs is running."); | 2197 Emacs is running. */); |
2197 Vsystem_configuration = build_string (EMACS_CONFIGURATION); | 2198 Vsystem_configuration = build_string (EMACS_CONFIGURATION); |
2198 | 2199 |
2199 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options, | 2200 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options, |
2200 "String containing the configuration options Emacs was built with."); | 2201 doc: /* String containing the configuration options Emacs was built with. */); |
2201 Vsystem_configuration_options = build_string (EMACS_CONFIG_OPTIONS); | 2202 Vsystem_configuration_options = build_string (EMACS_CONFIG_OPTIONS); |
2202 | 2203 |
2203 DEFVAR_BOOL ("noninteractive", &noninteractive1, | 2204 DEFVAR_BOOL ("noninteractive", &noninteractive1, |
2204 "Non-nil means Emacs is running without interactive terminal."); | 2205 doc: /* Non-nil means Emacs is running without interactive terminal. */); |
2205 | 2206 |
2206 DEFVAR_LISP ("kill-emacs-hook", &Vkill_emacs_hook, | 2207 DEFVAR_LISP ("kill-emacs-hook", &Vkill_emacs_hook, |
2207 "Hook to be run whenever kill-emacs is called.\n\ | 2208 doc: /* Hook to be run whenever kill-emacs is called. |
2208 Since kill-emacs may be invoked when the terminal is disconnected (or\n\ | 2209 Since kill-emacs may be invoked when the terminal is disconnected (or |
2209 in other similar situations), functions placed on this hook should not\n\ | 2210 in other similar situations), functions placed on this hook should not |
2210 expect to be able to interact with the user. To ask for confirmation,\n\ | 2211 expect to be able to interact with the user. To ask for confirmation, |
2211 see `kill-emacs-query-functions' instead."); | 2212 see `kill-emacs-query-functions' instead. */); |
2212 Vkill_emacs_hook = Qnil; | 2213 Vkill_emacs_hook = Qnil; |
2213 | 2214 |
2214 empty_string = build_string (""); | 2215 empty_string = build_string (""); |
2215 staticpro (&empty_string); | 2216 staticpro (&empty_string); |
2216 | 2217 |
2217 #ifdef SIGUSR1 | 2218 #ifdef SIGUSR1 |
2218 DEFVAR_LISP ("signal-USR1-hook", &Vsignal_USR1_hook, | 2219 DEFVAR_LISP ("signal-USR1-hook", &Vsignal_USR1_hook, |
2219 "Hook to be run whenever emacs receives a USR1 signal"); | 2220 doc: /* Hook to be run whenever emacs receives a USR1 signal. */); |
2220 Vsignal_USR1_hook = Qnil; | 2221 Vsignal_USR1_hook = Qnil; |
2221 #ifdef SIGUSR2 | 2222 #ifdef SIGUSR2 |
2222 DEFVAR_LISP ("signal-USR2-hook", &Vsignal_USR2_hook, | 2223 DEFVAR_LISP ("signal-USR2-hook", &Vsignal_USR2_hook, |
2223 "Hook to be run whenever emacs receives a USR2 signal"); | 2224 doc: /* Hook to be run whenever emacs receives a USR2 signal. */); |
2224 Vsignal_USR2_hook = Qnil; | 2225 Vsignal_USR2_hook = Qnil; |
2225 #endif | 2226 #endif |
2226 #endif | 2227 #endif |
2227 | 2228 |
2228 | 2229 |
2229 DEFVAR_INT ("emacs-priority", &emacs_priority, | 2230 DEFVAR_INT ("emacs-priority", &emacs_priority, |
2230 "Priority for Emacs to run at.\n\ | 2231 doc: /* Priority for Emacs to run at. |
2231 This value is effective only if set before Emacs is dumped,\n\ | 2232 This value is effective only if set before Emacs is dumped, |
2232 and only if the Emacs executable is installed with setuid to permit\n\ | 2233 and only if the Emacs executable is installed with setuid to permit |
2233 it to change priority. (Emacs sets its uid back to the real uid.)\n\ | 2234 it to change priority. (Emacs sets its uid back to the real uid.) |
2234 Currently, you need to define SET_EMACS_PRIORITY in `config.h'\n\ | 2235 Currently, you need to define SET_EMACS_PRIORITY in `config.h' |
2235 before you compile Emacs, to enable the code for this feature."); | 2236 before you compile Emacs, to enable the code for this feature. */); |
2236 emacs_priority = 0; | 2237 emacs_priority = 0; |
2237 | 2238 |
2238 DEFVAR_LISP ("path-separator", &Vpath_separator, | 2239 DEFVAR_LISP ("path-separator", &Vpath_separator, |
2239 "The directory separator in search paths, as a string."); | 2240 doc: /* The directory separator in search paths, as a string. */); |
2240 { | 2241 { |
2241 char c = SEPCHAR; | 2242 char c = SEPCHAR; |
2242 Vpath_separator = make_string (&c, 1); | 2243 Vpath_separator = make_string (&c, 1); |
2243 } | 2244 } |
2244 | 2245 |
2245 DEFVAR_LISP ("invocation-name", &Vinvocation_name, | 2246 DEFVAR_LISP ("invocation-name", &Vinvocation_name, |
2246 "The program name that was used to run Emacs.\n\ | 2247 doc: /* The program name that was used to run Emacs. |
2247 Any directory names are omitted."); | 2248 Any directory names are omitted. */); |
2248 | 2249 |
2249 DEFVAR_LISP ("invocation-directory", &Vinvocation_directory, | 2250 DEFVAR_LISP ("invocation-directory", &Vinvocation_directory, |
2250 "The directory in which the Emacs executable was found, to run it.\n\ | 2251 doc: /* The directory in which the Emacs executable was found, to run it. |
2251 The value is nil if that directory's name is not known."); | 2252 The value is nil if that directory's name is not known. */); |
2252 | 2253 |
2253 DEFVAR_LISP ("installation-directory", &Vinstallation_directory, | 2254 DEFVAR_LISP ("installation-directory", &Vinstallation_directory, |
2254 "A directory within which to look for the `lib-src' and `etc' directories.\n\ | 2255 doc: /* A directory within which to look for the `lib-src' and `etc' directories. |
2255 This is non-nil when we can't find those directories in their standard\n\ | 2256 This is non-nil when we can't find those directories in their standard |
2256 installed locations, but we can find them\n\ | 2257 installed locations, but we can find them |
2257 near where the Emacs executable was found."); | 2258 near where the Emacs executable was found. */); |
2258 Vinstallation_directory = Qnil; | 2259 Vinstallation_directory = Qnil; |
2259 | 2260 |
2260 DEFVAR_LISP ("system-messages-locale", &Vsystem_messages_locale, | 2261 DEFVAR_LISP ("system-messages-locale", &Vsystem_messages_locale, |
2261 "System locale for messages."); | 2262 doc: /* System locale for messages. */); |
2262 Vsystem_messages_locale = Qnil; | 2263 Vsystem_messages_locale = Qnil; |
2263 | 2264 |
2264 DEFVAR_LISP ("previous-system-messages-locale", | 2265 DEFVAR_LISP ("previous-system-messages-locale", |
2265 &Vprevious_system_messages_locale, | 2266 &Vprevious_system_messages_locale, |
2266 "Most recently used system locale for messages."); | 2267 doc: /* Most recently used system locale for messages. */); |
2267 Vprevious_system_messages_locale = Qnil; | 2268 Vprevious_system_messages_locale = Qnil; |
2268 | 2269 |
2269 DEFVAR_LISP ("system-time-locale", &Vsystem_time_locale, | 2270 DEFVAR_LISP ("system-time-locale", &Vsystem_time_locale, |
2270 "System locale for time."); | 2271 doc: /* System locale for time. */); |
2271 Vsystem_time_locale = Qnil; | 2272 Vsystem_time_locale = Qnil; |
2272 | 2273 |
2273 DEFVAR_LISP ("previous-system-time-locale", &Vprevious_system_time_locale, | 2274 DEFVAR_LISP ("previous-system-time-locale", &Vprevious_system_time_locale, |
2274 "Most recently used system locale for time."); | 2275 doc: /* Most recently used system locale for time. */); |
2275 Vprevious_system_time_locale = Qnil; | 2276 Vprevious_system_time_locale = Qnil; |
2276 } | 2277 } |