Function: exec-path-from-shell-getenvs
exec-path-from-shell-getenvs is a natively compiled function defined
in exec-path-from-shell.el.
Signature
(exec-path-from-shell-getenvs NAMES)
Documentation
Get the environment variables with NAMES from the user's shell.
Execute the shell according to exec-path-from-shell-arguments.
The result is a list of (NAME . VALUE) pairs.
Source Code
;; Defined in /nix/store/a3f7aq5s6rdw5arrqvyppbs5jfrlsxa3-emacs-packages-deps/share/emacs/site-lisp/elpa/exec-path-from-shell-20260423.1833/exec-path-from-shell.el
(defun exec-path-from-shell-getenvs (names)
"Get the environment variables with NAMES from the user's shell.
Execute the shell according to `exec-path-from-shell-arguments'.
The result is a list of (NAME . VALUE) pairs."
(when (file-remote-p default-directory)
(error "You cannot run exec-path-from-shell from a remote buffer (Tramp, etc.)"))
(if (exec-path-from-shell--nushell-p (exec-path-from-shell--shell))
(exec-path-from-shell-getenvs--nushell names)
(let* ((random-default (md5 (format "%s%s%s" (emacs-pid) (random) (current-time))))
(dollar-names (mapcar (lambda (n) (format "${%s-%s}" n random-default)) names))
(values (split-string (exec-path-from-shell-printf
(mapconcat #'identity (make-list (length names) "%s") "\\000")
dollar-names) "\0")))
(let (result)
(while names
(prog1
(let ((value (car values)))
(push (cons (car names)
(unless (string-equal random-default value)
value))
result))
(setq values (cdr values)
names (cdr names))))
result))))