aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2010-09-15 22:27:11 +0200
committerMichael Albinus2010-09-15 22:27:11 +0200
commit6139f995addcb8fce63deb30c7ed0e6f2b618b02 (patch)
treed4ad6a43fa95db8feb93c15eae08017fc6601aee
parenta4ee83ccd46d5ec32f60233951b1e8d40efaec7e (diff)
downloademacs-6139f995addcb8fce63deb30c7ed0e6f2b618b02.tar.gz
emacs-6139f995addcb8fce63deb30c7ed0e6f2b618b02.zip
* net/tramp-compat.el (tramp-compat-with-temp-message)
(tramp-compat-font-lock-add-keywords, tramp-compat-process-get) (tramp-compat-process-put): New defuns. * net/tramp.el (top): * net/tramp-gvfs.el (top): * net/tramp-cache.el (top): Use `tramp-compat-font-lock-add-keywords'. * net/tramp.el (tramp-progress-reporter-update): Use `tramp-compat-funcall. * net/tramp.el (tramp-process-actions): * net/tramp-gvfs.el (tramp-handle-vc-registered): * net/tramp-sh.el (tramp-gvfs-handler-askquestion) (tramp-get-remote-stat, tramp-get-remote-readlink): Use `tramp-compat-with-temp-message'. * net/tramp-sh.el (top): Require 'cl. (tramp-handle-start-file-process): Use `tramp-compat-process-get'. (tramp-open-connection-setup-interactive-shell): Use `tramp-compat-process-put'.
-rw-r--r--lisp/ChangeLog26
-rw-r--r--lisp/net/tramp-cache.el8
-rw-r--r--lisp/net/tramp-compat.el34
-rw-r--r--lisp/net/tramp-gvfs.el8
-rw-r--r--lisp/net/tramp-sh.el13
-rw-r--r--lisp/net/tramp.el10
6 files changed, 73 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7731c6686b7..48b5581d8a9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,27 @@
12010-09-15 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp-compat.el (tramp-compat-with-temp-message)
4 (tramp-compat-font-lock-add-keywords, tramp-compat-process-get)
5 (tramp-compat-process-put): New defuns.
6
7 * net/tramp.el (top):
8 * net/tramp-gvfs.el (top):
9 * net/tramp-cache.el (top): Use `tramp-compat-font-lock-add-keywords'.
10
11 * net/tramp.el (tramp-progress-reporter-update): Use
12 `tramp-compat-funcall.
13
14 * net/tramp.el (tramp-process-actions):
15 * net/tramp-gvfs.el (tramp-handle-vc-registered):
16 * net/tramp-sh.el (tramp-gvfs-handler-askquestion)
17 (tramp-get-remote-stat, tramp-get-remote-readlink): Use
18 `tramp-compat-with-temp-message'.
19
20 * net/tramp-sh.el (top): Require 'cl.
21 (tramp-handle-start-file-process): Use `tramp-compat-process-get'.
22 (tramp-open-connection-setup-interactive-shell): Use
23 `tramp-compat-process-put'.
24
12010-09-15 Alan Mackenzie <acm@muc.de> 252010-09-15 Alan Mackenzie <acm@muc.de>
2 26
3 * progmodes/cc-engine.el (c-forward-<>-arglist-recur): Correct the 27 * progmodes/cc-engine.el (c-forward-<>-arglist-recur): Correct the
@@ -238,7 +262,7 @@
238 262
239 * net/tramp-sh.el: New file, derived from tramp.el. 263 * net/tramp-sh.el: New file, derived from tramp.el.
240 (top): Initialize `tramp-methods', `tramp-default-method-alist', 264 (top): Initialize `tramp-methods', `tramp-default-method-alist',
241 `tramp-default-user-alist', tramp-foreign-file-name-handler-alist. 265 `tramp-default-user-alist', `tramp-foreign-file-name-handler-alist'.
242 Remove "scp1_old", "scp2_old", "ssh1_old", "ssh2_old". Use 266 Remove "scp1_old", "scp2_old", "ssh1_old", "ssh2_old". Use
243 `ignore-errors' where appropriate. 267 `ignore-errors' where appropriate.
244 (tramp-sh-file-name-handler-alist): Renamed from 268 (tramp-sh-file-name-handler-alist): Renamed from
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 7a55a4978d1..5745546e3e8 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -152,8 +152,8 @@ FILE must be a local file name on a connection identified via VEC."
152;;;###tramp-autoload 152;;;###tramp-autoload
153(put 'with-file-property 'lisp-indent-function 3) 153(put 'with-file-property 'lisp-indent-function 3)
154(put 'with-file-property 'edebug-form-spec t) 154(put 'with-file-property 'edebug-form-spec t)
155;;;###tramp-autoload 155(tramp-compat-font-lock-add-keywords
156(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-file-property\\>")) 156 'emacs-lisp-mode '("\\<with-file-property\\>"))
157 157
158;;;###tramp-autoload 158;;;###tramp-autoload
159(defun tramp-flush-file-property (vec file) 159(defun tramp-flush-file-property (vec file)
@@ -255,8 +255,8 @@ PROPERTY is set persistent when KEY is a vector."
255;;;###tramp-autoload 255;;;###tramp-autoload
256(put 'with-connection-property 'lisp-indent-function 2) 256(put 'with-connection-property 'lisp-indent-function 2)
257(put 'with-connection-property 'edebug-form-spec t) 257(put 'with-connection-property 'edebug-form-spec t)
258;;;###tramp-autoload 258(tramp-compat-font-lock-add-keywords
259(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>")) 259 'emacs-lisp-mode '("\\<with-connection-property\\>"))
260 260
261;;;###tramp-autoload 261;;;###tramp-autoload
262(defun tramp-flush-connection-property (key) 262(defun tramp-flush-connection-property (key)
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index d17ad8d09ce..4da2fb33771 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -96,11 +96,6 @@
96 (defvar byte-compile-not-obsolete-vars nil)) 96 (defvar byte-compile-not-obsolete-vars nil))
97 (setq byte-compile-not-obsolete-vars '(directory-sep-char)) 97 (setq byte-compile-not-obsolete-vars '(directory-sep-char))
98 98
99 ;; `with-temp-message' does not exists in XEmacs.
100 (condition-case nil
101 (with-temp-message (current-message) nil)
102 (error (defmacro with-temp-message (message &rest body) `(progn ,@body))))
103
104 ;; For not existing functions, or functions with a changed argument 99 ;; For not existing functions, or functions with a changed argument
105 ;; list, there are compiler warnings. We want to avoid them in 100 ;; list, there are compiler warnings. We want to avoid them in
106 ;; cases we know what we do. 101 ;; cases we know what we do.
@@ -114,10 +109,6 @@
114 (unless (fboundp 'set-buffer-multibyte) 109 (unless (fboundp 'set-buffer-multibyte)
115 (defalias 'set-buffer-multibyte 'ignore)) 110 (defalias 'set-buffer-multibyte 'ignore))
116 111
117 ;; `font-lock-add-keywords' does not exist in XEmacs.
118 (unless (fboundp 'font-lock-add-keywords)
119 (defalias 'font-lock-add-keywords 'ignore))
120
121 ;; The following functions cannot be aliases of the corresponding 112 ;; The following functions cannot be aliases of the corresponding
122 ;; `tramp-handle-*' functions, because this would bypass the locking 113 ;; `tramp-handle-*' functions, because this would bypass the locking
123 ;; mechanism. 114 ;; mechanism.
@@ -190,6 +181,19 @@
190 'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards) 181 'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards)
191 (ad-activate 'file-expand-wildcards))))) 182 (ad-activate 'file-expand-wildcards)))))
192 183
184;; `with-temp-message' does not exists in XEmacs.
185(if (fboundp 'with-temp-message)
186 (defalias 'tramp-compat-with-temp-message 'with-temp-message)
187 (defun tramp-compat-with-temp-message (message &rest body)
188 "Display MESSAGE temporarily if non-nil while BODY is evaluated."
189 `(progn ,@body)))
190
191;; `font-lock-add-keywords' does not exist in XEmacs.
192(defun tramp-compat-font-lock-add-keywords (mode keywords &optional how)
193 "Add highlighting KEYWORDS for MODE."
194 (ignore-errors
195 (tramp-compat-funcall 'font-lock-add-keywords mode keywords how)))
196
193(defsubst tramp-compat-line-beginning-position () 197(defsubst tramp-compat-line-beginning-position ()
194 "Return point at beginning of line (compat function). 198 "Return point at beginning of line (compat function).
195Calls `line-beginning-position' or `point-at-bol' if defined, else 199Calls `line-beginning-position' or `point-at-bol' if defined, else
@@ -474,6 +478,18 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
474 (setenv "UNIX95" unix95) 478 (setenv "UNIX95" unix95)
475 result))))) 479 result)))))
476 480
481;; The following functions do not exist in XEmacs. We ignore this;
482;; they are used for checking a remote tty.
483(defun tramp-compat-process-get (process propname)
484 "Return the value of PROCESS' PROPNAME property.
485This is the last value stored with `(process-put PROCESS PROPNAME VALUE)'."
486 (ignore-errors (tramp-compat-funcall 'process-get process propname)))
487
488(defun tramp-compat-process-put (process propname value)
489 "Change PROCESS' PROPNAME property to VALUE.
490It can be retrieved with `(process-get PROCESS PROPNAME)'."
491 (ignore-errors (tramp-compat-funcall 'process-put process propname value)))
492
477(add-hook 'tramp-unload-hook 493(add-hook 'tramp-unload-hook
478 (lambda () 494 (lambda ()
479 (unload-feature 'tramp-compat 'force))) 495 (unload-feature 'tramp-compat 'force)))
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index adcda5ebb80..cd2bab26f47 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -498,7 +498,8 @@ will be traced by Tramp with trace level 6."
498 498
499(put 'with-tramp-dbus-call-method 'lisp-indent-function 2) 499(put 'with-tramp-dbus-call-method 'lisp-indent-function 2)
500(put 'with-tramp-dbus-call-method 'edebug-form-spec '(form symbolp body)) 500(put 'with-tramp-dbus-call-method 'edebug-form-spec '(form symbolp body))
501(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-tramp-dbus-call-method\\>")) 501(tramp-compat-font-lock-add-keywords
502 'emacs-lisp-mode '("\\<with-tramp-dbus-call-method\\>"))
502 503
503(defmacro with-tramp-gvfs-error-message (filename handler &rest args) 504(defmacro with-tramp-gvfs-error-message (filename handler &rest args)
504 "Apply a Tramp GVFS `handler'. 505 "Apply a Tramp GVFS `handler'.
@@ -519,7 +520,8 @@ In case of an error, modify the error message by replacing
519 520
520(put 'with-tramp-gvfs-error-message 'lisp-indent-function 2) 521(put 'with-tramp-gvfs-error-message 'lisp-indent-function 2)
521(put 'with-tramp-gvfs-error-message 'edebug-form-spec '(form symbolp body)) 522(put 'with-tramp-gvfs-error-message 'edebug-form-spec '(form symbolp body))
522(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-tramp-gvfs-error-message\\>")) 523(tramp-compat-font-lock-add-keywords
524 'emacs-lisp-mode '("\\<with-tramp-gvfs-error-message\\>"))
523 525
524(defvar tramp-gvfs-dbus-event-vector nil 526(defvar tramp-gvfs-dbus-event-vector nil
525 "Current Tramp file name to be used, as vector. 527 "Current Tramp file name to be used, as vector.
@@ -973,7 +975,7 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
973 ;; host signature. 975 ;; host signature.
974 (with-temp-buffer 976 (with-temp-buffer
975 ;; Preserve message for `progress-reporter'. 977 ;; Preserve message for `progress-reporter'.
976 (with-temp-message "" 978 (tramp-compat-with-temp-message ""
977 (insert message) 979 (insert message)
978 (pop-to-buffer (current-buffer)) 980 (pop-to-buffer (current-buffer))
979 (setq choice (if (yes-or-no-p (concat (car choices) " ")) 0 1)) 981 (setq choice (if (yes-or-no-p (concat (car choices) " ")) 0 1))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 6d51da3bf97..423b4fcbd5e 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -27,6 +27,7 @@
27 27
28;;; Code: 28;;; Code:
29 29
30(eval-when-compile (require 'cl)) ; ignore-errors
30(require 'tramp) 31(require 'tramp)
31(require 'shell) 32(require 'shell)
32 33
@@ -2855,7 +2856,8 @@ beginning of local filename are not substituted."
2855 (tramp-send-command v command nil t) ; nooutput 2856 (tramp-send-command v command nil t) ; nooutput
2856 ;; Check, whether a pty is associated. 2857 ;; Check, whether a pty is associated.
2857 (tramp-maybe-open-connection v) 2858 (tramp-maybe-open-connection v)
2858 (unless (process-get (tramp-get-connection-process v) 'remote-tty) 2859 (unless (tramp-compat-process-get
2860 (tramp-get-connection-process v) 'remote-tty)
2859 (tramp-error 2861 (tramp-error
2860 v 'file-error "pty association is not supported for `%s'" name))) 2862 v 'file-error "pty association is not supported for `%s'" name)))
2861 (let ((p (tramp-get-connection-process v))) 2863 (let ((p (tramp-get-connection-process v)))
@@ -3659,7 +3661,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3659;; any other remote command. 3661;; any other remote command.
3660(defun tramp-handle-vc-registered (file) 3662(defun tramp-handle-vc-registered (file)
3661 "Like `vc-registered' for Tramp files." 3663 "Like `vc-registered' for Tramp files."
3662 (with-temp-message "" 3664 (tramp-compat-with-temp-message ""
3663 (with-parsed-tramp-file-name file nil 3665 (with-parsed-tramp-file-name file nil
3664 (with-progress-reporter 3666 (with-progress-reporter
3665 v 3 (format "Checking `vc-registered' for %s" file) 3667 v 3 (format "Checking `vc-registered' for %s" file)
@@ -4139,7 +4141,8 @@ process to set up. VEC specifies the connection."
4139 ;; Set `remote-tty' process property. 4141 ;; Set `remote-tty' process property.
4140 (ignore-errors 4142 (ignore-errors
4141 (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\""))) 4143 (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"")))
4142 (unless (zerop (length tty)) (process-put proc 'remote-tty tty)))) 4144 (unless (zerop (length tty))
4145 (tramp-compat-process-put proc 'remote-tty tty))))
4143 4146
4144 ;; Set the environment. 4147 ;; Set the environment.
4145 (tramp-message vec 5 "Setting default environment") 4148 (tramp-message vec 5 "Setting default environment")
@@ -5268,7 +5271,7 @@ Return the local name of the temporary file."
5268 (when result 5271 (when result
5269 (setq tmp 5272 (setq tmp
5270 ;; We don't want to display an error message. 5273 ;; We don't want to display an error message.
5271 (with-temp-message (or (current-message) "") 5274 (tramp-compat-with-temp-message (or (current-message) "")
5272 (ignore-errors 5275 (ignore-errors
5273 (tramp-send-command-and-read 5276 (tramp-send-command-and-read
5274 vec (format "%s -c '(\"%%N\" %%s)' /" result))))) 5277 vec (format "%s -c '(\"%%N\" %%s)' /" result)))))
@@ -5285,7 +5288,7 @@ Return the local name of the temporary file."
5285 vec "readlink" (tramp-get-remote-path vec)))) 5288 vec "readlink" (tramp-get-remote-path vec))))
5286 (when (and result 5289 (when (and result
5287 ;; We don't want to display an error message. 5290 ;; We don't want to display an error message.
5288 (with-temp-message (or (current-message) "") 5291 (tramp-compat-with-temp-message (or (current-message) "")
5289 (ignore-errors 5292 (ignore-errors
5290 (tramp-send-command-and-check 5293 (tramp-send-command-and-check
5291 vec (format "%s --canonicalize-missing /" result))))) 5294 vec (format "%s --canonicalize-missing /" result)))))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index d03201a3afb..3a3b3ad35e0 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1413,13 +1413,14 @@ If VAR is nil, then we bind `v' to the structure and `method', `user',
1413 1413
1414(put 'with-parsed-tramp-file-name 'lisp-indent-function 2) 1414(put 'with-parsed-tramp-file-name 'lisp-indent-function 2)
1415(put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body)) 1415(put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body))
1416(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>")) 1416(tramp-compat-font-lock-add-keywords
1417 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>"))
1417 1418
1418(defun tramp-progress-reporter-update (reporter &optional value) 1419(defun tramp-progress-reporter-update (reporter &optional value)
1419 (let* ((parameters (cdr reporter)) 1420 (let* ((parameters (cdr reporter))
1420 (message (aref parameters 3))) 1421 (message (aref parameters 3)))
1421 (when (string-match message (or (current-message) "")) 1422 (when (string-match message (or (current-message) ""))
1422 (funcall 'progress-reporter-update reporter value)))) 1423 (tramp-compat-funcall 'progress-reporter-update reporter value))))
1423 1424
1424(defmacro with-progress-reporter (vec level message &rest body) 1425(defmacro with-progress-reporter (vec level message &rest body)
1425 "Executes BODY, spinning a progress reporter with MESSAGE. 1426 "Executes BODY, spinning a progress reporter with MESSAGE.
@@ -1450,7 +1451,8 @@ progress reporter."
1450 1451
1451(put 'with-progress-reporter 'lisp-indent-function 3) 1452(put 'with-progress-reporter 'lisp-indent-function 3)
1452(put 'with-progress-reporter 'edebug-form-spec t) 1453(put 'with-progress-reporter 'edebug-form-spec t)
1453(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-progress-reporter\\>")) 1454(tramp-compat-font-lock-add-keywords
1455 'emacs-lisp-mode '("\\<with-progress-reporter\\>"))
1454 1456
1455(eval-and-compile ;; Silence compiler. 1457(eval-and-compile ;; Silence compiler.
1456 (if (memq system-type '(cygwin windows-nt)) 1458 (if (memq system-type '(cygwin windows-nt))
@@ -2688,7 +2690,7 @@ The terminal type can be configured with `tramp-terminal-type'."
2688(defun tramp-process-actions (proc vec actions &optional timeout) 2690(defun tramp-process-actions (proc vec actions &optional timeout)
2689 "Perform actions until success or TIMEOUT." 2691 "Perform actions until success or TIMEOUT."
2690 ;; Preserve message for `progress-reporter'. 2692 ;; Preserve message for `progress-reporter'.
2691 (with-temp-message "" 2693 (tramp-compat-with-temp-message ""
2692 ;; Enable auth-source and password-cache. 2694 ;; Enable auth-source and password-cache.
2693 (tramp-set-connection-property vec "first-password-request" t) 2695 (tramp-set-connection-property vec "first-password-request" t)
2694 (let (exit) 2696 (let (exit)