How do I programmatically determine which OS Emacs is running under in ELisp?
I would like to run different code in .emacs
depending on the OS.
Now there is also Linux Subsystem for Windows (bash under Windows 10) where system-type
is gnu/linux
. To detect this system type use:
(if
(string-match "Microsoft"
(with-temp-buffer (shell-command "uname -r" t)
(goto-char (point-max))
(delete-char -1)
(buffer-string)))
(message "Running under Linux subsystem for Windows")
(message "Not running under Linux subsystem for Windows")
)