aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2010-10-21 10:05:23 +0200
committerMichael Albinus2010-10-21 10:05:23 +0200
commit01d884cf2ec7369bbdf41e905ac6b650d4e0eea8 (patch)
tree967d57f0c60fe9c7fbc2b79d2b99ab30589bc7b3
parent3c0663734997699653359bf36dab7a04373594df (diff)
downloademacs-01d884cf2ec7369bbdf41e905ac6b650d4e0eea8.tar.gz
emacs-01d884cf2ec7369bbdf41e905ac6b650d4e0eea8.zip
* net/tramp-sh.el (tramp-do-file-attributes-with-stat): Do not use
space in stat format string. (tramp-send-command): Unset $PS1 when using here documents, in order not to get several prompts. (tramp-get-inline-coding): Return `nil' in case of errors.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/net/tramp-sh.el98
2 files changed, 61 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5d7457dd010..d63649c6f64 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
1010-10-21 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp-sh.el (tramp-do-file-attributes-with-stat): Do not use
4 space in stat format string.
5 (tramp-send-command): Unset $PS1 when using here documents, in
6 order not to get several prompts.
7 (tramp-get-inline-coding): Return `nil' in case of errors.
8
12010-10-21 Daiki Ueno <ueno@unixuser.org> 92010-10-21 Daiki Ueno <ueno@unixuser.org>
2 10
3 * hexl.el (hexl-mode, hexl-mode-exit): Tweak 11 * hexl.el (hexl-mode, hexl-mode-exit): Tweak
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 1f13f50a240..1c25e33d756 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -67,7 +67,7 @@ files conditionalize this setup based on the TERM environment variable."
67 :group 'tramp 67 :group 'tramp
68 :type 'string) 68 :type 'string)
69 69
70;; ksh on OpenBSD 4.5 requires, that PS1 contains a `#' character for 70;; ksh on OpenBSD 4.5 requires, that $PS1 contains a `#' character for
71;; root users. It uses the `$' character for other users. In order 71;; root users. It uses the `$' character for other users. In order
72;; to guarantee a proper prompt, we use "#$" for the prompt. 72;; to guarantee a proper prompt, we use "#$" for the prompt.
73 73
@@ -1241,7 +1241,7 @@ target of the symlink differ."
1241 (format 1241 (format
1242 ;; On Opsware, pdksh (which is the true name of ksh there) doesn't 1242 ;; On Opsware, pdksh (which is the true name of ksh there) doesn't
1243 ;; parse correctly the sequence "((". Therefore, we add a space. 1243 ;; parse correctly the sequence "((". Therefore, we add a space.
1244 "( (%s %s || %s -h %s) && %s -c '( (\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)' %s || echo nil)" 1244 "( (%s %s || %s -h %s) && %s -c '((\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)' %s || echo nil)"
1245 (tramp-get-file-exists-command vec) 1245 (tramp-get-file-exists-command vec)
1246 (tramp-shell-quote-argument localname) 1246 (tramp-shell-quote-argument localname)
1247 (tramp-get-test-command vec) 1247 (tramp-get-test-command vec)
@@ -4359,6 +4359,11 @@ function waits for output unless NOOUTPUT is set."
4359 ;; We mark the command string that it can be erased in the output buffer. 4359 ;; We mark the command string that it can be erased in the output buffer.
4360 (tramp-set-connection-property p "check-remote-echo" t) 4360 (tramp-set-connection-property p "check-remote-echo" t)
4361 (setq command (format "%s%s%s" tramp-echo-mark command tramp-echo-mark))) 4361 (setq command (format "%s%s%s" tramp-echo-mark command tramp-echo-mark)))
4362 (when (string-match "<<'EOF'" command)
4363 ;; Unset $PS1 when using here documents, in order not to get
4364 ;; several prompts.
4365 (setq command (concat "(PS1= ; " command "\n)")))
4366 ;; Send the command.
4362 (tramp-message vec 6 "%s" command) 4367 (tramp-message vec 6 "%s" command)
4363 (tramp-send-string vec command) 4368 (tramp-send-string vec command)
4364 (unless nooutput (tramp-wait-for-output p)))) 4369 (unless nooutput (tramp-wait-for-output p))))
@@ -4897,54 +4902,57 @@ If no corresponding command is found, nil is returned.
4897Otherwise, either a string is returned which contains a `%s' mark 4902Otherwise, either a string is returned which contains a `%s' mark
4898to be used for the respective input or output file; or a Lisp 4903to be used for the respective input or output file; or a Lisp
4899function cell is returned to be applied on a buffer." 4904function cell is returned to be applied on a buffer."
4900 (let ((coding 4905 ;; We must catch the errors, because we want to return `nil', when
4901 (with-connection-property vec prop 4906 ;; no inline coding is found.
4902 (tramp-find-inline-encoding vec) 4907 (ignore-errors
4903 (tramp-get-connection-property vec prop nil))) 4908 (let ((coding
4904 (prop1 (if (string-match "encoding" prop) 4909 (with-connection-property vec prop
4905 "inline-compress" "inline-decompress")) 4910 (tramp-find-inline-encoding vec)
4906 compress) 4911 (tramp-get-connection-property vec prop nil)))
4907 ;; The connection property might have been cached. So we must send 4912 (prop1 (if (string-match "encoding" prop)
4908 ;; the script to the remote side - maybe. 4913 "inline-compress" "inline-decompress"))
4909 (when (and coding (symbolp coding) (string-match "remote" prop)) 4914 compress)
4910 (let ((name (symbol-name coding))) 4915 ;; The connection property might have been cached. So we must
4911 (while (string-match (regexp-quote "-") name) 4916 ;; send the script to the remote side - maybe.
4912 (setq name (replace-match "_" nil t name))) 4917 (when (and coding (symbolp coding) (string-match "remote" prop))
4913 (tramp-maybe-send-script vec (symbol-value coding) name) 4918 (let ((name (symbol-name coding)))
4914 (setq coding name))) 4919 (while (string-match (regexp-quote "-") name)
4915 (when coding 4920 (setq name (replace-match "_" nil t name)))
4916 ;; Check for the `compress' command. 4921 (tramp-maybe-send-script vec (symbol-value coding) name)
4917 (setq compress (tramp-get-inline-compress vec prop1 size)) 4922 (setq coding name)))
4918 ;; Return the value. 4923 (when coding
4919 (cond 4924 ;; Check for the `compress' command.
4920 ((and compress (symbolp coding)) 4925 (setq compress (tramp-get-inline-compress vec prop1 size))
4921 (if (string-match "decompress" prop1) 4926 ;; Return the value.
4927 (cond
4928 ((and compress (symbolp coding))
4929 (if (string-match "decompress" prop1)
4930 `(lambda (beg end)
4931 (,coding beg end)
4932 (let ((coding-system-for-write 'binary)
4933 (coding-system-for-read 'binary))
4934 (apply
4935 'call-process-region (point-min) (point-max)
4936 (car (split-string ,compress)) t t nil
4937 (cdr (split-string ,compress)))))
4922 `(lambda (beg end) 4938 `(lambda (beg end)
4923 (,coding beg end)
4924 (let ((coding-system-for-write 'binary) 4939 (let ((coding-system-for-write 'binary)
4925 (coding-system-for-read 'binary)) 4940 (coding-system-for-read 'binary))
4926 (apply 4941 (apply
4927 'call-process-region (point-min) (point-max) 4942 'call-process-region beg end
4928 (car (split-string ,compress)) t t nil 4943 (car (split-string ,compress)) t t nil
4929 (cdr (split-string ,compress))))) 4944 (cdr (split-string ,compress))))
4930 `(lambda (beg end) 4945 (,coding (point-min) (point-max)))))
4931 (let ((coding-system-for-write 'binary) 4946 ((symbolp coding)
4932 (coding-system-for-read 'binary)) 4947 coding)
4933 (apply 4948 ((and compress (string-match "decoding" prop))
4934 'call-process-region beg end 4949 (format "(%s | %s >%%s)" coding compress))
4935 (car (split-string ,compress)) t t nil 4950 (compress
4936 (cdr (split-string ,compress)))) 4951 (format "(%s <%%s | %s)" compress coding))
4937 (,coding (point-min) (point-max))))) 4952 ((string-match "decoding" prop)
4938 ((symbolp coding) 4953 (format "%s >%%s" coding))
4939 coding) 4954 (t
4940 ((and compress (string-match "decoding" prop)) 4955 (format "%s <%%s" coding)))))))
4941 (format "(%s | %s >%%s)" coding compress))
4942 (compress
4943 (format "(%s <%%s | %s)" compress coding))
4944 ((string-match "decoding" prop)
4945 (format "%s >%%s" coding))
4946 (t
4947 (format "%s <%%s" coding))))))
4948 4956
4949;;; Integration of eshell.el: 4957;;; Integration of eshell.el:
4950 4958