abo-abo / oremacs

My Emacs config
https://oremacs.com/
296 stars 33 forks source link

Personal config files #9

Closed srustamo closed 7 years ago

srustamo commented 7 years ago

Readme mentions a way to handle personal config, specifically:

put your changes into ./oleh/personal/init.el

Is ./oleh relative to ~/.emacs.d or git directory where this repo is cloned?

abo-abo commented 7 years ago

I changed to not include my name a while ago :). The path should be ./personal/init.el. So the personal repo is ./personal/.git.

This init.el should end in:

(provide 'personal/init)
srustamo commented 7 years ago

I assume the paths here are all relative to oremacs cloned git dir? Still a bit confusing: the make upgrade overwrites ./personal/init.el with this line:

yes n | cp -i etc/init-template.el personal/init.el

Also, since ./personal is included into theload-path here, is there really a need to provide personal/init, and not just init?

abo-abo commented 7 years ago

I assume the paths here are all relative to oremacs cloned git dir?

Yes.

Still a bit confusing: the make upgrade overwrites ./personal/init.el with this line:

It should not do that. make install should do that and should be called only once, when setting things up for the first time.

Also, since ./personal is included into theload-path here, is there really a need to provide personal/init, and not just init?

This is to differentiate init.el and personal/init.el.

srustamo commented 7 years ago

I'm getting File error: Cannot open load file, Not a directory, personal/init, requiring just init and providing init in personal/init.el removes the error.

abo-abo commented 7 years ago

For me, on the most recent commit 9dacda8, make up works and loads personal/init.el.

srustamo commented 7 years ago

Well, I'm not using this config verbatim, but cherry picking what I like.

I thought you might know a bit more about `require' function than I do.

My guess for the error I get is that ./init/personal is included in load-path, and since docstring for `require' says:

If FILENAME is omitted, the printname of FEATURE is used as the file name, and ‘load’ will try to load this name appended with the suffix ‘.elc’, ‘.el’, or the system-dependent suffix for dynamic module files, in that order. The name without appended suffix will not be used. See ‘get-load-suffixes’ for the complete list of suffixes.

The directories in ‘load-path’ are searched when trying to find the file name.

it looks like this "appending" of `.el' to the printname is not happening for me.

abo-abo commented 7 years ago

See if this improves the situation.

srustamo commented 7 years ago

I already was using my-init.el for both provide and require so:

(provide 'personal/my-init) (require 'personal/my-init)

and got the File error: Cannot open load file, Not a directory, personal/my-init error.

Sorry for confusion, I should have noted this earlier.

I'm not so sure where require starts looking for the package: in ~/.emacs.d or emacs-d symbol?

I tried creating ~/.emacs.d/personal/my-init.el but still get the above error.

abo-abo commented 7 years ago

Let's clarify: no Elisp files are meant to be put in ~/.emacs.d/.

You can have your personal file in ./personal/personal-init.el, which contains (provide 'personal-init).

In ./init.el, there's (require 'personal-init nil t), so there will be no error if the file is not present.

srustamo commented 7 years ago

Thanks.

(provide 'personal-init) and (require 'personal-init nil t) work.