I just installed Emacs 24.4 from source (on Ubuntu 14.04). I now get the following error when running Emacs:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("/[._]emacs\\.d/?\\'" nil nil)

For debugging, I reduced my ~/.emacs init file to:

(setq debug-on-error t)
(add-to-list 'load-path nil)

Then the error occurs only when starting Emacs with two arguments, where the first argument is an option, for example --no-splash, and the second argument is a file name with a suffix, for example a.txt. Some other observations:

  • If I remove the option (--no-splash) it works fine,
  • if I remove the line (add-to-list 'load-path nil) it works fine,
  • if I run with Emacs v. 24.3 it works fine,
  • if I change nil to ".", in ~/.emacs it works fine,
  • if I remove the suffix from the file name, that is: changing a.txt to a, I get another error: Args out of range: 0.

Edit After adding nil to load-path, the variable looks like:

(nil "/opt/emacs24.4/share/emacs/24.4/site-lisp" "/opt/emacs24.4/share/emacs/site-lisp" "/opt/emacs24.4/share/emacs/24.4/lisp" "/opt/emacs24.4/share/emacs/24.4/lisp/vc" "/opt/emacs24.4/share/emacs/24.4/lisp/url" "/opt/emacs24.4/share/emacs/24.4/lisp/textmodes" "/opt/emacs24.4/share/emacs/24.4/lisp/progmodes" "/opt/emacs24.4/share/emacs/24.4/lisp/play" "/opt/emacs24.4/share/emacs/24.4/lisp/org" "/opt/emacs24.4/share/emacs/24.4/lisp/nxml" "/opt/emacs24.4/share/emacs/24.4/lisp/net" "/opt/emacs24.4/share/emacs/24.4/lisp/mh-e" "/opt/emacs24.4/share/emacs/24.4/lisp/mail" "/opt/emacs24.4/share/emacs/24.4/lisp/leim" "/opt/emacs24.4/share/emacs/24.4/lisp/language" "/opt/emacs24.4/share/emacs/24.4/lisp/international" "/opt/emacs24.4/share/emacs/24.4/lisp/gnus" "/opt/emacs24.4/share/emacs/24.4/lisp/eshell" "/opt/emacs24.4/share/emacs/24.4/lisp/erc" "/opt/emacs24.4/share/emacs/24.4/lisp/emulation" "/opt/emacs24.4/share/emacs/24.4/lisp/emacs-lisp" "/opt/emacs24.4/share/emacs/24.4/lisp/cedet" "/opt/emacs24.4/share/emacs/24.4/lisp/calendar" "/opt/emacs24.4/share/emacs/24.4/lisp/calc" "/opt/emacs24.4/share/emacs/24.4/lisp/obsolete")

According to the Emacs manual:

Variable: load-path

The value of this variable is a list of directories to search when loading files with load. Each element is a string (which must be a directory name) or nil (which stands for the current working directory).

  • 1
    Note for moderators: I tried to add a tag to my question for commandline arguments, but could not find any such tags.. Maybe it should be added by someone? Jan 12, 2015 at 10:34
  • 1
    There is no such tag yet, therefore I went with init since this is about what happens before Emacs initialization is done.
    – wasamasa
    Jan 12, 2015 at 10:55
  • M-x report-emacs-bug
    – Drew
    Jan 12, 2015 at 15:34
  • Just out of curiosity, why would you (on purpose) be trying to add nil to your load-path? Unless I am mistaken, the purpose of using add-to-list is to add something to a list, instead of nothing. And if Emacs looks to that list to decide which files to load and it encounters a nil value, wouldn't one naturally expect to see an error? How could a nil value inside a load-path list be useful?
    – lawlist
    Jan 12, 2015 at 17:19
  • 1
    @lawlist Thanks.. Yes it is probably a bad idea, but still it is not the correct behavior :) So it is probably a bug somewhere.. Jan 12, 2015 at 17:34

1 Answer 1


This is a bug in Emacs source startup.el and has already been fixed for the next release of Emacs.. See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19584 for more details..

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.