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.
The system-type
variable:
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.
For folks newer to elisp, a sample usage:
(if (eq system-type 'darwin) ; something for OS X if true ; optional something if not )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With