annotate lisp/env.el @ 2186:82e8ee492593

(selection_request_event, selection_clear_event): New event kinds.
author Richard M. Stallman <rms@gnu.org>
date Mon, 15 Mar 1993 05:43:15 +0000
parents 678ff000d9c8
children 9e7ec92a4fdf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
1185
4ec50a934e54 entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
3 ;;; Copyright Free Software Foundation 1991
4ec50a934e54 entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
5 ;; Maintainer: FSF
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
6 ;; Keywords: extensions
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
7
489
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;;; This file is part of GNU Emacs.
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;;; GNU Emacs is free software; you can redistribute it and/or modify
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;;; any later version.
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;;; GNU Emacs is distributed in the hope that it will be useful,
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;;; GNU General Public License for more details.
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;;; You should have received a copy of the GNU General Public License
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 ;;; along with GNU Emacs; see the file COPYING. If not, write to
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
24 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
25
1218
678ff000d9c8 (setenv): Make it autoload.
Richard M. Stallman <rms@gnu.org>
parents: 1216
diff changeset
26 ;;;###autoload
489
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 (defun setenv (variable value)
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 "Set the value of the environment variable named VARIABLE to VALUE.
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 VARIABLE and VALUE should both be strings.
1216
6a8704922fe8 Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 1185
diff changeset
30 This function works by modifying `process-environment'."
1185
4ec50a934e54 entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
31 (interactive "sSet environment variable: \nsSet %s to value: ")
489
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 (if (string-match "=" variable)
1185
4ec50a934e54 entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
33 (error "Environment variable name contains `='")
4ec50a934e54 entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
34 (let ((pattern (concat "\\`" (regexp-quote (concat variable "="))))
489
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 (scan process-environment))
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 (while scan
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 (cond
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 ((string-match pattern (car scan))
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 (setcar scan (concat variable "=" value))
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 (setq scan nil))
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 ((null (setq scan (cdr scan)))
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 (setq process-environment
3d2d0362a496 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 (cons (concat variable "=" value) process-environment))))))))
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 489
diff changeset
44
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 489
diff changeset
45 (provide 'setenv)
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 489
diff changeset
46
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
47 ;;; setenv.el ends here