emacs/old-config/lisp/os.el
2018-04-07 10:54:04 +08:00

34 lines
721 B
EmacsLisp

(defvar *osname* 'unknown)
(defun darwin-path ()
(let ((files (file-expand-wildcards "/etc/paths.d/*")))
(my-fold-left #'(lambda (acc e)
(if (not acc)
e
(concat acc ":" e)))
nil
(loop for d in files
collect (substring
(shell-command-to-string
(concat " cat " d
"|sed -e '/^$/d' "))
0 -1)))))
(defun darwin-init ()
(setf *osname* 'darwin)
(setenv "PATH"
(concat (getenv "PATH")
":/opt/local/bin:/opt/local/sbin:"
(darwin-path)))
(message "PATH=%s" (getenv "PATH")))
(defun berkeley-unix-init ()
(setf *osname* 'bsd)
t)
(defmacro os-init ()
(let ((osinit (intern (concat (symbol-name system-type)
"-init"))))
`(,osinit)))
(os-init)