(follow-mode): Don't run hooks twice. Use `when'.
[bpt/emacs.git] / lisp / env.el
index 33d4287..128228b 100644 (file)
@@ -10,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -55,7 +55,8 @@ If it is also not t, RET does not exit if it does non-null completion."
                                     (substring enventry 0
                                                (string-match "=" enventry)))))
                           (append process-environment
-                                  (frame-parameter (frame-with-environment) 'environment)))
+                                  nil ;;(frame-parameter (frame-with-environment) 'environment)
+                                  ))
                   nil mustmatch nil 'read-envvar-name-history))
 
 ;; History list for VALUE argument to setenv.
@@ -191,9 +192,8 @@ a side-effect."
       (setq process-environment (setenv-internal process-environment
                                                 variable value t))
     (setq frame (frame-with-environment frame))
-    (set-frame-parameter frame 'environment
-                        (setenv-internal (frame-parameter frame 'environment)
-                                         variable value nil)))
+    (setq process-environment (setenv-internal process-environment
+                                               variable value nil)))
   value)
 
 (defun getenv (variable &optional frame)
@@ -212,20 +212,24 @@ in the environment list of the selected frame."
   (let ((value (getenv-internal (if (multibyte-string-p variable)
                                    (encode-coding-string
                                     variable locale-coding-system)
-                                 variable))))
+                                 variable)
+                               frame)))
     (if (and enable-multibyte-characters value)
        (setq value (decode-coding-string value locale-coding-system)))
     (when (interactive-p)
       (message "%s" (if value value "Not set")))
     value))
 
-(defun environment ()
+(defun environment (&optional frame)
   "Return a list of environment variables with their values.
 Each entry in the list is a string of the form NAME=VALUE.
 
 The returned list can not be used to change environment
 variables, only read them.  See `setenv' to do that.
 
+If optional parameter FRAME is non-nil, then it should be a
+frame.  The function returns the environment of that frame.
+
 The list is constructed by concatenating the elements of
 `process-environment' and the 'environment parameter of the
 selected frame, and removing duplicated and empty values.
@@ -234,8 +238,8 @@ Non-ASCII characters are encoded according to the initial value of
 `locale-coding-system', i.e. the elements must normally be decoded for use.
 See `setenv' and `getenv'."
   (let* ((env (append process-environment
-                     (frame-parameter (frame-with-environment)
-                                      'environment)
+;;                   (frame-parameter (frame-with-environment frame)
+;;                                    'environment)
                      nil))
         (scan env)
         prev seen)
@@ -306,5 +310,5 @@ All the VALUEFORMs are evaluated before any variables are set."
 
 (provide 'env)
 
-;;; arch-tag: b7d6a8f7-bc81-46db-8e39-8d721d4ed0b8
+;; arch-tag: b7d6a8f7-bc81-46db-8e39-8d721d4ed0b8
 ;;; env.el ends here