Replace exec-path-from-shell
This commit is contained in:
9
init.el
9
init.el
@@ -1,4 +1,6 @@
|
|||||||
;; -*- lexical-binding: t -*-
|
;;; init.el --- This is the -*- lexical-binding: t -*-
|
||||||
|
;;; Commentary:
|
||||||
|
;;; blablabla
|
||||||
|
|
||||||
(require 'init-better-default)
|
(require 'init-better-default)
|
||||||
|
|
||||||
@@ -32,3 +34,8 @@
|
|||||||
(require 'init-haskell)
|
(require 'init-haskell)
|
||||||
(require 'init-rust)
|
(require 'init-rust)
|
||||||
(require 'init-ocaml)
|
(require 'init-ocaml)
|
||||||
|
|
||||||
|
(provide 'init)
|
||||||
|
;;; Code:
|
||||||
|
;;; alskdjasd
|
||||||
|
;;; init.el ends here
|
||||||
|
|||||||
@@ -7,10 +7,49 @@
|
|||||||
;; To disable collection of benchmark data after init is done.
|
;; To disable collection of benchmark data after init is done.
|
||||||
(add-hook 'elpaca-after-init-hook 'benchmark-init/deactivate))
|
(add-hook 'elpaca-after-init-hook 'benchmark-init/deactivate))
|
||||||
|
|
||||||
(use-package exec-path-from-shell
|
(defconst my-local-dir (concat user-emacs-directory ".local/"))
|
||||||
:init
|
|
||||||
(when (memq window-system '(mac ns x))
|
(defconst my-env-file (concat my-local-dir "env"))
|
||||||
(exec-path-from-shell-initialize)))
|
|
||||||
|
(defun my-load-envvars-file (file &optional noerror)
|
||||||
|
"Read and set envvars from FILE.
|
||||||
|
If NOERROR is non-nil, don't throw an error if the file doesn't exist or is
|
||||||
|
unreadable. Returns the names of envvars that were changed."
|
||||||
|
(if (not (file-readable-p file))
|
||||||
|
(unless noerror
|
||||||
|
(signal 'file-error (list "Couldn't read envvar file" file)))
|
||||||
|
(let (envvars environment)
|
||||||
|
(with-temp-buffer
|
||||||
|
(save-excursion
|
||||||
|
(insert "\n")
|
||||||
|
(insert-file-contents file))
|
||||||
|
(while (re-search-forward "\n *\\([^#= \n]*\\)=" nil t)
|
||||||
|
(push (match-string 1) envvars)
|
||||||
|
(push (buffer-substring
|
||||||
|
(match-beginning 1)
|
||||||
|
(1- (or (save-excursion
|
||||||
|
(when (re-search-forward "^\\([^= ]+\\)=" nil t)
|
||||||
|
(line-beginning-position)))
|
||||||
|
(point-max))))
|
||||||
|
environment)))
|
||||||
|
(when environment
|
||||||
|
(setq process-environment
|
||||||
|
(append (nreverse environment) process-environment)
|
||||||
|
exec-path
|
||||||
|
(if (member "PATH" envvars)
|
||||||
|
(append (split-string (getenv "PATH") path-separator t)
|
||||||
|
(list exec-directory))
|
||||||
|
exec-path)
|
||||||
|
shell-file-name
|
||||||
|
(if (member "SHELL" envvars)
|
||||||
|
(or (getenv "SHELL") shell-file-name)
|
||||||
|
shell-file-name))
|
||||||
|
envvars))))
|
||||||
|
|
||||||
|
(when (and (or (display-graphic-p)
|
||||||
|
(daemonp))
|
||||||
|
(file-exists-p my-env-file))
|
||||||
|
(my-load-envvars-file my-env-file))
|
||||||
|
|
||||||
(setq custom-file (expand-file-name "~/.emacs.d/custom.el"))
|
(setq custom-file (expand-file-name "~/.emacs.d/custom.el"))
|
||||||
(add-hook 'elpaca-after-init-hook (lambda () (load custom-file 'no-error 'no-message)))
|
(add-hook 'elpaca-after-init-hook (lambda () (load custom-file 'no-error 'no-message)))
|
||||||
|
|||||||
Reference in New Issue
Block a user