In the Emacs Trunk build -- i.e., built --with-ns, I have the following entries that get added automatically to my load-path when launching without any user configuration:

"." "./Applications" "./Applications (Parallels)" "./Desktop" "./Documents"
"./Downloads" "./Library" "./Movies" "./Music" "./Pictures" "./Public" "./Sites" "./Users"

I've done some grepping, but haven't found an option to prevent the creation of those entries.

Clearly, Emacs is scanning my home directory for all folders and creating entries based on the results.

How can I prevent the creation of those entries?

This does NOT happen when I launch: Emacs -Q

EDIT (08/26/2015):  I have tracked down the bug and submitted a bug report -- http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21353 -- which states in relevant part:

The default-directory is initially set to ".", which results in erroneous entries being added to the load-path by normal-top-level-add-subdirs-to-load-path within .../site-lisp/subdirs.el when starting Emacs. The erroneous entries look like this:

"." "./Applications" "./Applications (Parallels)" "./Desktop" "./Documents"
"./Downloads" "./Library" "./Movies" "./Music" "./Pictures" "./Public" "./Sites" "./Users"

I built Emacs Trunk from the directory ~/Desktop, in the event that has any relevance -- /Users/HOME/Desktop/emacs.

  • According to emacs --help, -Q is equivalent to -q --no-site-file --no-site-lisp --no-splash. Since you say this happens without any user configuration, I'd try the --no-site-file and --no-site-lisp options individually and see which causes this behavior not to happen. I'm not sure whether or not --debug-init would help in this particular case, but it might. – Trebor Rude Aug 26 '15 at 16:19
  • @Trebor Rude -- I just finished tracking it down and am filling out a bug report, and will update the question to include the bug tracking number. The problem is that the default-directory is set initially to ".", and normal-top-level-add-subdirs-to-load-path within .../site-lisp/subdirs.el adds erroneous entries to the load-path as a result of that default-directory being ".". – lawlist Aug 26 '15 at 16:30
  • In the meantime, @lawlist, it seems that you can add .nosearch files to the directories that you don't want on the load-path, according to the documentation for normal-top-level-add-subdirs-to-load-path. It's possible you could also advise the function not to do anything if you don't want any of those paths on your load-path. – Trebor Rude Aug 26 '15 at 16:40
  • @Trebor Rude -- Other temporary workarounds include, but are not limited to: Setting the default-directory manually just above (if (fboundp 'normal-top-level-add-subdirs-to-load-path) (normal-top-level-add-subdirs-to-load-path)) within .../site-lisp/subdirs.el; or, let-binding it around; or, simply commenting out the latter (which I don't personally need for my type of setup). And, I will programmatically delete "." from the load-path when Emacs starts up. – lawlist Aug 26 '15 at 16:46
  • True, @lawlist, and while those are pretty easy workarounds to implement, they do require root access if you're on a Linux machine. It's good to have workarounds that don't require such access. – Trebor Rude Aug 26 '15 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.