]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't get into an error loop if dumped.elc isn't found.
authorKen Raeburn <raeburn@raeburn.org>
Thu, 8 Dec 2016 13:04:35 +0000 (08:04 -0500)
committerKen Raeburn <raeburn@raeburn.org>
Sat, 22 Jul 2017 08:14:23 +0000 (04:14 -0400)
When temacs is run, if dumped.elc isn't in the right place (currently
$srctop/src/dumped.elc, though it's generated in the build tree's src
directory), starting in X11 mode will produce a message about not
finding it, but starting in tty mode will produce an error loop
because internal-echo-keystrokes-prefix isn't defined.

This patch traps the error and kills the Emacs session with an exit
code of 42, and no message.  This is worse than the X11 behavior, but
better than the tty behavior.

It's not a long term fix though.

* src/emacs.c (main): If dumped.elc isn't found, exit with an error
code.
(syms_of_emacs): Define Qcondition_case.

src/emacs.c

index bc5d4bc552f76d74d95e526148f7589dfa00066e..8f461fe8a4b80afb06e235039836af5b0d2e5774 100644 (file)
@@ -1674,8 +1674,19 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
          Vtop_level = list2 (Qload, build_unibyte_string (file));
        }
       else if (! no_loadup)
-        /* Unless next switch is -nl, load "loadup.el" first thing.  */
-       Vtop_level = list2 (Qload, build_string ("../src/dumped.elc"));
+        /* Unless next switch is -nl, load "dumped.elc" first thing.
+          If it fails, we won't be able to run.  */
+       {
+         Lisp_Object load = list2 (Qload, build_string ("../src/dumped.elc"));
+         /* XXX We need a way for Lisp to cause Emacs to exit, with
+            an error message to stderr after restoring tty modes.  */
+         /* (condition-case nil bodyform (file-missing (kill-emacs 42)))  */
+         Vtop_level = list4 (Qcondition_case,
+                             Qnil,
+                             load,
+                             list2 (Qfile_missing,
+                                    list2 (Qkill_emacs, make_number (42))));
+       }
     }
 
   /* Set up for profiling.  This is known to work on FreeBSD,
@@ -2506,6 +2517,7 @@ syms_of_emacs (void)
   DEFSYM (Qrisky_local_variable, "risky-local-variable");
   DEFSYM (Qkill_emacs, "kill-emacs");
   DEFSYM (Qkill_emacs_hook, "kill-emacs-hook");
+  DEFSYM (Qcondition_case, "condition-case");
 
 #ifndef CANNOT_DUMP
   defsubr (&Sdump_emacs);