chemacs2 icon indicating copy to clipboard operation
chemacs2 copied to clipboard

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

Open tardigradus opened this issue 4 years ago • 4 comments

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?

tardigradus avatar May 20 '21 12:05 tardigradus

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!

daviwil avatar May 20 '21 20:05 daviwil

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 avatar May 21 '21 05:05 tardigradus

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?

tardigradus avatar May 21 '21 06:05 tardigradus

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.

plexus avatar May 21 '21 15:05 plexus