After a long debugging of my init.el file, it looks like the first line of the following elisp-code, i.e (custom-set-variablesis provoking an 'End of file during parsing' error) which I absolutely don't understand. If I comment this line, all is fine. I did not even enter this code myself, as it has been automatically added in init.el from the customize menu.

'(global-hl-line-mode t)
'(ido-mode (quote buffer) nil (ido))
'(menu-bar-mode nil)
 (when (display-graphic-p)
 (tool-bar-mode -1)
 (scroll-bar-mode -1))

Here is the complete error message:

Warning (initialization): An error occurred while loading `/Users/me/.emacs.d/init.el':

End of file during parsing: /Users/me/.emacs.d/init.el

Any help would be appreciated ! Thanks

  • If the file is large, you can use M-x check-parens to jump to the offending section. If the file is short, or you are looking at a short section of code, then there are methods to highlight matching parentheses to visually see where a parentheses is misplaced or missing. Here is a link to my own variation of highlight-parentheses-mode: stackoverflow.com/a/23998965/2112489
    – lawlist
    Commented Sep 11, 2016 at 15:58
  • Please don't use custom-set-variables in your own Elisp code. This is meant to be auto-generated only. Don't copy&paste it. Look for equivalent code using setq or something like that.
    – Stefan
    Commented Sep 12, 2016 at 19:49

2 Answers 2


The "end of file during parsing" error means that you have not closed a paren.

To debug this, you should

  1. Do M-x check-parens RET to pinpoint the location of the current error.
  2. Enable show-paren-mode to see which paren matches your current one - this will help you with on-going code maintenance.
  3. Use C-M-f/C-M-b to navigate by balanced parens; if you get an error, this is where your open parent which was not closed is.
  4. Use TAB to indent each line and see if the new indentation conforms to your expectations.

The other answer correctly explains what the actual error is in your case.

  • What if, after doing all this, the error still appears?
    – trxgnyp1
    Commented Apr 13 at 21:28
  • @trxgnyp1 start over ;-)
    – sds
    Commented Apr 14 at 2:02
  • My configuration works fine, but when compiling it into bytecode it shows that error. I checked everything you list, I even have colored parentheses. Only happens when running byte-compile-file.
    – trxgnyp1
    Commented Apr 14 at 17:38

A closing parentheses is missing in the example above. The when statment is not part of the custom-set-variables. The corrected code is as follows:

  '(global-hl-line-mode t)
  '(ido-mode (quote buffer) nil (ido))
  '(menu-bar-mode nil))

(when (display-graphic-p)
  (tool-bar-mode -1)
  (scroll-bar-mode -1))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.