Mercurial > emacs
annotate lisp/env.el @ 5684:6479e0eabb27
* keyboard.c (make_lispy_event): Add USE_X_TOOLKIT conditional and
test FRAME_EXTERNAL_MENU_BAR.
(map_event_to_object) [USE_X_TOOLKIT]: Declare and use it.
author | Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr> |
---|---|
date | Thu, 27 Jan 1994 11:01:59 +0000 |
parents | f4a7ac2ec651 |
children | f8c8bbeca971 |
rev | line source |
---|---|
2403
05d8916e4cde
renamed to env.el; changed setenv to putenv.
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
1 ;;; env.el --- functions to manipulate environment variables. |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
2 |
1185 | 3 ;;; Copyright Free Software Foundation 1991 |
4 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
5 ;; Maintainer: FSF |
2315
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1218
diff
changeset
|
6 ;; Keywords: processes, unix |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
7 |
489 | 8 ;;; This file is part of GNU Emacs. |
9 | |
10 ;;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;;; 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
|
12 ;;; the Free Software Foundation; either version 2, or (at your option) |
489 | 13 ;;; any later version. |
14 | |
15 ;;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;;; GNU General Public License for more details. | |
19 | |
20 ;;; You should have received a copy of the GNU General Public License | |
21 ;;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
2315
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1218
diff
changeset
|
24 ;;; Commentary: |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1218
diff
changeset
|
25 |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1218
diff
changeset
|
26 ;; UNIX processes inherit a list of name-to-string associations from |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1218
diff
changeset
|
27 ;; their parents called their `environment'; these are commonly used |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1218
diff
changeset
|
28 ;; to control program options. This package permits you to set |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1218
diff
changeset
|
29 ;; environment variables to be passed to any sub-process run under Emacs. |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1218
diff
changeset
|
30 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
31 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
32 |
1218
678ff000d9c8
(setenv): Make it autoload.
Richard M. Stallman <rms@gnu.org>
parents:
1216
diff
changeset
|
33 ;;;###autoload |
2410
cc774e22d049
(setenv): Renamed back from putenv.
Richard M. Stallman <rms@gnu.org>
parents:
2403
diff
changeset
|
34 (defun setenv (variable &optional value) |
489 | 35 "Set the value of the environment variable named VARIABLE to VALUE. |
2403
05d8916e4cde
renamed to env.el; changed setenv to putenv.
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
36 VARIABLE should be a string. VALUE is optional; if not provided or is |
05d8916e4cde
renamed to env.el; changed setenv to putenv.
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
37 `nil', the environment variable VARIABLE will be removed. |
1216 | 38 This function works by modifying `process-environment'." |
1185 | 39 (interactive "sSet environment variable: \nsSet %s to value: ") |
489 | 40 (if (string-match "=" variable) |
2403
05d8916e4cde
renamed to env.el; changed setenv to putenv.
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
41 (error "Environment variable name `%s' contains `='" variable) |
1185 | 42 (let ((pattern (concat "\\`" (regexp-quote (concat variable "=")))) |
3667
f4a7ac2ec651
(setenv): Treat case as significant.
Richard M. Stallman <rms@gnu.org>
parents:
2410
diff
changeset
|
43 (case-fold-search nil) |
489 | 44 (scan process-environment)) |
45 (while scan | |
46 (cond | |
47 ((string-match pattern (car scan)) | |
2403
05d8916e4cde
renamed to env.el; changed setenv to putenv.
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
48 (if (eq nil value) |
05d8916e4cde
renamed to env.el; changed setenv to putenv.
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
49 (setq process-environment (delq (car scan) process-environment)) |
05d8916e4cde
renamed to env.el; changed setenv to putenv.
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
50 (setcar scan (concat variable "=" value))) |
489 | 51 (setq scan nil)) |
52 ((null (setq scan (cdr scan))) | |
53 (setq process-environment | |
54 (cons (concat variable "=" value) process-environment)))))))) | |
584 | 55 |
2403
05d8916e4cde
renamed to env.el; changed setenv to putenv.
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
56 (provide 'env) |
05d8916e4cde
renamed to env.el; changed setenv to putenv.
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
57 |
05d8916e4cde
renamed to env.el; changed setenv to putenv.
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
58 ;;; env.el ends here |