summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2019-11-08 22:05:43 +0100
committerAlan Pearce2019-11-08 22:07:28 +0100
commitf082ca8aead014318e2cbda41ba671791a405f0b (patch)
treed08407ba1ed2d7e2bae585ab12750a10aabd8775
parent571c6b9a4d2a2c522ddf8df4a5d1999195c42971 (diff)
downloadnixfiles-f082ca8aead014318e2cbda41ba671791a405f0b.tar.lz
nixfiles-f082ca8aead014318e2cbda41ba671791a405f0b.tar.zst
nixfiles-f082ca8aead014318e2cbda41ba671791a405f0b.zip
Emacs: set PATH on darwin using built-in path_helper
This should be faster than exec-path-from-shell, as it doesn't use a
shell.  It is not portable, but only macOS lacks a convienent method
to set the PATH for graphical applications
-rw-r--r--user/emacs/.emacs.d/init.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/user/emacs/.emacs.d/init.el b/user/emacs/.emacs.d/init.el
index f608d4cf..701156a3 100644
--- a/user/emacs/.emacs.d/init.el
+++ b/user/emacs/.emacs.d/init.el
@@ -17,6 +17,22 @@
   (setq use-package-expand-minimally t))
 (setq use-package-always-demand (daemonp))
 
+(defvar ap/path-configured nil)
+(when (and (eq system-type 'darwin)
+           (not ap/path-configured))
+  (setq exec-path
+        (delete-dups
+         (append
+          (parse-colon-path
+           (elt (split-string-and-unquote
+                 (with-output-to-string
+                   (with-current-buffer standard-output
+                     (call-process "/usr/libexec/path_helper" nil t nil "-s")))
+                 "[=;]")
+                1))
+          exec-path))
+        ap/path-configured t))
+
 ;;; Customize
 
 (setq custom-file "~/.emacs.d/custom.el")