Redesign doom-system-os

This commit is contained in:
Henrik Lissner 2017-05-03 21:58:39 +02:00
parent c37e679e44
commit acca0a86c7

View file

@ -2,10 +2,11 @@
(provide 'core-lib-system)
;;;###autoload
(defun doom-system-os ()
"Returns the OS: arch, debian, macos, general linux, cygwin or windows."
(let ((gnu-linux-p (eq system-type 'gnu/linux)))
(cond ((and gnu-linux-p (file-exists-p "/etc/arch-release"))
(defun doom-system-os (&optional os)
"Returns the OS: arch, debian, macos, general linux, cygwin or windows. If OS
is given, returns t if it matches the current system, and nil otherwise."
(let* ((gnu-linux-p (eq system-type 'gnu/linux))
(type (cond ((and gnu-linux-p (file-exists-p "/etc/arch-release"))
'arch)
((and gnu-linux-p (file-exists-p "/etc/debian_version"))
'debian)
@ -16,6 +17,9 @@
((memq system-type '(windows-nt cygwin))
'windows)
(t (error "Unknown OS: %s" system-type)))))
(if os
(eq os type)
type)))
;;;###autoload
(defun doom-sh (command &rest args)