;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301\302\303\304\305\306\307&\210\310\311\312\313\314\315\306\301&\210\310\316\317\320\314\321\306\301&\210\310\322\302\323\314\324\306\301&\207" [custom-declare-group exec-path-from-shell nil "Make Emacs use shell-defined values for $PATH etc." :prefix "exec-path-from-shell-" :group environment custom-declare-variable exec-path-from-shell-variables '("PATH" "MANPATH") "List of environment variables which are copied from the shell." :type (repeat (string :tag "Environment variable")) exec-path-from-shell-check-startup-files t "If non-nil, warn if variables are being set in the wrong shell startup files.\nEnvironment variables should be set in .profile or .zshenv rather than\n.bashrc or .zshrc." boolean exec-path-from-shell-shell-name "If non-nil, use this shell executable.\nOtherwise, use either `shell-file-name' (if set), or the value of\nthe SHELL environment variable." (choice (file :tag "Shell executable") (const :tag "Use `shell-file-name' or $SHELL" nil))] 8) #@34 Display debug info when non-nil. (defvar exec-path-from-shell-debug nil (#$ . 1087)) #@69 Double-quote S, escaping any double-quotes already contained in it. (defalias 'exec-path-from-shell--double-quote #[(s) "\301\302\301\303#\301Q\207" [s "\"" replace-regexp-in-string "\\\\\""] 5 (#$ . 1178)]) #@83 Return the shell to use. See documentation for `exec-path-from-shell-shell-name'. (defalias 'exec-path-from-shell--shell #[nil "\206 \206\302\303!\206\304\305!\207" [exec-path-from-shell-shell-name shell-file-name getenv "SHELL" error "SHELL environment variable is unset"] 2 (#$ . 1393)]) #@99 Additional arguments to pass to the shell. The default value denotes an interactive login shell. (custom-declare-variable 'exec-path-from-shell-arguments '(let ((shell (exec-path-from-shell--shell))) (if (string-match-p "t?csh$" shell) (list "-d") (if (string-match-p "fish" shell) (list "-l") (list "-l" "-i")))) '(#$ . 1696) :type '(repeat (string :tag "Shell argument")) :group 'exec-path-from-shell) #@73 Print MSG and ARGS like `message', but only if debug output is enabled. (defalias 'exec-path-from-shell--debug #[(msg &rest args) "\205 \303\304 \n#\207" [exec-path-from-shell-debug msg args apply message] 4 (#$ . 2107)]) #@71 Return non-nil iff SHELL supports the standard ${VAR-default} syntax. (defalias 'exec-path-from-shell--standard-shell-p #[(shell) "\301\302\"?\207" [shell string-match "\\(fish\\|t?csh\\)$"] 3 (#$ . 2337)]) #@423 Return the result of printing STR in the user's shell. Executes the shell as interactive login shell. STR is inserted literally in a single-quoted argument to printf, and may therefore contain backslashed escape sequences understood by printf. ARGS is an optional list of args which will be inserted by printf in place of any % placeholders in STR. ARGS are not automatically shell-escaped, so they may contain $ etc. (defalias 'exec-path-from-shell-printf #[(str &optional args) "\306\307!\206\307\211\310 \311\312\313\n\314#\260\315 \316 \317\320\f!\203$ \202)\321\322 !PD\"&\323\324\325\"'r'q\210\326\216\327\330\f&#\210\331\332\f\333\325\333&&(\327\334\335 \"\210(\336U\204c\337\340\f&\335 $\210)eb\210\341\342\333\325#\203u\343\344!\202z\337\345\335 \".\207" [printf-bin str args printf-command shell exec-path-from-shell-arguments executable-find "printf" " '__RESULT\\000" "\\000__RESULT' " mapconcat exec-path-from-shell--double-quote " " exec-path-from-shell--shell append "-c" exec-path-from-shell--standard-shell-p "sh -c " shell-quote-argument generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1=#:temp-buffer buffer-name kill-buffer] 2] exec-path-from-shell--debug "Invoking shell %s with args %S" apply call-process nil "Shell printed: %S" buffer-string 0 error "Non-zero exit code from shell %s invoked with args %S. Output was:\n%S" re-search-forward "__RESULT\\(.*\\)__RESULT" match-string 1 "Expected printf output from shell, but got: %S" shell-args #1# exit-code] 9 (#$ . 2552)]) #@177 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. (defalias 'exec-path-from-shell-getenvs #[(names) "\306\307\310\311 \312 \313 $!\314\315 \"\316\317\320\321\322 G\323\"\324#\n\"\325\"\326 \203C @ @ \230?\2054 B\fB) A A\211\204'\f,\207" [random-default names dollar-names values result value md5 format "%s%s%s" emacs-pid random current-time mapcar #[(n) "\302\303 #\207" [n random-default format "${%s-%s}"] 4] split-string exec-path-from-shell-printf mapconcat identity make-list "%s" "\\000" "" nil] 8 (#$ . 4102)]) #@175 Get the environment variable NAME from the user's shell. Execute the shell as interactive login shell, have it output the variable of NAME and return this output as string. (defalias 'exec-path-from-shell-getenv #[(name) "\301\302C!\"A\207" [name assoc exec-path-from-shell-getenvs] 4 (#$ . 4768)]) #@140 Set the value of environment var NAME to VALUE. Additionally, if NAME is "PATH" then also set corresponding variables such as `exec-path'. (defalias 'exec-path-from-shell-setenv #[(name value) "\305 \"\210\306\230\205 \307\310 ! C\"\211\207" [name value eshell-path-env exec-directory exec-path setenv "PATH" append parse-colon-path] 3 (#$ . 5077)]) #@251 Set the environment variables with NAMES from the user's shell. As a special case, if the variable is $PATH, then `exec-path' and `eshell-path-env' are also set appropriately. The result is an alist, as described by `exec-path-from-shell-getenvs'. (defalias 'exec-path-from-shell-copy-envs #[(names) "\303!\n\203\f\304 !\210\305\306 \")\207" [names pairs exec-path-from-shell-check-startup-files exec-path-from-shell-getenvs exec-path-from-shell--maybe-warn-about-startup-files mapc #[(pair) "\301@A\"\207" [pair exec-path-from-shell-setenv] 3]] 3 (#$ . 5440)]) #@89 Warn the user if the value of PAIRS seems to depend on interactive shell startup files. (defalias 'exec-path-from-shell--maybe-warn-about-startup-files #[(pairs) "\306\307\" =?\205F \310\311\312\n\"!\313\n\313\211\203<@\211\314 @ \"\232\2043 @\fBA\211\204 *\f\205E\315\316\f\"+)\207" [exec-path-from-shell-arguments without-minus-i pairs alt-pairs different pair remove "-i" exec-path-from-shell-getenvs mapcar car nil assoc message "You appear to be setting environment variables %S in your .bashrc or .zshrc: those files are only read by interactive shells, so you should instead set environment variables in startup files like .profile, .bash_profile or .zshenv. Refer to your shell's man page for more info. Customize `exec-path-from-shell-arguments' to remove \"-i\" when done, or disable `exec-path-from-shell-check-startup-files' to disable this message." --dolist-tail--] 5 (#$ . 6015)]) #@219 Set the environment variable $NAME from the user's shell. As a special case, if the variable is $PATH, then `exec-path' and `eshell-path-env' are also set appropriately. Return the value of the environment variable. (defalias 'exec-path-from-shell-copy-env #[(name) "\301C!@A\207" [name exec-path-from-shell-copy-envs] 2 (#$ . 6942) "sCopy value of which environment variable from shell? "]) #@198 Initialize environment from the user's shell. The values of all the environment variables named in `exec-path-from-shell-variables' are set from the corresponding values used in the user's shell. (defalias 'exec-path-from-shell-initialize #[nil "\301!\207" [exec-path-from-shell-variables exec-path-from-shell-copy-envs] 2 (#$ . 7344) nil]) (provide 'exec-path-from-shell)