Mercurial > emacs
annotate lisp/env.el @ 1091:3302f6e93ce5
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 11 Sep 1992 09:04:24 +0000 |
parents | 38b2499cb3e9 |
children | 4ec50a934e54 |
rev | line source |
---|---|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
1 ;;; setenv.el --- functions to manipulate environment variables. |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
2 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
3 ;; Maintainer: FSF |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
4 ;; Last-Modified: 16 Mar 1992 |
814
38b2499cb3e9
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
5 ;; Keywords: extensions |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
6 |
489 | 7 ;;; Copyright Free Software Foundation 1991 |
8 | |
9 ;;; This file is part of GNU Emacs. | |
10 | |
11 ;;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
13 ;;; the Free Software Foundation; either version 2, or (at your option) |
489 | 14 ;;; any later version. |
15 | |
16 ;;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;;; GNU General Public License for more details. | |
20 | |
21 ;;; You should have received a copy of the GNU General Public License | |
22 ;;; along with GNU Emacs; see the file COPYING. If not, write to | |
23 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
25 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
26 |
489 | 27 (defun setenv (variable value) |
28 "Set the value of the environment variable named VARIABLE to VALUE. | |
29 VARIABLE and VALUE should both be strings. | |
30 This function works by modifying process-environment." | |
31 (if (string-match "=" variable) | |
32 (error "name of environment variable contains an '=' character") | |
33 (let ((pattern (concat "^" (regexp-quote (concat variable "=")))) | |
34 (scan process-environment)) | |
35 (while scan | |
36 (cond | |
37 ((string-match pattern (car scan)) | |
38 (setcar scan (concat variable "=" value)) | |
39 (setq scan nil)) | |
40 ((null (setq scan (cdr scan))) | |
41 (setq process-environment | |
42 (cons (concat variable "=" value) process-environment)))))))) | |
584 | 43 |
44 (provide 'setenv) | |
45 | |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
46 ;;; setenv.el ends here |