system-type is a variable defined in `C source code'.
Its value is darwin
Documentation:
Value is symbol indicating type of operating system you are using.
Special values:
`gnu' compiled for a GNU Hurd system.
`gnu/linux' compiled for a GNU/Linux system.
`darwin' compiled for Darwin (GNU-Darwin, Mac OS X, ...).
`ms-dos' compiled as an MS-DOS application.
`windows-nt' compiled as a native W32 application.
`cygwin' compiled using the Cygwin library.
Anything else indicates some sort of Unix system.
In a .emacs, there is not only the system-type, but also the window-system variable.
This is useful when you want to choose between some x only option, or a terminal, or macos setting.
There's also (in versions 24-26 at least) system-configuration, if you want to adjust for differences in build system. However, the documentation of this variable does not describe the possible vales that it may contain like the documentation of the system-type variable does.
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")
)