summary refs log tree commit diff stats
path: root/emacs
diff options
context:
space:
mode:
authorAlan Pearce2017-06-03 19:58:46 +0200
committerAlan Pearce2017-06-03 19:58:46 +0200
commitc215cfcd4d857aba68b70fbf5c8f3131d2763911 (patch)
treea9d2117e05b3b46a68015605a6621a4364bc43b6 /emacs
parent73b0984d7408c7f2e9876de6f34aa97a7eba8390 (diff)
downloadnixfiles-c215cfcd4d857aba68b70fbf5c8f3131d2763911.tar.lz
nixfiles-c215cfcd4d857aba68b70fbf5c8f3131d2763911.tar.zst
nixfiles-c215cfcd4d857aba68b70fbf5c8f3131d2763911.zip
Emacs: Ensure osrelease file exists before reading
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init.org11
1 files changed, 6 insertions, 5 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 1529a6d2..5675f56c 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