summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-06-01 21:53:40 +0200
committerAlan Pearce2017-06-01 21:53:40 +0200
commit3a26b26766454af43ea39018a0ba1890bec99630 (patch)
tree9cd8b45d6ba8ae0fc002e1a22168cdb09111486d
parentf2f351569ffac639d5773d52f7482e77528eeb2c (diff)
downloadnixfiles-3a26b26766454af43ea39018a0ba1890bec99630.tar.lz
nixfiles-3a26b26766454af43ea39018a0ba1890bec99630.tar.zst
nixfiles-3a26b26766454af43ea39018a0ba1890bec99630.zip
Emacs: Fix windows check
file-to-string isn't actually a built-in function, even though it's
named like one.
-rw-r--r--emacs/.emacs.d/init.org7
1 files changed, 5 insertions, 2 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 070f48c2..da476582 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -21,8 +21,11 @@ Open Emacs with just a plain window.  No graphics or messages, please!
 Are we running on Windows via the WSL?
 
 #+BEGIN_SRC emacs-lisp
-(when (string-match "Microsoft$" (file-to-string "/proc/sys/kernel/osrelease"))
-    (setq system-type 'gnu/linux/windows))
+(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