aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-07-18 17:09:36 +0000
committerChong Yidong2008-07-18 17:09:36 +0000
commitbd2356c09e4e1a9e7614ec57695d349ec47e0e10 (patch)
tree252cf08e2a44f63d66c5bfbd60d01f2e75ef694a
parentb90cc05848b0eb34ad5e5208a7843f4303d0fe42 (diff)
downloademacs-bd2356c09e4e1a9e7614ec57695d349ec47e0e10.tar.gz
emacs-bd2356c09e4e1a9e7614ec57695d349ec47e0e10.zip
File removed.
-rw-r--r--lisp/ns-grabenv.el60
1 files changed, 0 insertions, 60 deletions
diff --git a/lisp/ns-grabenv.el b/lisp/ns-grabenv.el
deleted file mode 100644
index 643daba2ca2..00000000000
--- a/lisp/ns-grabenv.el
+++ /dev/null
@@ -1,60 +0,0 @@
1;;; ns-grabenv.el --- functions to set environment variables by running a subshell
2
3;; Copyright (C) 1993, 1994, 2005, 2006, 2008 Free Software Foundation, Inc.
4
5;; Author: Carl Edman, Christian Limpach, Scott Bender, Christophe de Dinechin, Adrian Robert
6;; Keywords: terminals
7
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
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) 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. If not, see <http://www.gnu.org/licenses/>.
22
23
24;;; Idea based on NS 4.2 distribution, this version of code based on
25;;; mac-read-environment-vars-from-shell () by David Reitter in Aquamacs dist..
26
27
28;; utility function
29(defun ns-make-command-string (cmdlist)
30 (let ((str "")
31 (cmds cmdlist))
32 (while cmds
33 (if (not (eq str "")) (setq str (format "%s ; " str)))
34 (setq str (format "%s%s" str (car cmds)))
35 (setq cmds (cdr cmds)))
36 str))
37
38
39;;;###autoload
40(defun ns-grabenv (&optional shell-path &optional startup)
41 "Run a shell subprocess, and interpret its output as a series of environment\n\
42variables to insert into the emacs environment. The first optional argument\n\
43gives the path to the shell (defaults to the current setting of\n\
44shell-file-name). The remaining arguments are interpreted as a list of\n\
45commands for it to execute (defaults to \"printenv\")."
46 (interactive)
47 (with-temp-buffer
48 (let ((shell-file-name (if shell-path shell-path shell-file-name))
49 (cmd (ns-make-command-string (if startup startup '("printenv")))))
50 (shell-command cmd t)
51 (while (search-forward-regexp "^\\([A-Za-z_0-9]+\\)=\\(.*\\)$" nil t)
52 (setenv (match-string 1)
53 (if (equal (match-string 1) "PATH")
54 (concat (getenv "PATH") ":" (match-string 2))
55 (match-string 2)))))))
56
57(provide 'ns-grabenv)
58
59;; arch-tag: e65e1dd8-1566-460c-ad66-07948588be56
60;;; ns-grabenv.el ends here