Closed harryfrogfather closed 2 years ago
I have Chemacs2 working on Windows, but only if I edit early-init.el
. And that is because I didn't install it in the folder that the documentation recommends. Which is either ~/.rational-emacs
or ~/.config/rational-emacs
.
So I edited early-init-el
from:
(defvar rational-config-path
(let ((home-dir (getenv "HOME")))
(if (file-exists-p (expand-file-name ".rational-emacs" home-dir))
(expand-file-name ".rational-emacs" home-dir)
(expand-file-name ".config/rational-emacs" home-dir)))
"The user's rational-emacs configuration path.")
to:
(defvar rational-config-path user-emacs-directory)
and that makes it work for me.
I'm not sure why rational Emacs has to be installed to a specific location and not just use the built in variable user-emacs-directory
. And on Windows there is no HOME
variable by default, so that could also cause problems.
You don't say what OS you're on but if you try to change early-init.el
as above it might work for you.
I'm on MacOS (m1) and Linux , though I only tested it on the Mac. Thanks
This is an interesting conundrum. The reason is due to the fact we are looking for the rational-emacs-path
in the early-init.el
file, and we need to know fairly explicitly where to find that path. Initially, we used the ~
alias for the HOME
folder, but as was mentioned in #19 that may not exist on Windows. I have a patch for that implementation in #32, but that only barely alleviates the problem here.
I can think of a couple of improvements:
(let ((home-dir (expand-file-name "../.rational-emacs" (file-name-directory (locate-user-emacs-file "init.el"))))) ...)
and fallback to the current implementation which looks in ~/.rational-emacs
or ~/.config/rational-emacs
if the path doesn't exist. PR #38 created for this issue, @harryfrogfather or possibly @sdaaish , could you review please and/or test? Let me know your feedback and I'll update the PR as necessary.
@jeffbowman So I tested this both with and without Chemacs, and it seems to work. I submitted a PR in your repo for a typo in early-init.el
But with that change it works.
So:
And that worked for me. Tested in Windows with a clean setup (sandbox) where HOME
is in $env:APPDATA
, the default.
The only thing is the personal config-files needs the same structure with ~/rational-config/.config/rational-emacs
so this might be mentioned in the README.
I set the environment-variable in the shell, but have not tested the variant with it set in .emacs-profiles.el
.
@sdaaish Thanks!! I have installed chemacs to try to figure out the issue. It should not create an additional .config/ structure in your rational config folder. I have completely rewritten the logic now, it seems to work for me and my neophyte/naive usage of chemacs, seems to also continue to work without chemacs. I'd appreciate it if you could pull the changes from my branch and test one more time. And thanks for the PR to fix the spelling error I had!
Sure thing.
The number of test-cases increases with the options, so it's hard to keep track of them now… But I tested two of them anyway. Long story below.
The short story: It worked as expected what I can see.
Two tests, both with Chemacs2 and custom installation of rational_emacs. The second one with custom config path. Both cases with Windows 11 in a sandbox. Use of emacs built in $HOME
variable wich is the same as ${env:AppData}
in Windows.
Chemacs, custom installation of rational-emacs.
# Clone emacs repositories
& git clone https://github.com/plexus/chemacs2.git $env:AppData/.emacs.d
& git clone -b more-friendly-for-chemacs https://github.com/jeffbowman/rational-emacs.git $env:AppData/rational-test
~/.emacs-profiles.el
(("default" . ((user-emacs-directory . "~/rational-test"))))
rational-config-path is a variable defined in ‘early-init.el’.
Its value is
"c:/Users/WDAGUtilityAccount/AppData/Roaming/rational-test/rational-emacs"
Documentation:
The user’s rational-emacs configuration path.
rational-config-file is a variable defined in ‘init.el’.
Its value is
"c:/Users/WDAGUtilityAccount/AppData/Roaming/rational-test/rational-emacs/config.el"
Documentation:
The user’s configuration file.
By adding a local config to $HOME/rational-test/rational-emacs/config.el
the setup works with Chemacs2. $HOME
is in this case the same as $env:Appdata
.
So the test was successful.
chemacs, custom installation and custom config-path.
# Clone emacs repositories
& git clone https://github.com/plexus/chemacs2.git $env:AppData/.emacs.d
& git clone -b more-friendly-for-chemacs https://github.com/jeffbowman/rational-emacs.git $env:AppData/rational-test
~/.emacs-profiles.el
(("default" . ((user-emacs-directory . "~/rational-test"))))
rational-config-path is a variable defined in ‘early-init.el’.
Its value is
"c:/Users/WDAGUtilityAccount/AppData/Roaming/my-rational-emacs-config"
Documentation:
The user’s rational-emacs configuration path.
rational-config-file is a variable defined in ‘init.el’.
Its value is
"c:/Users/WDAGUtilityAccount/AppData/Roaming/my-rational-emacs-config/config.el"
Documentation:
The user’s configuration file.
user-emacs-directory is a variable defined in subr.el.
Value
"~/rational-test/"
The test was successful, rational-emacs found config.el
in the correct directory and loaded it without any errors.
From test2.
RATIONAL_EMACS_HOME
.
Fantastic!! Thanks for the help!! I'm going to update the docs then see if @daviwil will merge the update.
With the merge of #38 can this issue be closed?
@harryfrogfather @daviwil
yes it looks ok from my perspective
The code in init.el checks for the two usual locations of emacs configs , but not if you are using Chemacs 2. Sorry my emacs lisp-FU is extreme novice level, and have no idea how to correct it.