Function: eshell-get-path

eshell-get-path is a byte-compiled function defined in esh-util.el.gz.

Signature

(eshell-get-path &optional LITERAL-P)

Documentation

Return $PATH as a list.

If LITERAL-P is nil, return each directory of the path as a full, possibly-remote file name; on MS-Windows, add the current directory as the first directory in the path as well.

If LITERAL-P is non-nil, return the local part of each directory, as the $PATH was actually specified.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-util.el.gz
(defun eshell-get-path (&optional literal-p)
  "Return $PATH as a list.
If LITERAL-P is nil, return each directory of the path as a full,
possibly-remote file name; on MS-Windows, add the current
directory as the first directory in the path as well.

If LITERAL-P is non-nil, return the local part of each directory,
as the $PATH was actually specified."
  (with-connection-local-application-variables 'eshell
    (let ((remote (file-remote-p default-directory))
          (path
           (or eshell-path-env-list
               ;; If not already cached, get the path from
               ;; `exec-path', removing the last element, which is
               ;; `exec-directory'.
               (setq-connection-local eshell-path-env-list
                                      (butlast (exec-path))))))
      (when (and (not literal-p)
                 (not remote)
                 (eshell-under-windows-p)
                 (not (member "." path)))
        (push "." path))
      (if (and remote (not literal-p))
          (mapcar (lambda (x) (concat remote x)) path)
        path))))