8

The warning that I get, as soon as I open Emacs is this:

Warning (initialization): An error occurred while loading `/Users/Kaileeena/.emacs':

End of file during parsing: /Users/Kaileeena/.emacs

To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the `--debug-init' option to view a complete error backtrace.

But how do I do that?

I've never used this software before, and I can't figure out where to even type.

1
  • That ususally means -- You missed a bracket in .emacs -- or some package that You require missed that. Try to recall what You've been fidling with recently.
    – Adobe
    Mar 28, 2013 at 5:17

4 Answers 4

16

You're running Mac OS, right? Assuming you installed Emacs into the Applications folder, open a Terminal window (it's in the Utilities subfolder inside Applications) and type:

/Applications/Emacs.app/Contents/MacOS/Emacs --debug-init
6
  • Thanks for your help, but I'm getting the same result as when I tried that through Emacs. All I see is a blank window. I was wondering if there should be some sort of log that would tell me exactly why I'm getting the warning in the first place?
    – Kaileeena
    Jan 23, 2013 at 14:54
  • Hm, --debug-init should show you where the problem is... You could try adding -nw ("no window") to that command line. It will make Emacs run inside the terminal window, which might make it less confused.
    – legoscia
    Jan 23, 2013 at 16:48
  • can this applied for the emacsclient?
    – alper
    Oct 1, 2022 at 11:55
  • can this applied for the emacsclient?
    – alper
    Jan 10, 2023 at 10:59
  • 1
    Seems like it did not work, emacs --daemon and ` emacs --debug-init -nw ~/doo` runs their own daemon
    – alper
    Jan 11, 2023 at 13:37
4

In addition to the suggestions to use emacs --debug-init, do this: Bisect your init file (~/.emacs) recursively until you find the problematic code. (E.g., use M-x comment-region to comment out half the code, then 1/4, then 1/8, then 1/16,... (With prefix arg C-u the same command uncomments the region.)

This is a binary search, so it is very quick to do.

But as @Adobe suggested, it is likely that you are missing one or more closing parens. Another approach is to use C-M-f repeatedly (just hold down that chord), until you get the error. That will be where you are missing a paren. (Start at the top level of the file and the leftmost paren of your first sexp.)

1
  • Drew has the right idea, but there's a better way to go about it: use "bug-hunter", which is an emacs package that automatically does the bisection search for you. Dec 13, 2022 at 23:32
1

When you start emacs from a terminal simply add it after the command so that your complete command looks like emacs --debug-init.

1

Just write emacs --debug-init in your terminal, you can do M-x info RET to see the other options and learn what is for what.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .