55 |
`$FOO' where FOO is an environment variable name means to substitute |
`$FOO' where FOO is an environment variable name means to substitute |
56 |
the value of that variable. The variable name should be terminated |
the value of that variable. The variable name should be terminated |
57 |
with a character not a letter, digit or underscore; otherwise, enclose |
with a character not a letter, digit or underscore; otherwise, enclose |
58 |
the entire variable name in braces. Use `$$' to insert a single |
the entire variable name in braces. Use `$$' to insert a single |
59 |
dollar sign." |
dollar sign." |
60 |
(let ((start 0)) |
(let ((start 0)) |
61 |
(while (string-match |
(while (string-match |
62 |
(rx (or (and "$" (submatch (1+ (in "a-zA-Z0-9_")))) |
(rx (or (and "$" (submatch (1+ (in "a-zA-Z0-9_")))) |
63 |
(and "${" (submatch (minimal-match (0+ anything))) "}") |
(and "${" (submatch (minimal-match (0+ anything))) "}") |
64 |
"$$")) |
"$$")) |
101 |
(when value |
(when value |
102 |
(push value setenv-history)) |
(push value setenv-history)) |
103 |
;; Here finally we specify the args to give call setenv with. |
;; Here finally we specify the args to give call setenv with. |
104 |
(list var |
(list var |
105 |
(read-from-minibuffer (format "Set %s to value: " var) |
(read-from-minibuffer (format "Set %s to value: " var) |
106 |
nil nil nil 'setenv-history |
nil nil nil 'setenv-history |
107 |
value) |
value) |
108 |
nil |
nil |
109 |
t)))) |
t)))) |
110 |
(if unset |
(if unset |
111 |
(setq value nil) |
(setq value nil) |
112 |
(if substitute-env-vars |
(if substitute-env-vars |
113 |
(setq value (substitute-env-vars value)))) |
(setq value (substitute-env-vars value)))) |