Allow exec-path-from-shell config everywhere
In case linux users install exec-path-from-shell themselves. However, it still won't be installed by default for anyone but Mac users.
This commit is contained in:
parent
c2d0cae6a5
commit
2364415140
1 changed files with 27 additions and 22 deletions
|
@ -19,9 +19,35 @@
|
||||||
;; grokked from: http://stackoverflow.com/questions/15873346/elisp-rename-macro
|
;; grokked from: http://stackoverflow.com/questions/15873346/elisp-rename-macro
|
||||||
(advice-add #'evil-visual-update-x-selection :override #'ignore)
|
(advice-add #'evil-visual-update-x-selection :override #'ignore)
|
||||||
|
|
||||||
|
;; In case it is never defined:
|
||||||
(defmacro set-env! (&rest _vars)
|
(defmacro set-env! (&rest _vars)
|
||||||
"Inject VARS from your shell environment into Emacs.")
|
"Inject VARS from your shell environment into Emacs.")
|
||||||
|
|
||||||
|
(when (or (daemonp) (display-graphic-p))
|
||||||
|
;; Syncs ns frame parameters with theme (and fixes mismatching text
|
||||||
|
;; colr in the frame title)
|
||||||
|
(when (and IS-MAC (require 'ns-auto-titlebar nil t))
|
||||||
|
(add-hook 'doom-load-theme-hook #'ns-auto-titlebar-mode))
|
||||||
|
|
||||||
|
;; If you launch GUI Emacs from the wrong shell environment, Emacs will be
|
||||||
|
;; gimped. This regularly happens 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' tries to address this, but it is only set up to run
|
||||||
|
;; for mac users.
|
||||||
|
(when (require 'exec-path-from-shell nil t)
|
||||||
|
(defun set-env! (&rest vars)
|
||||||
|
"Inject VARS from your shell environment into Emacs."
|
||||||
|
(exec-path-from-shell-copy-envs vars))
|
||||||
|
(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-variables
|
||||||
|
(nconc exec-path-from-shell-variables '("LC_CTYPE" "LC_ALL" "LANG")))
|
||||||
|
(exec-path-from-shell-initialize)))
|
||||||
|
|
||||||
|
|
||||||
(cond (IS-MAC
|
(cond (IS-MAC
|
||||||
(setq mac-command-modifier 'super
|
(setq mac-command-modifier 'super
|
||||||
mac-option-modifier 'meta
|
mac-option-modifier 'meta
|
||||||
|
@ -35,28 +61,7 @@
|
||||||
ns-use-native-fullscreen nil
|
ns-use-native-fullscreen nil
|
||||||
;; Visit files opened outside of Emacs in existing frame, rather
|
;; Visit files opened outside of Emacs in existing frame, rather
|
||||||
;; than a new one
|
;; than a new one
|
||||||
ns-pop-up-frames nil)
|
ns-pop-up-frames nil))
|
||||||
|
|
||||||
(when (or (daemonp) (display-graphic-p))
|
|
||||||
;; Syncs ns frame parameters with theme (and fixes mismatching text
|
|
||||||
;; colr in the frame title)
|
|
||||||
(when (require 'ns-auto-titlebar nil t)
|
|
||||||
(add-hook 'doom-load-theme-hook #'ns-auto-titlebar-mode))
|
|
||||||
|
|
||||||
;; 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."
|
|
||||||
(exec-path-from-shell-copy-envs vars))
|
|
||||||
(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-variables
|
|
||||||
(nconc exec-path-from-shell-variables '("LC_CTYPE" "LC_ALL" "LANG")))
|
|
||||||
(exec-path-from-shell-initialize))))
|
|
||||||
|
|
||||||
(IS-LINUX
|
(IS-LINUX
|
||||||
(setq x-gtk-use-system-tooltips nil ; native tooltips are ugly!
|
(setq x-gtk-use-system-tooltips nil ; native tooltips are ugly!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue