]> code.delx.au - gnu-emacs/commitdiff
Prefer 'Qfoo' to 'intern ("foo")'
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 21 Feb 2015 08:26:13 +0000 (00:26 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 21 Feb 2015 08:27:00 +0000 (00:27 -0800)
* 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.

20 files changed:
src/ChangeLog
src/buffer.c
src/bytecode.c
src/callint.c
src/callproc.c
src/charset.c
src/coding.c
src/editfns.c
src/emacs.c
src/fns.c
src/frame.c
src/ftfont.c
src/keyboard.c
src/keymap.c
src/minibuf.c
src/nsfns.m
src/textprop.c
src/xdisp.c
src/xfns.c
src/xml.c

index dc33e417ef402113804320b61d4c476b4f50829d..1692c3f6f7052d18edcc4f0cdb01b3fb42005062 100644 (file)
@@ -1,3 +1,32 @@
+2015-02-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <jan.h.d@swipnet.se>
 
        * emacs.c (terminate_due_to_signal): Move totally_unblock_input after
index 67eda3ee89ee1bd4bf7ad52d0bf6b616010e55e3..371588b3093df2ec3a488214739b3c7d2b1395ae 100644 (file)
@@ -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);
 }
index b4583676835b746e0880f4d24281fd6408ada5f5..55789b41ad994f051669b7208970de837731b92d 100644 (file)
@@ -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):
index 60021fdfc8299870c8b8571093f9ce2657b8588f..0c6c03036c8167306b47a8e4ac24276e717a61af 100644 (file)
@@ -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);
              }
index 63ab9bf70db870015d8e79aa4c231f93c3d81519..e1fe8ed95dfc49c853b202b82597b15adafa0b2e 100644 (file)
@@ -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);
index 908084074fd7e21a6e38bbc4e929bc016e179a44..f1aa07471c52b62dab6ab7967afa7a1f4ce5e64e 100644 (file)
@@ -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]);
index 1a0e12796486c77f6b88666eac69f527bd0a3ea6..4b41355595c0e4708b7014441b32b3f4035db904 100644 (file)
@@ -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,
index c205ca3688f6d4f15edb035b870ee3dfd725fff2..dbcb3160b2734e60bb28b17ffce254e259c54b5c 100644 (file)
@@ -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);
   }
 
index 590579907ff55405a6273998ee9ded5bd5e811d1..4a6d6badf286a2b90edb0e6d58702d9c7f52aa10 100644 (file)
@@ -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,
index 4c7095133eb73253524caa13c74eccb0de4885aa..51f61d23881a5097f2a9f56dc8dfc2f6ef82144a 100644 (file)
--- 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");
 
index 92b6b7c73ba16c4083c26735c15182b16d393afa..d82df0912b4bf6ce357a15689e29338b8904e856 100644 (file)
@@ -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"
index adf188815de3af811bab131620c33c6ce19e684a..26740c263ce08128e0335d5207da61c03695a796 100644 (file)
@@ -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");
 
index ab57553e7d379a39bdab2baa1ec132347f539315..c2174539ea747a96e969aa2a63e19aebad4e53a8 100644 (file)
@@ -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.  */);
index 34fe1cb7a95ca792698c91b76d013428fd146912..d10c00489d104631175f5892d905b08570d1ef82 100644 (file)
@@ -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"),
index 3408bb995c61f200439d1417df8769572a80174c..2dc5c544457cfcfcf7f630ac5d190d3bd9307d1d 100644 (file)
@@ -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.
index cc2e49641e85a2c0300ad4977c42ef579d037ec7..9e379e284292c1532c3a137b0218f1d88e412215 100644 (file)
@@ -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");
     }
index 35f22bf454e6467be43e73b4482127149d0f5b2c..740b96227cfcb9c55a2c82eb06ad44c58d580e13 100644 (file)
@@ -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);
index 57a5631c0e30c49e066084038208ad183579368e..3f57841ac13a0ddc3d7b649f83682b090854a95e 100644 (file)
@@ -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
index 629ac4b26ffe6690c47b71bd36a409682ab1fdd1..80be6ac257c2c14554f214331d0295ca23fa9126 100644 (file)
@@ -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));
index e32417724ce1d738636d12e55abaa8ac661f028b..a3f923957929829aceb10b58f14ed9cbd3745113 100644 (file)
--- 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);
     }