+2014-11-22 Michael Albinus <michael.albinus@gmx.de>
+
+ * 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.
+
2014-11-22 Eric S. Raymond <esr@snark>
- * vc-filewise.el: New file to isolate code used only by the
+ * vc/vc-filewise.el: New file to isolate code used only by the
file-oriented back ends (SCCS/RCS/CVS/SRC) which should not
live in vc.el and certainly not in vc-hooks.el.
- * vc-hooks.el, vc-rcs.el, vc-sccs.el: vc-name -> vc-master-name.
+ * vc/vc-hooks.el, vc-rcs.el, vc-sccs.el: vc-name -> vc-master-name.
This is preaparatory to isolating all the 'master' functions
used only by the file-oriented back ends. With this done first,
the substantive diffs will be easier to read.
(list (replace-match " \\\\\n" nil nil (cadr args))))
(setq i (+ i 250))))
(cdr args)))
+ ;; Use a human-friendly prompt, for example for `shell'.
+ (prompt (format "PS1=%s"
+ (format "%s %s"
+ (file-remote-p default-directory)
+ tramp-initial-end-of-output)))
+ ;; We use as environment the difference to toplevel
+ ;; `process-environment'.
+ env
+ (env
+ (dolist
+ (elt
+ (cons prompt (nreverse (copy-sequence process-environment)))
+ env)
+ (or (member elt (default-toplevel-value 'process-environment))
+ (setq env (cons elt env)))))
(command
(when (stringp program)
- (format "cd %s && exec %s env PS1=%s %s"
+ (format "cd %s && exec %s env %s %s"
(tramp-shell-quote-argument localname)
(if heredoc (format "<<'%s'" tramp-end-of-heredoc) "")
- ;; Use a human-friendly prompt, for example for `shell'.
- (tramp-shell-quote-argument
- (format "%s %s"
- (file-remote-p default-directory)
- tramp-initial-end-of-output))
+ (mapconcat 'tramp-shell-quote-argument env " ")
(if heredoc
(format "%s\n(\n%s\n) </dev/tty\n%s"
program (car args) tramp-end-of-heredoc)
(error "Implementation does not handle immediate return"))
(with-parsed-tramp-file-name default-directory nil
- (let (command input tmpinput stderr tmpstderr outbuf ret)
+ (let (command env input tmpinput stderr tmpstderr outbuf ret)
;; Compute command.
(setq command (mapconcat 'tramp-shell-quote-argument
(cons program args) " "))
+ ;; We use as environment the difference to toplevel `process-environment'.
+ (setq env
+ (dolist (elt (nreverse (copy-sequence process-environment)) env)
+ (or (member elt (default-toplevel-value 'process-environment))
+ (setq env (cons elt env)))))
+ (when env
+ (setq command
+ (format
+ "env %s %s"
+ (mapconcat 'tramp-shell-quote-argument env " ") command)))
;; Determine input.
(if (null infile)
(setq input "/dev/null")
(append
(list "TERM=dumb" "LANGUAGE=C" "HGPLAIN=1")
process-environment)))
- (if (file-remote-p file)
- (process-file
- "env" nil t nil
- "HGPLAIN=1" vc-hg-program
- "--config" "alias.status=status"
- "--config" "defaults.status="
- "status" "-A" (file-relative-name file))
- (process-file
- vc-hg-program nil t nil
- "--config" "alias.status=status"
- "--config" "defaults.status="
- "status" "-A" (file-relative-name file))))
+ (process-file
+ vc-hg-program nil t nil
+ "--config" "alias.status=status"
+ "--config" "defaults.status="
+ "status" "-A" (file-relative-name file)))
;; Some problem happened. E.g. We can't find an `hg'
;; executable.
(error nil)))))))