I am in the process of setting up a basic doom emacs configuration on my work computer, and i want to reuse as much as i can from my dees repository, but because I am using Windows at my work (and because i dont want to go through setting up emacs on WSL and setting up and X server), i have just installed emacs on Windows. Yes: it is a bit slower, but i am only going to use it to:

  1. track time

  2. taking some notes

But because i do want to reuse my doom config, and because i have the most awesome awesome fancy splash, i want to reuse it across Linux and Windows, so: i need to have some code that can guess if i am on either windows or Linux, because i need to set the proper path to the splash image, but how do we guess that? we can make use of system-type, which can have the vaules:

  • windows-nt

  • darwin

  • gnu/linux

using string-equal we can make a simple couple of checks

(cond
((string-equal system-type "windows-nt") ; Microsoft Windows
  (progn
    (setq fancy-splash-image "D:/Users/USERNAME/.doom.d/init.png")
((string-equal system-type "darwin") ; Mac OS X
  (progn
    (message "Mac OS X")))
((string-equal system-type "gnu/linux") ; linux
  (progn
    (setq fancy-splash-image "~/.doom.d/init.png")
    )))

Here i have two different paths. I add this to my DOOM config.el, and it loads the png when ever i start a new instance of DOOM.