Load exec-path-from-shell in daemon sessions

On MacOS, the daemon is unlikely to run with the correct environment if
launched through launchctl or brew services, so it makes sense to use
exec-path-from-shell there too.

May address #736
This commit is contained in:
Henrik Lissner 2018-07-09 23:34:37 +02:00
parent ae21b90278
commit e816a1ecac
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -35,11 +35,11 @@
;; Don't open files from the workspace in a new frame
ns-pop-up-frames nil)
(if (not (display-graphic-p))
(add-hook 'doom-post-init-hook #'osx-clipboard-mode)
;; A known problem with GUI Emacs on MacOS: it runs in an isolated
;; environment, so envvars will be wrong. That includes the PATH Emacs
;; picks up. `exec-path-from-shell' fixes this.
(when (or (daemonp) (display-graphic-p))
;; A known problem with GUI Emacs on MacOS (or daemons started via
;; launchctl or brew services): it runs in an isolated
;; environment, so envvars will be wrong. That includes the PATH
;; Emacs picks up. `exec-path-from-shell' fixes this.
(when (require 'exec-path-from-shell nil t)
(defun set-env! (&rest vars)
"Inject VARS from your shell environment into Emacs."
@ -47,7 +47,11 @@
(setq exec-path-from-shell-check-startup-files nil
exec-path-from-shell-arguments (delete "-i" exec-path-from-shell-arguments)
exec-path-from-shell-debug doom-debug-mode)
(exec-path-from-shell-initialize))))
(exec-path-from-shell-initialize)))
;; Fix the clipboard in terminal or daemon Emacs (non-GUI)
(when (or (daemonp) (not (display-graphic-p)))
(add-hook 'doom-post-init-hook #'osx-clipboard-mode)))
(IS-LINUX
(setq x-gtk-use-system-tooltips nil ; native tooltips are ugly!