Created
May 19, 2021 12:52
-
-
Save anthonyclarka2/37a537f6af98d03409d121de1c0389c2 to your computer and use it in GitHub Desktop.
Choosing Emacs settings based on operating system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Taken from https://karl-voit.at/2017/02/11/my-system-is-foobar/ | |
;; Check if system is Darwin/macOS | |
(defun my-system-type-is-darwin () | |
"Return true if system is darwin-based (Mac OS X)" | |
(string-equal system-type "darwin") | |
) | |
;; Check if system is Microsoft Windows | |
(defun my-system-type-is-windows () | |
"Return true if system is Windows-based (at least up to Win7)" | |
(string-equal system-type "windows-nt") | |
) | |
;; Check if system is GNU/Linux | |
(defun my-system-type-is-gnu () | |
"Return true if system is GNU/Linux-based" | |
(string-equal system-type "gnu/linux") | |
) | |
(when (my-system-type-is-darwin) | |
;; EXAMPLE: (global-set-key (kbd "C-z") 'shell) | |
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html#Init-Rebinding | |
(global-set-key (kbd "s-/") 'comment-or-uncomment-region-or-line) | |
) | |
(when (my-system-type-is-windows) | |
(add-to-list 'exec-path "c:/sqlite/") | |
(add-to-list 'exec-path "c:/Python/Python39") | |
(add-to-list 'exec-path "c:/Windows/System32") | |
(add-to-list 'exec-path "c:/MinGW/bin") | |
(add-to-list 'exec-path "C:/MinGW/mingw32/bin") | |
(add-to-list 'exec-path "C:/MinGW/msys/1.0/bin") | |
(add-to-list 'exec-path "C:/tools/Git/usr/bin") | |
(setenv "PATH" (mapconcat #'identity exec-path path-separator)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment