reddit / emacs

Newbie Question: How to add to my load path?

TooflessSnek · 2022-02-07 05:44
I'm following the tutorial [here](https://www.masteringemacs.org/article/beginners-guide-to-emacs). It suggests I add lines to ~/.emacs.d/.emacs >;; You can change the path here >(add-to-list 'load-path "~/.emacs.d/") I created that file and then restarted emacs, but my load path didn't change. I'm using mac port.
TooflessSnek · 2022-02-07 05:58
Ok I'll answer myself. Evidently, one might need to expand the path: (add-to-list 'load-path (**expand-file-name** "~/.emacs.d/")) However, I don't know why various articles don't mention that. Maybe something changed since older articles were written?
SlowValue · 2022-02-07 08:52
(add-to-list 'load-path "~/.emacs.d/") is working fine. Maybe this is not working for you only because of that: > I'm using mac port.
[deleted] · 2022-02-07 09:59
[deleted]
TheBB · 2022-02-07 10:03
> It suggests I add lines to ~/.emacs.d/.emacs It should also either be ~/.emacs.d/init.el or ~/.emacs. I don't think ~/.emacs.d/.emacs is a thing, unless something changed recently.
ftrx · 2022-02-07 10:09
A small addition: depending on what are you doing you might like instead (use-package pkgname :load-path "~/.emacs.d/extrapkgs/pkgname" :ensure nil :config ;; ... anything there ) I mean in the case you manually add a package non in ELPA, MELPA, etc, something "manually installed" a/some .el with a `(provide 'pkgname)` somewhere.
[deleted] · 2022-02-07 10:22
[deleted]
flexibeast · 2022-02-07 10:23
Assuming use-package is already installed, which it won't be for someone using stock Emacs rather than a distro.
[deleted] · 2022-02-07 10:24
[deleted]
four0nine · 2022-02-07 14:26
If you want to load a subdirectory in the emacs.d dir, I would recommend you to use ``` (expand-file-name "dir" user-emacs-directory) ``` This would find ~/.emacs.d/dir. By using user-emacs-directory it doesn't matter where the emacs.d is located (since it could also be under ~/.config).
[deleted] · 2022-02-07 17:04
Why do you want to add .emacs.d to your load path? There is no reason to do this. You would only add a path if you were manually installing sotware. Then you would add the path to that software, followed by something like (require 'diredx) in your init file.
TooflessSnek · 2022-02-07 23:09
Yes this is the conclusion I reached. Somehow I totally misread that tutorial, and I just now happen to be fixing up my mess lol. I'm putting my emacs init file in my dropbox/config/emacs/init.el and then creating a symlink to that at ~/.emacs.d/init.el
ftrx · 2022-02-08 13:10
Well, true, but while I know there are reasons, I do not know, why `use-package` hasn't yet been, and will not be, accepted in Emacs upstream it's largely the most common way to easily configure Emacs allowing to wrap in a single cut&paste-able sexp pretty anything. `use-package` itself is trivial to setup so... Well... I've pass few Emacs config bankruptcy, most due to config that became unstable with unknown errors/unexpected behaviors and essentially all strategies I tried but use-package does not work. el-get at a certain point fail, borg the same, pure package.el fails with autoloads issues, etc... That's became my default goto and I'm curious why it's not accepted by some...