aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2014-11-22 12:37:04 +0100
committerMichael Albinus2014-11-22 12:37:04 +0100
commitcd22fd754b71ff64bbabd05bb6df2df8fa5a8915 (patch)
treee250c0235b6901633126fd124a7e09ed619416ac
parent4fe5b7c0bbb77286ce2866c9237796d0587ce2a3 (diff)
downloademacs-cd22fd754b71ff64bbabd05bb6df2df8fa5a8915.tar.gz
emacs-cd22fd754b71ff64bbabd05bb6df2df8fa5a8915.zip
Propagate remote process environment.
* net/tramp-sh.el (tramp-sh-handle-start-file-process) (tramp-sh-handle-process-file): Propagate `process-environment'. * vc/vc-hg.el (vc-hg-state): No special handling for remote files; Tramp propagates environment variables now.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/net/tramp-sh.el35
-rw-r--r--lisp/vc/vc-hg.el17
3 files changed, 43 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 426543ce4f0..d3a9b64a478 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,10 +1,18 @@
12014-11-22 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp-sh.el (tramp-sh-handle-start-file-process)
4 (tramp-sh-handle-process-file): Propagate `process-environment'.
5
6 * vc/vc-hg.el (vc-hg-state): No special handling for remote files;
7 Tramp propagates environment variables now.
8
12014-11-22 Eric S. Raymond <esr@snark> 92014-11-22 Eric S. Raymond <esr@snark>
2 10
3 * vc-filewise.el: New file to isolate code used only by the 11 * vc/vc-filewise.el: New file to isolate code used only by the
4 file-oriented back ends (SCCS/RCS/CVS/SRC) which should not 12 file-oriented back ends (SCCS/RCS/CVS/SRC) which should not
5 live in vc.el and certainly not in vc-hooks.el. 13 live in vc.el and certainly not in vc-hooks.el.
6 14
7 * vc-hooks.el, vc-rcs.el, vc-sccs.el: vc-name -> vc-master-name. 15 * vc/vc-hooks.el, vc-rcs.el, vc-sccs.el: vc-name -> vc-master-name.
8 This is preaparatory to isolating all the 'master' functions 16 This is preaparatory to isolating all the 'master' functions
9 used only by the file-oriented back ends. With this done first, 17 used only by the file-oriented back ends. With this done first,
10 the substantive diffs will be easier to read. 18 the substantive diffs will be easier to read.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 6e46df254b2..8d7e046126c 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2835,16 +2835,27 @@ the result will be a local, non-Tramp, file name."
2835 (list (replace-match " \\\\\n" nil nil (cadr args)))) 2835 (list (replace-match " \\\\\n" nil nil (cadr args))))
2836 (setq i (+ i 250)))) 2836 (setq i (+ i 250))))
2837 (cdr args))) 2837 (cdr args)))
2838 ;; Use a human-friendly prompt, for example for `shell'.
2839 (prompt (format "PS1=%s"
2840 (format "%s %s"
2841 (file-remote-p default-directory)
2842 tramp-initial-end-of-output)))
2843 ;; We use as environment the difference to toplevel
2844 ;; `process-environment'.
2845 env
2846 (env
2847 (dolist
2848 (elt
2849 (cons prompt (nreverse (copy-sequence process-environment)))
2850 env)
2851 (or (member elt (default-toplevel-value 'process-environment))
2852 (setq env (cons elt env)))))
2838 (command 2853 (command
2839 (when (stringp program) 2854 (when (stringp program)
2840 (format "cd %s && exec %s env PS1=%s %s" 2855 (format "cd %s && exec %s env %s %s"
2841 (tramp-shell-quote-argument localname) 2856 (tramp-shell-quote-argument localname)
2842 (if heredoc (format "<<'%s'" tramp-end-of-heredoc) "") 2857 (if heredoc (format "<<'%s'" tramp-end-of-heredoc) "")
2843 ;; Use a human-friendly prompt, for example for `shell'. 2858 (mapconcat 'tramp-shell-quote-argument env " ")
2844 (tramp-shell-quote-argument
2845 (format "%s %s"
2846 (file-remote-p default-directory)
2847 tramp-initial-end-of-output))
2848 (if heredoc 2859 (if heredoc
2849 (format "%s\n(\n%s\n) </dev/tty\n%s" 2860 (format "%s\n(\n%s\n) </dev/tty\n%s"
2850 program (car args) tramp-end-of-heredoc) 2861 program (car args) tramp-end-of-heredoc)
@@ -2931,10 +2942,20 @@ the result will be a local, non-Tramp, file name."
2931 (error "Implementation does not handle immediate return")) 2942 (error "Implementation does not handle immediate return"))
2932 2943
2933 (with-parsed-tramp-file-name default-directory nil 2944 (with-parsed-tramp-file-name default-directory nil
2934 (let (command input tmpinput stderr tmpstderr outbuf ret) 2945 (let (command env input tmpinput stderr tmpstderr outbuf ret)
2935 ;; Compute command. 2946 ;; Compute command.
2936 (setq command (mapconcat 'tramp-shell-quote-argument 2947 (setq command (mapconcat 'tramp-shell-quote-argument
2937 (cons program args) " ")) 2948 (cons program args) " "))
2949 ;; We use as environment the difference to toplevel `process-environment'.
2950 (setq env
2951 (dolist (elt (nreverse (copy-sequence process-environment)) env)
2952 (or (member elt (default-toplevel-value 'process-environment))
2953 (setq env (cons elt env)))))
2954 (when env
2955 (setq command
2956 (format
2957 "env %s %s"
2958 (mapconcat 'tramp-shell-quote-argument env " ") command)))
2938 ;; Determine input. 2959 ;; Determine input.
2939 (if (null infile) 2960 (if (null infile)
2940 (setq input "/dev/null") 2961 (setq input "/dev/null")
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index dab2c7256ba..62d0bb5ba5f 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -211,18 +211,11 @@ highlighting the Log View buffer."
211 (append 211 (append
212 (list "TERM=dumb" "LANGUAGE=C" "HGPLAIN=1") 212 (list "TERM=dumb" "LANGUAGE=C" "HGPLAIN=1")
213 process-environment))) 213 process-environment)))
214 (if (file-remote-p file) 214 (process-file
215 (process-file 215 vc-hg-program nil t nil
216 "env" nil t nil 216 "--config" "alias.status=status"
217 "HGPLAIN=1" vc-hg-program 217 "--config" "defaults.status="
218 "--config" "alias.status=status" 218 "status" "-A" (file-relative-name file)))
219 "--config" "defaults.status="
220 "status" "-A" (file-relative-name file))
221 (process-file
222 vc-hg-program nil t nil
223 "--config" "alias.status=status"
224 "--config" "defaults.status="
225 "status" "-A" (file-relative-name file))))
226 ;; Some problem happened. E.g. We can't find an `hg' 219 ;; Some problem happened. E.g. We can't find an `hg'
227 ;; executable. 220 ;; executable.
228 (error nil))))))) 221 (error nil)))))))