all repos — nixfiles @ c215cfcd4d857aba68b70fbf5c8f3131d2763911

System and user configuration, managed by nix and home-manager

Emacs: Ensure osrelease file exists before reading

Alan Pearce
commit

c215cfcd4d857aba68b70fbf5c8f3131d2763911

parent

73b0984d7408c7f2e9876de6f34aa97a7eba8390

1 file changed, 6 insertions(+), 5 deletions(-)

jump to
M emacs/.emacs.d/init.orgemacs/.emacs.d/init.org
@@ -21,11 +21,12 @@
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