Configuration files

emacs: implement shell env loading for desktop

Changed files
+24
.config
emacs
+24
.config/emacs/init.el
··· 24 24 (add-to-list 'package-archives 25 25 '("melpa" . "https://melpa.org/packages/") t) 26 26 27 + ;;;;;;;;;;;;;; 28 + ;; LOAD ENV ;; 29 + ;;;;;;;;;;;;;; 30 + (setq krg-env-file-name ".env.el") 31 + (when window-system 32 + (let ((env-file (conf-dir krg-env-file-name))) 33 + (when (file-exists-p env-file) 34 + (load env-file)))) 35 + 36 + (defun update-env-file() 37 + (interactive) 38 + (let ((shell-path (getenv "PATH")) 39 + (env-file (conf-dir krg-env-file-name))) 40 + (with-temp-buffer 41 + (make-local-variable 'make-backup-files) 42 + (setq make-backup-files nil) 43 + (insert 44 + ";;; " krg-env-file-name " -*- lexical-binding: t; -*-\n" 45 + ";;; " (current-time-string) " " (nth 1 (current-time-zone)) ".\n" 46 + "(setenv \"PATH\" \"" shell-path "\")\n" 47 + "(setq exec-path (split-string \"" shell-path "\" \":\"))") 48 + (when (file-writable-p env-file) 49 + (write-file env-file))))) 50 + 27 51 ;;;;;;;;;;;;;;;;;;;; 28 52 ;; BASIC SETTINGS ;; 29 53 ;;;;;;;;;;;;;;;;;;;;