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.
1 Answer
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
(runningdoom 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
(wheremachine
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 doC-h v org-directory
orC-h v doom-variable-pitch-font
it says the value is nil. Am I doing something wrong. Sep 14, 2020 at 22:34 -
-
-
I moved
machine.el
and added its location toload-path
. It works now. Sep 15, 2020 at 14:45