3 ms·
Changing config files is tricky (this wouldn't work as written for me because like many many people, I keep my emacs init in ~/.emacs.d/init.el instead of ~/.em
by philsnow 3y ago
Changing config files is tricky (this wouldn't work as written for me because like many many people, I keep my emacs init in ~/.emacs.d/init.el instead of ~/.emacs). Why not do something like this?
(eval (car
(read-from-string
(format "(progn %s)"
(shell-command-to-string "/path/to/erlmacs elisp")))))
Change erlmacs to just emit the elisp when you call it with 'elisp', then add the above snippet to your emacs init (or provide this setup as a elpa package).
Pro: you won't have to remember to call `erlmacs install` again when you periodically do `asdf install erlang latest`. Con: the version of erlang that gets `(erlang-start)` called is determined by your environment / the nearest .tool-versions file when you first invoke emacs.
- _mlbt 3y agoGood point! The next version should support other config file locations. This is something of a minimum viable solution to a problem I wanted to solve for myself. I’m definitely open to feature requests and suggestions.
- philsnow 3y agoHmm, I'm trying to say that it's much less brittle for the config setup to get 'pulled' from inside emacs rather than 'pushed' into an emacs config.
- _mlbt 3y agoThis is true. I might refactor the codebase to do what you're suggesting in the future. For now I just pushed a new v1.1.0 release that automatically detects and supports ~/.emacs.el and ~/.emacs.d/init.el in addition to ~/.emacs as configuration file locations. That should fix this problem for most people for now although I agree that your suggestion is probably more robust overall.
- wiml 3y agoPushing this idea a little further, the only information that erlmacs uses that isn't available elsewhere is the value of ErlRoot. You could write a two-line script that simply emits erlroot on stdout (or fails), and invoke that from .emacs to configure your emacs environment appropriately. As a bonus, that erlroot script would probably be useful in other situations, too.