📄 emacs.c
字号:
signal (23, fatal_error_signal); signal (24, fatal_error_signal); signal (SIGAIO, fatal_error_signal); signal (SIGPTY, fatal_error_signal); signal (SIGIOINT, fatal_error_signal); signal (SIGGRANT, fatal_error_signal); signal (SIGRETRACT, fatal_error_signal); signal (SIGSOUND, fatal_error_signal); signal (SIGMSG, fatal_error_signal);#endif /* AIX */ } noninteractive1 = noninteractive;/* Perform basic initializations (not merely interning symbols) */ if (!initialized) { init_alloc_once (); init_obarray (); init_eval_once (); init_syntax_once (); /* Create standard syntax table. */ /* Must be done before init_buffer */ init_buffer_once (); /* Create buffer table and some buffers */ init_minibuf_once (); /* Create list of minibuffers */ /* Must precede init_window_once */ init_window_once (); /* Init the window system */ } init_alloc ();#ifdef MAINTAIN_ENVIRONMENT init_environ ();#endif init_eval (); init_data (); init_read (); init_cmdargs (argc, argv, skip_args); /* Create list Vcommand_line_args */ init_buffer (); /* Init default directory of main buffer */ if (!noninteractive) {#ifdef VMS init_vms_input ();/* init_display calls get_screen_size, that needs this */#endif /* VMS */ init_display (); /* Determine terminal type. init_sys_modes uses results */ } init_keyboard (); /* This too must precede init_sys_modes */ init_callproc (); /* And this too. */ init_sys_modes (); /* Init system terminal modes (RAW or CBREAK, etc.) */ init_xdisp (); init_macros (); init_editfns ();#ifdef VMS init_vmsfns ();#endif /* VMS */#ifdef subprocesses init_process ();#endif /* subprocesses *//* Intern the names of all standard functions and variables; define standard keys */ if (!initialized) { /* The basic levels of Lisp must come first */ /* And data must come first of all for the sake of symbols like error-message */ syms_of_data (); syms_of_alloc ();#ifdef MAINTAIN_ENVIRONMENT syms_of_environ ();#endif MAINTAIN_ENVIRONMENT syms_of_read (); syms_of_print (); syms_of_eval (); syms_of_fns (); syms_of_abbrev (); syms_of_buffer (); syms_of_bytecode (); syms_of_callint (); syms_of_casefiddle (); syms_of_callproc (); syms_of_cmds ();#ifndef NO_DIR_LIBRARY syms_of_dired ();#endif /* not NO_DIR_LIBRARY */ syms_of_display (); syms_of_doc (); syms_of_editfns (); syms_of_emacs (); syms_of_fileio ();#ifdef CLASH_DETECTION syms_of_filelock ();#endif /* CLASH_DETECTION */ syms_of_indent (); syms_of_keyboard (); syms_of_keymap (); syms_of_macros (); syms_of_marker (); syms_of_minibuf (); syms_of_mocklisp ();#ifdef subprocesses syms_of_process ();#endif /* subprocesses */ syms_of_search (); syms_of_syntax (); syms_of_undo (); syms_of_window (); syms_of_xdisp ();#ifdef HAVE_X_WINDOWS syms_of_xfns ();#ifdef HAVE_X_MENU syms_of_xmenu ();#endif /* HAVE_X_MENU */#endif /* HAVE_X_WINDOWS */#ifdef SYMS_SYSTEM SYMS_SYSTEM;#endif#ifdef SYMS_MACHINE SYMS_MACHINE;#endif keys_of_casefiddle (); keys_of_cmds (); keys_of_buffer (); keys_of_keyboard (); keys_of_keymap (); keys_of_macros (); keys_of_minibuf (); keys_of_window (); } if (!initialized) { /* Handle -l loadup-and-dump, args passed by Makefile. */ if (argc > 2 + skip_args && !strcmp (argv[1 + skip_args], "-l")) Vtop_level = Fcons (intern ("load"), Fcons (build_string (argv[2 + skip_args]), Qnil));#ifdef CANNOT_DUMP /* Unless next switch is -nl, load "loadup.el" first thing. */ if (!(argc > 1 + skip_args && !strcmp (argv[1 + skip_args], "-nl"))) Vtop_level = Fcons (intern ("load"), Fcons (build_string ("loadup.el"), Qnil));#endif /* CANNOT_DUMP */ } initialized = 1; /* Enter editor command loop. This never returns. */ Frecursive_edit (); /* NOTREACHED */}DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P", "Exit the Emacs job and kill it. ARG means no query.\n\If emacs is running noninteractively and ARG is an integer,\n\return ARG as the exit program code.") (arg) Lisp_Object arg;{ Lisp_Object answer; int i; struct gcpro gcpro1; GCPRO1 (arg); if (!NULL (Vkill_emacs_hook)) call0 (Vkill_emacs_hook); if (feof (stdin)) arg = Qt;#ifdef subprocesses kill_buffer_processes (Qnil);#endif /* subprocesses */#ifdef VMS kill_vms_processes ();#endif /* VMS */ Fdo_auto_save (Qt);#ifdef CLASH_DETECTION unlock_all_files ();#endif /* CLASH_DETECTION */ fflush (stdout); reset_sys_modes (); UNGCPRO;/* Is it really necessary to do this deassign when we are going to exit anyway? *//* #ifdef VMS stop_vms_input (); #endif */ stuff_buffered_input (arg);#ifdef SIGIO /* There is a tendency for a SIGIO signal to arrive within exit, and cause a SIGHUP because the input descriptor is already closed. */ unrequest_sigio (); signal (SIGIO, SIG_IGN);#endif exit ((XTYPE (arg) == Lisp_Int) ? XINT (arg)#ifdef VMS : 1#else : 0#endif ); /* NOTREACHED */}#ifndef CANNOT_DUMP/* Nothing like this can be implemented on an Apollo. What a loss! */#ifdef HAVE_SHMDEFUN ("dump-emacs-data", Fdump_emacs_data, Sdump_emacs_data, 1, 1, 0, "Dump current state of Emacs into data file FILENAME.\n\This function exists on systems that use HAVE_SHM.") (intoname) Lisp_Object intoname;{ extern int my_edata; Lisp_Object tem; extern void malloc_warning (); CHECK_STRING (intoname, 0); intoname = Fexpand_file_name (intoname, Qnil); tem = Vpurify_flag; Vpurify_flag = Qnil; fflush (stdout); /* Tell malloc where start of impure now is */ /* Also arrange for warnings when nearly out of space. */#ifndef SYSTEM_MALLOC malloc_init (&my_edata, malloc_warning);#endif map_out_data (XSTRING (intoname)->data); Vpurify_flag = tem; return Qnil;}#else /* not HAVE_SHM */DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0, "Dump current state of Emacs into executable file FILENAME.\n\Take symbols from SYMFILE (presumably the file you executed to run Emacs).") (intoname, symname) Lisp_Object intoname, symname;{ extern int my_edata; Lisp_Object tem; extern void malloc_warning (); CHECK_STRING (intoname, 0); intoname = Fexpand_file_name (intoname, Qnil); if (!NULL (symname)) { CHECK_STRING (symname, 0); if (XSTRING (symname)->size) symname = Fexpand_file_name (symname, Qnil); } tem = Vpurify_flag; Vpurify_flag = Qnil; fflush (stdout);#ifdef VMS mapout_data (XSTRING (intoname)->data);#else /* Tell malloc where start of impure now is */ /* Also arrange for warnings when nearly out of space. */#ifndef SYSTEM_MALLOC malloc_init (&my_edata, malloc_warning);#endif unexec (XSTRING (intoname)->data, !NULL (symname) ? XSTRING (symname)->data : 0, &my_edata, 0, 0);#endif /* not VMS */ Vpurify_flag = tem; return Qnil;}#endif /* not HAVE_SHM */#endif /* not CANNOT_DUMP */#ifdef VMS#define SEPCHAR ','#else#define SEPCHAR ':'#endifLisp_Objectdecode_env_path (evarname, defalt) char *evarname, *defalt;{ register char *path, *p; extern char *index (); Lisp_Object lpath; path = (char *) egetenv (evarname); if (!path) path = defalt; lpath = Qnil; while (1) { p = index (path, SEPCHAR); if (!p) p = path + strlen (path); lpath = Fcons (p - path ? make_string (path, p - path) : Qnil, lpath); if (*p) path = p + 1; else break; } return Fnreverse (lpath);}syms_of_emacs (){#ifndef CANNOT_DUMP#ifdef HAVE_SHM defsubr (&Sdump_emacs_data);#else defsubr (&Sdump_emacs);#endif#endif /* not CANNOT_DUMP */ defsubr (&Skill_emacs); DEFVAR_LISP ("command-line-args", &Vcommand_line_args, "Args passed by shell to Emacs, as a list of strings."); DEFVAR_LISP ("system-type", &Vsystem_type, "Symbol indicating type of operating system you are using."); Vsystem_type = intern (SYSTEM_TYPE); DEFVAR_BOOL ("noninteractive", &noninteractive1, "Non-nil means Emacs is running without interactive terminal."); Vkill_emacs_hook = Qnil; DEFVAR_LISP ("kill-emacs-hook", &Vkill_emacs_hook, "Function called, if non-nil, whenever kill-emacs is called.");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -