plexus / chemacs2

Emacs version switcher, improved
779 stars 47 forks source link

How to deal with references to ~/emacs.d? #22

Open tardigradus opened 3 years ago

tardigradus commented 3 years ago

After following the installation instructions and running emacs on the command line, I get the error

File is missing: Opening directory, No such file or directory, /home/tardigradis/.emacs.d/lisp

This is because I have

(let ((default-directory  "~/.emacs.d/lisp/"))
  (normal-top-level-add-subdirs-to-load-path))

in my init.el. How should such references be dealt with?

daviwil commented 3 years ago

Resolve it relative user-emacs-directory:

(let ((default-directory  (expand-file-name "lisp/" user-emacs-directory)))
  (normal-top-level-add-subdirs-to-load-path))

UPDATE: I gave a different solution at first but it was wrong, this is the right one!

tardigradus commented 3 years ago

Thanks. I missed the initial, incorrect solution, but the current one works.

However, I also have a similar problem with my abbrev_defs file, which by default is ~/.emacs.d/abbrev_defs, if ~/.emacs.d exists. I can obviously set the variable abbrev-file-name, but is there a more general issue, i.e. that stuff is going to be in ~/.emacs.d, here that needs to be solved?

tardigradus commented 3 years ago

Moreover, how is stuff dealt with in general which should be the independent of the profile? Abbreviations are one thing I probably want the same across profiles (I see that if .emacs.d/abbrev_defs is missing then ~/.abbrev_def will be used it exists, so that's easily solved). Are there other things I need to look out for and should these maybe be mentioned in the documentation?

plexus commented 3 years ago

As @daviwil showed (expand-file-name "..." user-emacs-directory) is your friend for anything you want to load from or put into your profile directory. Well behaved Emacs libraries (built-in or third party) should also honor user-emacs-directory, so generally things just work. If you come across things that still end up in ~/.emacs.d feel free to make an issue for those, and we can see if it's something Chemacs should handle or not.