ここに私が思いつくことができるものがあります:
(defun source-file-and-get-envs (filename)
(let* ((cmd (concat ". " filename "; env"))
(env-str (shell-command-to-string cmd))
(env-lines (split-string env-str "\n"))
(envs (mapcar (lambda (s) (replace-regexp-in-string "=.*$" "" s)) env-lines)))
(delete "" envs)))
(exec-path-from-shell-copy-envs (source-file-and-get-envs "~/.profile")))
与えられたファイルをソースし、 env
から環境変数名だけを取得します。