Function: comint-substitute-in-file-name

comint-substitute-in-file-name is a byte-compiled function defined in comint.el.gz.

Signature

(comint-substitute-in-file-name FILENAME)

Documentation

Return FILENAME with environment variables substituted.

Supports additional environment variable syntax of the command interpreter (e.g., the percent notation of cmd.exe on Windows).

Source Code

;; Defined in /usr/src/emacs/lisp/comint.el.gz
(defun comint-substitute-in-file-name (filename)
  "Return FILENAME with environment variables substituted.
Supports additional environment variable syntax of the command
interpreter (e.g., the percent notation of cmd.exe on Windows)."
  (let ((name (substitute-in-file-name filename)))
    (if (memq system-type '(ms-dos windows-nt))
	(let (env-var-name
	      env-var-val)
	  (save-match-data
	    (while (string-match "%\\([^\\/]*\\)%" name)
	      (setq env-var-name (match-string 1 name))
	      (setq env-var-val (or (getenv env-var-name) ""))
	      (setq name (replace-match env-var-val t t name))))))
    name))