From c215cfcd4d857aba68b70fbf5c8f3131d2763911 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 3 Jun 2017 19:58:46 +0200 Subject: Emacs: Ensure osrelease file exists before reading --- emacs/.emacs.d/init.org | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'emacs') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 1529a6d..5675f56 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -21,11 +21,12 @@ Open Emacs with just a plain window. No graphics or messages, please! Are we running on Windows via the WSL? #+BEGIN_SRC emacs-lisp -(with-temp-buffer - (insert-file-contents-literally "/proc/sys/kernel/osrelease") - (decode-coding-region (point-min) (point-max) 'utf-8 t) - (when (string-match "Microsoft$" (buffer-string)) - (setq system-type 'gnu/linux/windows))) +(when (file-exists-p "/proc/sys/kernel/osrelease") + (with-temp-buffer + (insert-file-contents-literally "/proc/sys/kernel/osrelease") + (decode-coding-region (point-min) (point-max) 'utf-8 t) + (when (string-match "Microsoft$" (buffer-string)) + (setq system-type 'gnu/linux/windows)))) #+END_SRC ** Compatibility -- cgit 1.4.1