diff options
| author | Po Lu | 2024-05-09 14:58:45 +0800 |
|---|---|---|
| committer | Po Lu | 2024-05-09 15:07:22 +0800 |
| commit | 67ab6bcdbac572a6266d7c9d15833bd2ddd049fa (patch) | |
| tree | 3469eaa3f625da33e3c5c5e0e91cc5c202552c81 /src/buffer.c | |
| parent | 9b7dd30807ed4be9afe4f66cfa5130aa7d178989 (diff) | |
| download | emacs-67ab6bcdbac572a6266d7c9d15833bd2ddd049fa.tar.gz emacs-67ab6bcdbac572a6266d7c9d15833bd2ddd049fa.zip | |
Replace calls to intern with a constant string with DEFSYMs
* src/alloc.c (display_malloc_warning, syms_of_alloc):
* src/buffer.c (Fmake_indirect_buffer, Fbuffer_local_variables)
(Frename_buffer, Fkill_buffer, Fset_buffer_major_mode)
(Fset_buffer_multibyte, syms_of_buffer):
* src/callint.c (read_file_name, Fcall_interactively)
(syms_of_callint):
* src/callproc.c (call_process, create_temp_file)
(syms_of_callproc):
* src/charset.c (Fdefine_charset_internal, syms_of_charset):
* src/cmds.c (internal_self_insert, syms_of_cmds):
* src/coding.c (record_conversion_result)
(Fdefine_coding_system_internal, syms_of_coding):
* src/dbusbind.c (xd_signature, Fdbus_message_internal)
(syms_of_dbusbind):
* src/dispnew.c (init_faces_initial):
* src/doc.c (Fsnarf_documentation, syms_of_doc):
* src/dosfns.c (system_process_attributes, syms_of_dosfns):
* src/emacs.c (init_cmdargs, Fdump_emacs, decode_env_path)
(syms_of_emacs):
* src/eval.c (call_debugger, Fdefvaralias, syms_of_eval):
* src/fileio.c (barf_or_query_if_file_exists)
(Finsert_file_contents, auto_save_error, Fdo_auto_save)
(syms_of_fileio):
* src/filelock.c (lock_file_1, syms_of_filelock):
* src/fontset.c (fontset_from_font, syms_of_fontset):
* src/frame.c (make_frame_without_minibuffer, syms_of_frame):
* src/gnutls.c (emacs_gnutls_certificate_details)
(Fgnutls_peer_status_warning_describe, Fgnutls_peer_status)
(gnutls_verify_boot, syms_of_gnutls):
* src/gtkutil.c (style_changed_cb, find_rtl_image):
* src/image.c (imagemagick_filename_hint, gs_load)
(syms_of_image):
* src/keyboard.c (command_loop_1, read_char, timer_start_idle)
(read_char_minibuf_menu_prompt, Fsuspend_emacs)
(syms_of_keyboard):
* src/keymap.c (Fmap_keymap, Flookup_key, Fdescribe_vector)
(describe_vector, syms_of_keymap):
* src/lread.c (Fread, Fread_positioning_symbols, syms_of_lread):
* src/minibuf.c (Fabort_minibuffers, Fread_buffer)
(Fcompleting_read, syms_of_minibuf):
* src/msdos.c (XMenuActivate, run_msdos_command, syms_of_msdos):
* src/nsfns.m (Fx_display_backing_store, Fx_display_visual_class)
(Fns_hide_emacs, Fsystem_move_file_to_trash, ns_create_tip_frame)
(x_hide_tip, Fx_show_tip, syms_of_nsfns):
* src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity)
(syms_of_nsfont):
* src/pdumper.c (Fdump_emacs_portable):
* src/pgtkfns.c (Fx_display_visual_class, x_create_tip_frame)
(Fx_show_tip, syms_of_pgtkfns):
* src/pgtkterm.c (syms_of_pgtkterm, pgtk_cr_export_frames):
* src/term.c (term_get_fkeys_1, set_tty_color_mode, Fsuspend_tty)
(Fresume_tty, tty_menu_activate, syms_of_term):
* src/terminal.c (create_terminal, syms_of_terminal):
* src/w32fns.c (Fx_display_backing_store)
(Fx_display_visual_class, Fset_message_beep, Fx_open_connection)
(Fx_show_tip, Fx_file_dialog, Fsystem_move_file_to_trash)
(Fw32_toggle_lock_key, syms_of_w32fns):
* src/w32font.c (w32_enumfont_pattern_entity, syms_of_w32font):
* src/w32term.c (w32_bitmap_icon, syms_of_w32term):
* src/xdisp.c (message_dolog, define_frame_cursor1)
(syms_of_xdisp):
* src/xfaces.c (tty_lookup_color, syms_of_xfaces):
* src/xml.c (make_dom, syms_of_xml):
* src/xterm.c (syms_of_xterm):
* src/xwidget.c (store_xwidget_download_callback_event)
(store_xwidget_js_callback_event, syms_of_xwidget): Define
symbols for symbols interned with `intern' from a constant
string, delete duplicate DEFSYM directives, and substitute them
for such calls to intern. This excludes only those symbols
which are interned and referenced only once during Emacs's
initialization, the timing of whose interning is
inconsequential, and symbols in w32.c, which would need to be
transferred to a new syms_of_w32 function that I cannot test.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/buffer.c b/src/buffer.c index 291c7d3f911..8f983692124 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -931,8 +931,8 @@ Interactively, CLONE and INHIBIT-BUFFER-HOOKS are nil. */) | |||
| 931 | bset_local_minor_modes (b, Qnil); | 931 | bset_local_minor_modes (b, Qnil); |
| 932 | bset_auto_save_file_name (b, Qnil); | 932 | bset_auto_save_file_name (b, Qnil); |
| 933 | set_buffer_internal_1 (b); | 933 | set_buffer_internal_1 (b); |
| 934 | Fset (intern ("buffer-save-without-query"), Qnil); | 934 | Fset (Qbuffer_save_without_query, Qnil); |
| 935 | Fset (intern ("buffer-file-number"), Qnil); | 935 | Fset (Qbuffer_file_number, Qnil); |
| 936 | if (!NILP (Flocal_variable_p (Qbuffer_stale_function, base_buffer))) | 936 | if (!NILP (Flocal_variable_p (Qbuffer_stale_function, base_buffer))) |
| 937 | Fkill_local_variable (Qbuffer_stale_function); | 937 | Fkill_local_variable (Qbuffer_stale_function); |
| 938 | /* Cloned buffers need extra setup, to do things such as deep | 938 | /* Cloned buffers need extra setup, to do things such as deep |
| @@ -1477,7 +1477,7 @@ No argument or nil as argument means use current buffer as BUFFER. */) | |||
| 1477 | } | 1477 | } |
| 1478 | 1478 | ||
| 1479 | tem = buffer_local_variables_1 (buf, PER_BUFFER_VAR_OFFSET (undo_list), | 1479 | tem = buffer_local_variables_1 (buf, PER_BUFFER_VAR_OFFSET (undo_list), |
| 1480 | intern ("buffer-undo-list")); | 1480 | Qbuffer_undo_list); |
| 1481 | if (!NILP (tem)) | 1481 | if (!NILP (tem)) |
| 1482 | result = Fcons (tem, result); | 1482 | result = Fcons (tem, result); |
| 1483 | 1483 | ||
| @@ -1704,11 +1704,11 @@ This does not change the name of the visited file (if any). */) | |||
| 1704 | Fsetcar (Frassq (buf, Vbuffer_alist), newname); | 1704 | Fsetcar (Frassq (buf, Vbuffer_alist), newname); |
| 1705 | if (NILP (BVAR (current_buffer, filename)) | 1705 | if (NILP (BVAR (current_buffer, filename)) |
| 1706 | && !NILP (BVAR (current_buffer, auto_save_file_name))) | 1706 | && !NILP (BVAR (current_buffer, auto_save_file_name))) |
| 1707 | call0 (intern ("rename-auto-save-file")); | 1707 | call0 (Qrename_auto_save_file); |
| 1708 | 1708 | ||
| 1709 | run_buffer_list_update_hook (current_buffer); | 1709 | run_buffer_list_update_hook (current_buffer); |
| 1710 | 1710 | ||
| 1711 | call2 (intern ("uniquify--rename-buffer-advice"), | 1711 | call2 (Quniquify__rename_buffer_advice, |
| 1712 | requestedname, unique); | 1712 | requestedname, unique); |
| 1713 | 1713 | ||
| 1714 | /* Refetch since that last call may have done GC. */ | 1714 | /* Refetch since that last call may have done GC. */ |
| @@ -1956,7 +1956,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1956 | { | 1956 | { |
| 1957 | tem = do_yes_or_no_p (build_string ("Delete auto-save file? ")); | 1957 | tem = do_yes_or_no_p (build_string ("Delete auto-save file? ")); |
| 1958 | if (!NILP (tem)) | 1958 | if (!NILP (tem)) |
| 1959 | call0 (intern ("delete-auto-save-file-if-necessary")); | 1959 | call0 (Qdelete_auto_save_file_if_necessary); |
| 1960 | } | 1960 | } |
| 1961 | 1961 | ||
| 1962 | /* If the hooks have killed the buffer, exit now. */ | 1962 | /* If the hooks have killed the buffer, exit now. */ |
| @@ -2251,7 +2251,7 @@ the current buffer's major mode. */) | |||
| 2251 | error ("Attempt to set major mode for a dead buffer"); | 2251 | error ("Attempt to set major mode for a dead buffer"); |
| 2252 | 2252 | ||
| 2253 | if (strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0) | 2253 | if (strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0) |
| 2254 | function = find_symbol_value (intern ("initial-major-mode")); | 2254 | function = find_symbol_value (Qinitial_major_mode); |
| 2255 | else | 2255 | else |
| 2256 | { | 2256 | { |
| 2257 | function = BVAR (&buffer_defaults, major_mode); | 2257 | function = BVAR (&buffer_defaults, major_mode); |
| @@ -2936,7 +2936,7 @@ current buffer is cleared. */) | |||
| 2936 | /* Represent all the above changes by a special undo entry. */ | 2936 | /* Represent all the above changes by a special undo entry. */ |
| 2937 | bset_undo_list (current_buffer, | 2937 | bset_undo_list (current_buffer, |
| 2938 | Fcons (list3 (Qapply, | 2938 | Fcons (list3 (Qapply, |
| 2939 | intern ("set-buffer-multibyte"), | 2939 | Qset_buffer_multibyte, |
| 2940 | NILP (flag) ? Qt : Qnil), | 2940 | NILP (flag) ? Qt : Qnil), |
| 2941 | old_undo)); | 2941 | old_undo)); |
| 2942 | } | 2942 | } |
| @@ -6112,4 +6112,13 @@ There is no reason to change that value except for debugging purposes. */); | |||
| 6112 | DEFSYM (Qbuffer_stale_function, "buffer-stale-function"); | 6112 | DEFSYM (Qbuffer_stale_function, "buffer-stale-function"); |
| 6113 | 6113 | ||
| 6114 | Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt); | 6114 | Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt); |
| 6115 | |||
| 6116 | DEFSYM (Qbuffer_save_without_query, "buffer-save-without-query"); | ||
| 6117 | DEFSYM (Qbuffer_file_number, "buffer-file-number"); | ||
| 6118 | DEFSYM (Qbuffer_undo_list, "buffer-undo-list"); | ||
| 6119 | DEFSYM (Qrename_auto_save_file, "rename-auto-save-file"); | ||
| 6120 | DEFSYM (Quniquify__rename_buffer_advice, "uniquify--rename-buffer-advice"); | ||
| 6121 | DEFSYM (Qdelete_auto_save_file_if_necessary, "delete-auto-save-file-if-necessary"); | ||
| 6122 | DEFSYM (Qinitial_major_mode, "initial-major-mode"); | ||
| 6123 | DEFSYM (Qset_buffer_multibyte, "set-buffer-multibyte"); | ||
| 6115 | } | 6124 | } |