Giter Site home page Giter Site logo

Comments (10)

sdaaish avatar sdaaish commented on August 19, 2024 1

@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:

  • Chemacs in ~/.emacs.d
  • Rational-emacs in ~/rational-test
  • Rational-config in ~/rational-config

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.

bild

from crafted-emacs.

sdaaish avatar sdaaish commented on August 19, 2024

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.

from crafted-emacs.

harryfrogfather avatar harryfrogfather commented on August 19, 2024

I'm on MacOS (m1) and Linux , though I only tested it on the Mac.
Thanks

from crafted-emacs.

jeffbowman avatar jeffbowman commented on August 19, 2024

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:

  1. Use an environment variable, ala RATIONAL_EMACS_HOME, the fall back will be the APPDATA/HOME implementation in #32.
  2. Use something relative to the users emacs configuration folder like this: (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.

from crafted-emacs.

jeffbowman avatar jeffbowman commented on August 19, 2024

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.

from crafted-emacs.

jeffbowman avatar jeffbowman commented on August 19, 2024

@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!

from crafted-emacs.

sdaaish avatar sdaaish commented on August 19, 2024

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.

Testing

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.

test 1

Chemacs, custom installation of rational-emacs.

Installation

# 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

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

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.

Result

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.

test2

chemacs, custom installation and custom config-path.

Installation

# 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

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

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

user-emacs-directory is a variable defined in subr.el.

Value
"~/rational-test/"

Result

The test was successful, rational-emacs found config.el in the correct directory and loaded it without any errors.

Output

From test2.

  • Chemacs2
  • Custom installation of rational-emacs.
  • Custom config path.
  • Use of environment variable RATIONAL_EMACS_HOME.
    bild

from crafted-emacs.

jeffbowman avatar jeffbowman commented on August 19, 2024

Fantastic!! Thanks for the help!! I'm going to update the docs then see if @daviwil will merge the update.

from crafted-emacs.

jeffbowman avatar jeffbowman commented on August 19, 2024

With the merge of #38 can this issue be closed?

@harryfrogfather @daviwil

from crafted-emacs.

harryfrogfather avatar harryfrogfather commented on August 19, 2024

yes it looks ok from my perspective

from crafted-emacs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.