Skip to main content

Timeline for Warning message about load-path.

Current License: CC BY-SA 3.0

11 events
when toggle format what by license comment
Aug 17, 2023 at 15:41 comment added phils Correct; simply a file naming convention of your own to reliably differentiate your file names from those of any other elisp files you might have installed at any point, so that you can't accidentally create a conflict.
Aug 17, 2023 at 15:36 comment added Sz. (Thanks for the instant replies despite the party having ended ~8 years ago. :) ) Just to confirm my understanding: that "name-spacing" simply means prefixing the file names (not anything specific to elisp, which I'm not familiar with), right?
Aug 17, 2023 at 15:18 comment added phils But if you don't want to name-space the file names themselves, then you also don't want their parent directory in your load path (as less distinct file names may be prone to conflicts, whether now or in future), so you'd want to go with the artificial extra subdir for your initial approach (and put that dir in load-path).
Aug 17, 2023 at 15:14 comment added phils No; that would require putting ~/.emacs.d in your load path. Your gentle reminder can instead be to name-space the elisp file names: (load "sz-foo") and you can then put the sz directory in your load-path (and the sz-* files in that directory).
Aug 17, 2023 at 15:12 comment added Sz. If anyone's still here: so, if I'd like to have a bunch of (load "sz/...") calls to load from ~/.emacs.d/sz (instead of using "undecorated" (load "...") paths with sz added to load-path), as a gentle reminder to myself in 5 years that those are my own scripts, can I still do that without creating an artificial extra subdir above sz just for the scoping to work?
Mar 8, 2015 at 5:28 comment added phils But in short, your load path shouldn't include directories to which Emacs (or other applications for that matter) are liable to write arbitrary files, and ~/.emacs.d is such a directory.
Mar 8, 2015 at 5:22 comment added phils calc.el is an example. That is both the name of an Emacs library, and also the name of a configuration file which it writes to your ~/.emacs.d/ directory. If that directory is in your load-path ahead of the standard library paths, then once calc has written its config file, you would be unable to load the calc library.
Mar 8, 2015 at 5:12 comment added Faheem Mitha @lunaryorn thanks, that's a very helpful comment. Consider expanding it into a full answer. In particular, do you have a reference for "Emacs libraries create data files in ~/.emacs.d/, which might accidentally shadow real libraries"? An example woould be even better. Shadowing means loading your personal file of the same name because in the path before the real thing, right? I don't see why this would happen in this case.
Mar 7, 2015 at 11:58 comment added user227 There's a difference between ~/.emacs.d/ and its subdirectories. It's fine to add subdirectories of ~/.emacs.d to your load-path, but you should not add ~/.emacs.d/ to it. The reason is that Emacs libraries create data files in ~/.emacs.d/, which might accidentally shadow real libraries if you add ~/.emacs.d/ to your load-path.
Mar 7, 2015 at 11:48 comment added Faheem Mitha I still don't understand why the earlier setup is wrong, and why I need to make this change. What about all the other directories in .emacs.d, e.g. elpa? Why don't they need to be moved? And will they still get loaded if I used .emacs.d/lisp instead?
Mar 7, 2015 at 11:33 history answered phils CC BY-SA 3.0