Mercurial > emacs
comparison lisp/env.el @ 9345:832197fec54d
(read-envvar-name): Special meaning for MUSTMATCH
neither t nor nil.
(setenv): Use that new case, when clearing a var.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 05 Oct 1994 06:29:50 +0000 |
parents | 8f05784959cc |
children | 9c090a7674c8 |
comparison
equal
deleted
inserted
replaced
9344:43cf4ed3f5f0 | 9345:832197fec54d |
---|---|
33 ;; History list for environment variable names. | 33 ;; History list for environment variable names. |
34 (defvar read-envvar-name-history nil) | 34 (defvar read-envvar-name-history nil) |
35 | 35 |
36 (defun read-envvar-name (prompt &optional mustmatch) | 36 (defun read-envvar-name (prompt &optional mustmatch) |
37 "Read environment variable name, prompting with PROMPT. | 37 "Read environment variable name, prompting with PROMPT. |
38 Optional second arg MUSTMATCH, if non-nil, means require existing envvar name." | 38 Optional second arg MUSTMATCH, if non-nil, means require existing envvar name. |
39 If it is also not t, RET does not exit if it does non-null completion." | |
39 (completing-read prompt | 40 (completing-read prompt |
40 (mapcar (function | 41 (mapcar (function |
41 (lambda (enventry) | 42 (lambda (enventry) |
42 (list (substring enventry 0 | 43 (list (substring enventry 0 |
43 (string-match "=" enventry))))) | 44 (string-match "=" enventry))))) |
58 appears at the front of the history list when you type in the new value. | 59 appears at the front of the history list when you type in the new value. |
59 | 60 |
60 This function works by modifying `process-environment'." | 61 This function works by modifying `process-environment'." |
61 (interactive | 62 (interactive |
62 (if current-prefix-arg | 63 (if current-prefix-arg |
63 (list (read-envvar-name "Clear environment variable: " t) nil t) | 64 (list (read-envvar-name "Clear environment variable: " 'exact) nil t) |
64 (let* ((var (read-envvar-name "Set environment variable: " nil)) | 65 (let* ((var (read-envvar-name "Set environment variable: " nil)) |
65 (oldval (getenv var)) | 66 (oldval (getenv var)) |
66 newval | 67 newval |
67 oldhist) | 68 oldhist) |
68 ;; Don't put the current value on the history | 69 ;; Don't put the current value on the history |