0

I have emacs on two separate platforms, and I would like it to function in much the same way on both, but there is some platform-dependent configuration as well. I have created a git repository in my .doom.d directory (where the doom configuration files are stored). I could have two branches, one for each platform, but then I end up re-implementing much of my config. I found this: https://softwareengineering.stackexchange.com/questions/200068/applying-commits-into-another-branch-without-merging. I would like to know if there is a better way (I am pretty new to git), preferably simpler. Is there something like a C preprocessor directive I could use where certain portions of my config are ommitted before they are evaluated based on the platform I am on? Is there something else that I don't know about? Any help is appreciated.

0

There are lots of ways to do this. One way is to put system dependent stuff in a file machine.el where "machine" is what (system-name) outputs. I then put

(require (intern (system-name)) nil 'noerror)

in my init.el and keep everything in the same GitHub repo.

  • This does not seem to work. I tried putting that in $DOOMDIR/init.el (running doom build && doom sync) as well as $DOOMDIR/config.el and neither seemed to work. Currently, the only thing I have in my $DOOMDIR/machine.el (where machine is replaced by the output of (system-name)) is (setq org-directory "~/../../org/") (setq doom-variable-pitch-font (font-spec :family "Times New Roman" :size 12)) and when I do C-h v org-directory or C-h v doom-variable-pitch-font it says the value is nil. Am I doing something wrong. – Aronurr64 Sep 14 '20 at 22:34
  • Inspect the variable load-path. Does it contain $DOOMDIR? – Fran Burstall Sep 15 '20 at 6:39
  • No. Should I put machine.el elsewhere? – Aronurr64 Sep 15 '20 at 13:15
  • I moved machine.el and added its location to load-path. It works now. – Aronurr64 Sep 15 '20 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.