]> code.delx.au - gnu-emacs/blobdiff - src/eval.c
* doc/lispref/modes.texi (Defining Minor Modes): Use C-backspace, not C-delete.
[gnu-emacs] / src / eval.c
index 136b75f756be51822870334ab0ece8dfbcc99aa8..6609d3b5c8adafc23dd3a1fdb22e2cb6c5b5c656 100644 (file)
@@ -1,6 +1,6 @@
 /* Evaluator for GNU Emacs Lisp interpreter.
    Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001,
-                 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+                 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
                  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -2127,16 +2127,13 @@ this does nothing and returns nil.  */)
     /* Only add entries after dumping, because the ones before are
        not useful and else we get loads of them from the loaddefs.el.  */
     LOADHIST_ATTACH (Fcons (Qautoload, function));
-
-  if (NILP (Vpurify_flag))
-    args[0] = file;
   else
-    args[0] = Fpurecopy (file);
-  args[1] = docstring;
-  args[2] = interactive;
-  args[3] = type;
-
-  return Ffset (function, Fcons (Qautoload, Flist (4, &args[0])));
+    /* We don't want the docstring in purespace (instead,
+       Snarf-documentation should (hopefully) overwrite it).  */
+    docstring = make_number (0);
+  return Ffset (function,
+               Fpurecopy (list5 (Qautoload, file, docstring,
+                                 interactive, type)));
 }
 
 Lisp_Object
@@ -2623,7 +2620,6 @@ run_hook_with_args (nargs, args, cond)
      enum run_hooks_condition cond;
 {
   Lisp_Object sym, val, ret;
-  Lisp_Object globals;
   struct gcpro gcpro1, gcpro2, gcpro3;
 
   /* If we are dying or still initializing,
@@ -2644,7 +2640,7 @@ run_hook_with_args (nargs, args, cond)
     }
   else
     {
-      globals = Qnil;
+      Lisp_Object globals = Qnil;
       GCPRO3 (sym, val, globals);
 
       for (;
@@ -2657,18 +2653,28 @@ run_hook_with_args (nargs, args, cond)
            {
              /* t indicates this hook has a local binding;
                 it means to run the global binding too.  */
+             globals = Fdefault_value (sym);
+             if (NILP (globals)) continue;
 
-             for (globals = Fdefault_value (sym);
-                  CONSP (globals) && ((cond == to_completion)
-                                      || (cond == until_success ? NILP (ret)
-                                          : !NILP (ret)));
-                  globals = XCDR (globals))
+             if (!CONSP (globals) || EQ (XCAR (globals), Qlambda))
+               {
+                 args[0] = globals;
+                 ret = Ffuncall (nargs, args);
+               }
+             else
                {
-                 args[0] = XCAR (globals);
-                 /* In a global value, t should not occur.  If it does, we
-                    must ignore it to avoid an endless loop.  */
-                 if (!EQ (args[0], Qt))
-                   ret = Ffuncall (nargs, args);
+                 for (;
+                      CONSP (globals) && ((cond == to_completion)
+                                          || (cond == until_success ? NILP (ret)
+                                              : !NILP (ret)));
+                      globals = XCDR (globals))
+                   {
+                     args[0] = XCAR (globals);
+                     /* In a global value, t should not occur.  If it does, we
+                        must ignore it to avoid an endless loop.  */
+                     if (!EQ (args[0], Qt))
+                       ret = Ffuncall (nargs, args);
+                   }
                }
            }
          else
@@ -3586,42 +3592,42 @@ To prevent this happening, set `quit-flag' to nil
 before making `inhibit-quit' nil.  */);
   Vinhibit_quit = Qnil;
 
-  Qinhibit_quit = intern ("inhibit-quit");
+  Qinhibit_quit = intern_c_string ("inhibit-quit");
   staticpro (&Qinhibit_quit);
 
-  Qautoload = intern ("autoload");
+  Qautoload = intern_c_string ("autoload");
   staticpro (&Qautoload);
 
-  Qdebug_on_error = intern ("debug-on-error");
+  Qdebug_on_error = intern_c_string ("debug-on-error");
   staticpro (&Qdebug_on_error);
 
-  Qmacro = intern ("macro");
+  Qmacro = intern_c_string ("macro");
   staticpro (&Qmacro);
 
-  Qdeclare = intern ("declare");
+  Qdeclare = intern_c_string ("declare");
   staticpro (&Qdeclare);
 
   /* Note that the process handling also uses Qexit, but we don't want
      to staticpro it twice, so we just do it here.  */
-  Qexit = intern ("exit");
+  Qexit = intern_c_string ("exit");
   staticpro (&Qexit);
 
-  Qinteractive = intern ("interactive");
+  Qinteractive = intern_c_string ("interactive");
   staticpro (&Qinteractive);
 
-  Qcommandp = intern ("commandp");
+  Qcommandp = intern_c_string ("commandp");
   staticpro (&Qcommandp);
 
-  Qdefun = intern ("defun");
+  Qdefun = intern_c_string ("defun");
   staticpro (&Qdefun);
 
-  Qand_rest = intern ("&rest");
+  Qand_rest = intern_c_string ("&rest");
   staticpro (&Qand_rest);
 
-  Qand_optional = intern ("&optional");
+  Qand_optional = intern_c_string ("&optional");
   staticpro (&Qand_optional);
 
-  Qdebug = intern ("debug");
+  Qdebug = intern_c_string ("debug");
   staticpro (&Qdebug);
 
   DEFVAR_LISP ("stack-trace-on-error", &Vstack_trace_on_error,
@@ -3696,7 +3702,7 @@ DECL is a list `(declare ...)' containing the declarations.
 The value the function returns is not used.  */);
   Vmacro_declaration_function = Qnil;
 
-  Vrun_hooks = intern ("run-hooks");
+  Vrun_hooks = intern_c_string ("run-hooks");
   staticpro (&Vrun_hooks);
 
   staticpro (&Vautoload_queue);