From: Paul Eggert Date: Sat, 21 Feb 2015 08:26:13 +0000 (-0800) Subject: Prefer 'Qfoo' to 'intern ("foo")' X-Git-Tag: emacs-25.0.90~2564^2~331 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3ebf06300b8186feac5e9b436ca263dc908ed886;p=emacs.git Prefer 'Qfoo' to 'intern ("foo")' * buffer.c (syms_of_buffer): * bytecode.c (exec_byte_code): * callint.c (Fcall_interactively): * callproc.c (create_temp_file): * charset.c (define_charset_internal): * coding.c (syms_of_coding): * editfns.c (syms_of_editfns): * emacs.c (main): * fns.c (syms_of_fns): * frame.c (delete_frame, Fframe_parameters): * keyboard.c (syms_of_keyboard): * keymap.c (syms_of_keymap): * minibuf.c (read_minibuf, syms_of_minibuf): * nsfns.m (ns_cursor_type_to_lisp): * textprop.c (syms_of_textprop): * xdisp.c (Fformat_mode_line, syms_of_xdisp): * xfns.c (x_create_tip_frame, Fx_select_font): * xml.c (parse_region): Prefer constants like 'Qfoo' to calls like 'intern ("foo")'. * buffer.c (syms_of_buffer): OK to do (put 'erase-buffer 'disabled t) here now ... (keys_of_buffer): ... instead of here. * ftfont.c (syms_of_ftfont): Move DEFSYM of Qmono from here ... * xfns.c (syms_of_xfns): ... to here, since ftfont.c is more optional than xfns.c. --- diff --git a/src/ChangeLog b/src/ChangeLog index dc33e417ef4..1692c3f6f70 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,32 @@ +2015-02-21 Paul Eggert + + Prefer 'Qfoo' to 'intern ("foo")' + * buffer.c (syms_of_buffer): + * bytecode.c (exec_byte_code): + * callint.c (Fcall_interactively): + * callproc.c (create_temp_file): + * charset.c (define_charset_internal): + * coding.c (syms_of_coding): + * editfns.c (syms_of_editfns): + * emacs.c (main): + * fns.c (syms_of_fns): + * frame.c (delete_frame, Fframe_parameters): + * keyboard.c (syms_of_keyboard): + * keymap.c (syms_of_keymap): + * minibuf.c (read_minibuf, syms_of_minibuf): + * nsfns.m (ns_cursor_type_to_lisp): + * textprop.c (syms_of_textprop): + * xdisp.c (Fformat_mode_line, syms_of_xdisp): + * xfns.c (x_create_tip_frame, Fx_select_font): + * xml.c (parse_region): + Prefer constants like 'Qfoo' to calls like 'intern ("foo")'. + * buffer.c (syms_of_buffer): OK to do (put 'erase-buffer 'disabled + t) here now ... + (keys_of_buffer): ... instead of here. + * ftfont.c (syms_of_ftfont): Move DEFSYM of Qmono from here ... + * xfns.c (syms_of_xfns): ... to here, since ftfont.c is more + optional than xfns.c. + 2015-02-20 Jan Djärv * emacs.c (terminate_due_to_signal): Move totally_unblock_input after diff --git a/src/buffer.c b/src/buffer.c index 67eda3ee89e..371588b3093 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5408,7 +5408,7 @@ syms_of_buffer (void) DEFSYM (Qoverwrite_mode, "overwrite-mode"); Fput (Qoverwrite_mode, Qchoice, list3 (Qnil, intern ("overwrite-mode-textual"), - intern ("overwrite-mode-binary"))); + Qoverwrite_mode_binary)); Fput (Qprotected_field, Qerror_conditions, listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror)); @@ -6326,6 +6326,8 @@ Functions running this hook are, `get-buffer-create', defsubr (&Soverlay_get); defsubr (&Soverlay_put); defsubr (&Srestore_buffer_modified_p); + + Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt); } void @@ -6333,8 +6335,4 @@ keys_of_buffer (void) { initial_define_key (control_x_map, 'b', "switch-to-buffer"); initial_define_key (control_x_map, 'k', "kill-buffer"); - - /* This must not be in syms_of_buffer, because Qdisabled is not - initialized when that function gets called. */ - Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt); } diff --git a/src/bytecode.c b/src/bytecode.c index b4583676835..55789b41ad9 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1945,10 +1945,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, /* Actually this is Bstack_ref with offset 0, but we use Bdup for that instead. */ /* CASE (Bstack_ref): */ - call3 (intern ("error"), - build_string ("Invalid byte opcode: op=%s, ptr=%d"), - make_number (op), - make_number ((stack.pc - 1) - stack.byte_string_start)); + call3 (Qerror, + build_string ("Invalid byte opcode: op=%s, ptr=%d"), + make_number (op), + make_number ((stack.pc - 1) - stack.byte_string_start)); /* Handy byte-codes for lexical binding. */ CASE (Bstack_ref1): diff --git a/src/callint.c b/src/callint.c index 60021fdfc82..0c6c03036c8 100644 --- a/src/callint.c +++ b/src/callint.c @@ -615,9 +615,9 @@ invoke it. If KEYS is omitted or nil, the return value of { Lisp_Object tem2; - teml = Fget (teml, intern ("event-symbol-elements")); + teml = Fget (teml, Qevent_symbol_elements); /* Ignore first element, which is the base key. */ - tem2 = Fmemq (intern ("down"), Fcdr (teml)); + tem2 = Fmemq (Qdown, Fcdr (teml)); if (! NILP (tem2)) up_event = Fread_event (Qnil, Qnil, Qnil); } @@ -647,9 +647,9 @@ invoke it. If KEYS is omitted or nil, the return value of { Lisp_Object tem2; - teml = Fget (teml, intern ("event-symbol-elements")); + teml = Fget (teml, Qevent_symbol_elements); /* Ignore first element, which is the base key. */ - tem2 = Fmemq (intern ("down"), Fcdr (teml)); + tem2 = Fmemq (Qdown, Fcdr (teml)); if (! NILP (tem2)) up_event = Fread_event (Qnil, Qnil, Qnil); } diff --git a/src/callproc.c b/src/callproc.c index 63ab9bf70db..e1fe8ed95df 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1020,7 +1020,7 @@ create_temp_file (ptrdiff_t nargs, Lisp_Object *args, specbind (intern ("coding-system-for-write"), val); /* POSIX lets mk[s]temp use "."; don't invoke jka-compr if we happen to get a ".Z" suffix. */ - specbind (intern ("file-name-handler-alist"), Qnil); + specbind (Qfile_name_handler_alist, Qnil); write_region (start, end, filename_string, Qnil, Qlambda, Qnil, Qnil, fd); unbind_to (count1, Qnil); diff --git a/src/charset.c b/src/charset.c index 908084074fd..f1aa07471c5 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1268,7 +1268,7 @@ define_charset_internal (Lisp_Object name, args[charset_arg_plist] = listn (CONSTYPE_HEAP, 14, - intern_c_string (":name"), + QCname, args[charset_arg_name], intern_c_string (":dimension"), args[charset_arg_dimension], @@ -1278,7 +1278,7 @@ define_charset_internal (Lisp_Object name, args[charset_arg_iso_final], intern_c_string (":emacs-mule-id"), args[charset_arg_emacs_mule_id], - intern_c_string (":ascii-compatible-p"), + QCascii_compatible_p, args[charset_arg_ascii_compatible_p], intern_c_string (":code-offset"), args[charset_arg_code_offset]); diff --git a/src/coding.c b/src/coding.c index 1a0e1279648..4b41355595c 100644 --- a/src/coding.c +++ b/src/coding.c @@ -11281,15 +11281,15 @@ internal character representation. */); Lisp_Object plist[] = { - intern_c_string (":name"), + QCname, args[coding_arg_name] = Qno_conversion, - intern_c_string (":mnemonic"), + QCmnemonic, args[coding_arg_mnemonic] = make_number ('='), intern_c_string (":coding-type"), args[coding_arg_coding_type] = Qraw_text, - intern_c_string (":ascii-compatible-p"), + QCascii_compatible_p, args[coding_arg_ascii_compatible_p] = Qt, - intern_c_string (":default-char"), + QCdefault_char, args[coding_arg_default_char] = make_number (0), intern_c_string (":for-unibyte"), args[coding_arg_for_unibyte] = Qt, diff --git a/src/editfns.c b/src/editfns.c index c205ca3688f..dbcb3160b27 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4973,8 +4973,7 @@ of the buffer being accessed. */); /* Do this here, because init_buffer_once is too early--it won't work. */ Fset_buffer (Vprin1_to_string_buffer); /* Make sure buffer-access-fontify-functions is nil in this buffer. */ - Fset (Fmake_local_variable (intern_c_string ("buffer-access-fontify-functions")), - Qnil); + Fset (Fmake_local_variable (Qbuffer_access_fontify_functions), Qnil); Fset_buffer (obuf); } diff --git a/src/emacs.c b/src/emacs.c index 590579907ff..4a6d6badf28 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1570,13 +1570,11 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem if (filename_from_ansi (file, file_utf8) == 0) file = file_utf8; #endif - Vtop_level = list2 (intern_c_string ("load"), - build_unibyte_string (file)); + Vtop_level = list2 (Qload, build_unibyte_string (file)); } /* Unless next switch is -nl, load "loadup.el" first thing. */ if (! no_loadup) - Vtop_level = list2 (intern_c_string ("load"), - build_string ("loadup.el")); + Vtop_level = list2 (Qload, build_string ("loadup.el")); } /* Set up for profiling. This is known to work on FreeBSD, diff --git a/src/fns.c b/src/fns.c index 4c7095133eb..51f61d23881 100644 --- a/src/fns.c +++ b/src/fns.c @@ -5093,7 +5093,7 @@ syms_of_fns (void) DEFVAR_LISP ("features", Vfeatures, doc: /* A list of symbols which are the features of the executing Emacs. Used by `featurep' and `require', and altered by `provide'. */); - Vfeatures = list1 (intern_c_string ("emacs")); + Vfeatures = list1 (Qemacs); DEFSYM (Qsubfeatures, "subfeatures"); DEFSYM (Qfuncall, "funcall"); diff --git a/src/frame.c b/src/frame.c index 92b6b7c73ba..d82df0912b4 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1544,7 +1544,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) } } - is_tooltip_frame = !NILP (Fframe_parameter (frame, intern ("tooltip"))); + is_tooltip_frame = !NILP (Fframe_parameter (frame, Qtooltip)); /* Run `delete-frame-functions' unless FORCE is `noelisp' or frame is a tooltip. FORCE is set to `noelisp' when handling @@ -2533,7 +2533,7 @@ If FRAME is omitted or nil, return information on the currently selected frame. else store_in_alist (&alist, Qbackground_color, tty_color_name (f, FRAME_BACKGROUND_PIXEL (f))); - store_in_alist (&alist, intern ("font"), + store_in_alist (&alist, Qfont, build_string (FRAME_MSDOS_P (f) ? "ms-dos" : FRAME_W32_P (f) ? "w32term" diff --git a/src/ftfont.c b/src/ftfont.c index adf188815de..26740c263ce 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -2659,7 +2659,6 @@ syms_of_ftfont (void) DEFSYM (Qmonospace, "monospace"); DEFSYM (Qsans_serif, "sans-serif"); DEFSYM (Qserif, "serif"); - DEFSYM (Qmono, "mono"); DEFSYM (Qsans, "sans"); DEFSYM (Qsans__serif, "sans serif"); diff --git a/src/keyboard.c b/src/keyboard.c index ab57553e7d3..c2174539ea7 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11598,7 +11598,7 @@ and the minor mode maps regardless of `overriding-local-map'. */); DEFVAR_LISP ("special-event-map", Vspecial_event_map, doc: /* Keymap defining bindings for special events to execute at low level. */); - Vspecial_event_map = list1 (intern_c_string ("keymap")); + Vspecial_event_map = list1 (Qkeymap); DEFVAR_LISP ("track-mouse", do_mouse_tracking, doc: /* Non-nil means generate motion events for mouse motion. */); diff --git a/src/keymap.c b/src/keymap.c index 34fe1cb7a95..d10c00489d1 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -3730,8 +3730,8 @@ be preferred. */); staticpro (&Vmouse_events); Vmouse_events = listn (CONSTYPE_PURE, 9, Qmenu_bar, - intern_c_string ("tool-bar"), - intern_c_string ("header-line"), + Qtool_bar, + Qheader_line, Qmode_line, intern_c_string ("mouse-1"), intern_c_string ("mouse-2"), diff --git a/src/minibuf.c b/src/minibuf.c index 3408bb995c6..2dc5c544457 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -395,7 +395,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, Lisp_Object dummy, frame; specbind (Qminibuffer_default, defalt); - specbind (intern ("inhibit-read-only"), Qnil); + specbind (Qinhibit_read_only, Qnil); /* If Vminibuffer_completing_file_name is `lambda' on entry, it was t in previous recursive minibuffer, but was not set explicitly @@ -2070,9 +2070,7 @@ with completion; they always discard text properties. */); doc: /* Text properties that are added to minibuffer prompts. These are in addition to the basic `field' property, and stickiness properties. */); - /* We use `intern' here instead of Qread_only to avoid - initialization-order problems. */ - Vminibuffer_prompt_properties = list2 (intern_c_string ("read-only"), Qt); + Vminibuffer_prompt_properties = list2 (Qread_only, Qt); DEFVAR_LISP ("read-hide-char", Vread_hide_char, doc: /* Whether to hide input characters in noninteractive mode. diff --git a/src/nsfns.m b/src/nsfns.m index cc2e49641e8..9e379e28429 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -849,9 +849,9 @@ ns_cursor_type_to_lisp (int arg) switch (arg) { case FILLED_BOX_CURSOR: return Qbox; - case HOLLOW_BOX_CURSOR: return intern ("hollow"); - case HBAR_CURSOR: return intern ("hbar"); - case BAR_CURSOR: return intern ("bar"); + case HOLLOW_BOX_CURSOR: return Qhollow; + case HBAR_CURSOR: return Qhbar; + case BAR_CURSOR: return Qbar; case NO_CURSOR: default: return intern ("no"); } diff --git a/src/textprop.c b/src/textprop.c index 35f22bf454e..740b96227cf 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -2356,8 +2356,7 @@ inherits it if NONSTICKINESS is nil. The `front-sticky' and /* Text properties `syntax-table'and `display' should be nonsticky by default. */ Vtext_property_default_nonsticky - = list2 (Fcons (intern_c_string ("syntax-table"), Qt), - Fcons (intern_c_string ("display"), Qt)); + = list2 (Fcons (Qsyntax_table, Qt), Fcons (Qdisplay, Qt)); staticpro (&interval_insert_behind_hooks); staticpro (&interval_insert_in_front_hooks); diff --git a/src/xdisp.c b/src/xdisp.c index 57a5631c0e3..3f57841ac13 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22656,7 +22656,7 @@ are the selected window and the WINDOW's buffer). */) else { mode_line_string_list = Fnreverse (mode_line_string_list); - str = Fmapconcat (intern ("identity"), mode_line_string_list, + str = Fmapconcat (Qidentity, mode_line_string_list, empty_unibyte_string); } @@ -30491,8 +30491,7 @@ syms_of_xdisp (void) DEFSYM (Qinhibit_free_realized_faces, "inhibit-free-realized-faces"); - list_of_error = list1 (list2 (intern_c_string ("error"), - intern_c_string ("void-variable"))); + list_of_error = list1 (list2 (Qerror, Qvoid_variable)); staticpro (&list_of_error); /* Values of those variables at last redisplay are stored as diff --git a/src/xfns.c b/src/xfns.c index 629ac4b26ff..80be6ac257c 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5185,7 +5185,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object disptype; if (FRAME_DISPLAY_INFO (f)->n_planes == 1) - disptype = intern ("mono"); + disptype = Qmono; else if (FRAME_DISPLAY_INFO (f)->visual->class == GrayScale || FRAME_DISPLAY_INFO (f)->visual->class == StaticGray) disptype = intern ("grayscale"); @@ -6007,7 +6007,7 @@ nil, it defaults to the selected frame. */) GCPRO2 (font_param, font); XSETFONT (font, FRAME_FONT (f)); - font_param = Ffont_get (font, intern (":name")); + font_param = Ffont_get (font, QCname); if (STRINGP (font_param)) default_name = xlispstrdup (font_param); else @@ -6194,6 +6194,7 @@ syms_of_xfns (void) DEFSYM (Qcompound_text, "compound-text"); DEFSYM (Qcancel_timer, "cancel-timer"); DEFSYM (Qfont_param, "font-parameter"); + DEFSYM (Qmono, "mono"); Fput (Qundefined_color, Qerror_conditions, listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror)); diff --git a/src/xml.c b/src/xml.c index e32417724ce..a3f92395792 100644 --- a/src/xml.c +++ b/src/xml.c @@ -237,8 +237,7 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, if (node != NULL) result = make_dom (node); } else - result = Fcons (intern ("top"), - Fcons (Qnil, Fnreverse (Fcons (r, result)))); + result = Fcons (Qtop, Fcons (Qnil, Fnreverse (Fcons (r, result)))); xmlFreeDoc (doc); }