aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2010-05-09 21:57:55 +0200
committerMichael Albinus2010-05-09 21:57:55 +0200
commit0d5852cfaa28f0805b23395a3fdd8eb16363474e (patch)
tree7ae2836c3939eb753803be03ff5e8ea99891efa8
parentf913fe7d54ced4847d0fb5386b64c951561e9f33 (diff)
downloademacs-0d5852cfaa28f0805b23395a3fdd8eb16363474e.tar.gz
emacs-0d5852cfaa28f0805b23395a3fdd8eb16363474e.zip
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
not bound. (tramp-compat-copy-file): Add PRESERVE-SELINUX-CONTEXT. (tramp-compat-funcall): New defmacro. (tramp-compat-line-beginning-position) (tramp-compat-line-end-position) (tramp-compat-temporary-file-directory) (tramp-compat-make-temp-file, tramp-compat-file-attributes) (tramp-compat-copy-file, tramp-compat-copy-directory) (tramp-compat-delete-file, tramp-compat-delete-directory) (tramp-compat-number-sequence, tramp-compat-process-running-p) * net/tramp.el (top, with-progress-reporter) (tramp-rfn-eshadow-setup-minibuffer) (tramp-rfn-eshadow-update-overlay, tramp-handle-set-file-times) (tramp-handle-dired-compress-file, tramp-handle-shell-command) (tramp-completion-mode-p, tramp-check-for-regexp) (tramp-open-connection-setup-interactive-shell) (tramp-compute-multi-hops, tramp-read-passwd, tramp-clear-passwd) (tramp-time-diff, tramp-coding-system-change-eol-conversion) (tramp-set-process-query-on-exit-flag, tramp-unload-tramp) * net/tramp-cmds.el (tramp-cleanup-all-connections) (tramp-reporter-dump-variable, tramp-load-report-modules) (tramp-append-tramp-buffers) * net/tramp-gvfs.el (tramp-gvfs-handle-file-selinux-context): Use it. * net/tramp-imap.el (top): Autoload `epg-make-context'.
-rw-r--r--lisp/ChangeLog29
-rw-r--r--lisp/net/tramp-cmds.el30
-rw-r--r--lisp/net/tramp-compat.el67
-rw-r--r--lisp/net/tramp-gvfs.el4
-rw-r--r--lisp/net/tramp-imap.el1
-rw-r--r--lisp/net/tramp.el158
6 files changed, 166 insertions, 123 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 03514594352..5e2f5baaeb3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,32 @@
12010-05-09 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
4 not bound.
5 (tramp-compat-copy-file): Add PRESERVE-SELINUX-CONTEXT.
6 (tramp-compat-funcall): New defmacro.
7 (tramp-compat-line-beginning-position)
8 (tramp-compat-line-end-position)
9 (tramp-compat-temporary-file-directory)
10 (tramp-compat-make-temp-file, tramp-compat-file-attributes)
11 (tramp-compat-copy-file, tramp-compat-copy-directory)
12 (tramp-compat-delete-file, tramp-compat-delete-directory)
13 (tramp-compat-number-sequence, tramp-compat-process-running-p)
14 * net/tramp.el (top, with-progress-reporter)
15 (tramp-rfn-eshadow-setup-minibuffer)
16 (tramp-rfn-eshadow-update-overlay, tramp-handle-set-file-times)
17 (tramp-handle-dired-compress-file, tramp-handle-shell-command)
18 (tramp-completion-mode-p, tramp-check-for-regexp)
19 (tramp-open-connection-setup-interactive-shell)
20 (tramp-compute-multi-hops, tramp-read-passwd, tramp-clear-passwd)
21 (tramp-time-diff, tramp-coding-system-change-eol-conversion)
22 (tramp-set-process-query-on-exit-flag, tramp-unload-tramp)
23 * net/tramp-cmds.el (tramp-cleanup-all-connections)
24 (tramp-reporter-dump-variable, tramp-load-report-modules)
25 (tramp-append-tramp-buffers)
26 * net/tramp-gvfs.el (tramp-gvfs-handle-file-selinux-context): Use it.
27
28 * net/tramp-imap.el (top): Autoload `epg-make-context'.
29
12010-05-08 Stefan Monnier <monnier@iro.umontreal.ca> 302010-05-08 Stefan Monnier <monnier@iro.umontreal.ca>
2 31
3 * progmodes/compile.el (compilation-buffer-modtime): Rename from 32 * progmodes/compile.el (compilation-buffer-modtime): Rename from
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 86f80331f07..86501561238 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -106,8 +106,7 @@ This includes password cache, file cache, connection cache, buffers."
106 (setq tramp-locked nil) 106 (setq tramp-locked nil)
107 107
108 ;; Flush password cache. 108 ;; Flush password cache.
109 (when (functionp 'password-reset) 109 (tramp-compat-funcall 'password-reset)
110 (funcall (symbol-function 'password-reset)))
111 110
112 ;; Flush file and connection cache. 111 ;; Flush file and connection cache.
113 (clrhash tramp-cache-data) 112 (clrhash tramp-cache-data)
@@ -254,7 +253,7 @@ Used for non-7bit chars in strings."
254 (base64-encode-string val)))))) 253 (base64-encode-string val))))))
255 254
256 ;; Dump variable. 255 ;; Dump variable.
257 (funcall (symbol-function 'reporter-dump-variable) varsym mailbuf) 256 (tramp-compat-funcall 'reporter-dump-variable varsym mailbuf)
258 257
259 (unless (hash-table-p val) 258 (unless (hash-table-p val)
260 ;; Remove string quotation. 259 ;; Remove string quotation.
@@ -283,10 +282,8 @@ Used for non-7bit chars in strings."
283 (load "mml" 'noerror)) 282 (load "mml" 'noerror))
284 (require 'message nil 'noerror) 283 (require 'message nil 'noerror)
285 (require 'mml nil 'noerror)) 284 (require 'mml nil 'noerror))
286 (when (functionp 'message-mode) 285 (tramp-compat-funcall 'message-mode)
287 (funcall (symbol-function 'message-mode))) 286 (tramp-compat-funcall 'mml-mode t))
288 (when (functionp 'mml-mode)
289 (funcall (symbol-function 'mml-mode) t)))
290 287
291(defun tramp-append-tramp-buffers () 288(defun tramp-append-tramp-buffers ()
292 "Append Tramp buffers and buffer local variables into the bug report." 289 "Append Tramp buffers and buffer local variables into the bug report."
@@ -308,15 +305,14 @@ Used for non-7bit chars in strings."
308 (erase-buffer) 305 (erase-buffer)
309 (insert "\n(setq\n") 306 (insert "\n(setq\n")
310 (lisp-indent-line) 307 (lisp-indent-line)
311 (funcall (symbol-function 'reporter-dump-variable) 308 (tramp-compat-funcall
312 'buffer-name (current-buffer)) 309 'reporter-dump-variable 'buffer-name (current-buffer))
313 (dolist (varsym-or-cons-cell (buffer-local-variables buffer)) 310 (dolist (varsym-or-cons-cell (buffer-local-variables buffer))
314 (let ((varsym (or (car-safe varsym-or-cons-cell) 311 (let ((varsym (or (car-safe varsym-or-cons-cell)
315 varsym-or-cons-cell))) 312 varsym-or-cons-cell)))
316 (when (string-match "tramp" (symbol-name varsym)) 313 (when (string-match "tramp" (symbol-name varsym))
317 (funcall 314 (tramp-compat-funcall
318 (symbol-function 'reporter-dump-variable) 315 'reporter-dump-variable varsym (current-buffer)))))
319 varsym (current-buffer)))))
320 (lisp-indent-line) 316 (lisp-indent-line)
321 (insert ")\n")) 317 (insert ")\n"))
322 (insert-buffer-substring elbuf))) 318 (insert-buffer-substring elbuf)))
@@ -328,7 +324,7 @@ Used for non-7bit chars in strings."
328 (symbol-value 'mml-mode)) 324 (symbol-value 'mml-mode))
329 325
330 (let ((tramp-buf-regexp "\\*\\(debug \\)?tramp/") 326 (let ((tramp-buf-regexp "\\*\\(debug \\)?tramp/")
331 (buffer-list (funcall (symbol-function 'tramp-list-tramp-buffers))) 327 (buffer-list (tramp-compat-funcall 'tramp-list-tramp-buffers))
332 (curbuf (current-buffer))) 328 (curbuf (current-buffer)))
333 329
334 ;; There is at least one Tramp buffer. 330 ;; There is at least one Tramp buffer.
@@ -376,10 +372,10 @@ This is a special notion of the `gnus/message' package. If you
376use another mail agent (by copying the contents of this buffer) 372use another mail agent (by copying the contents of this buffer)
377please ensure that the buffers are attached to your email.\n\n") 373please ensure that the buffers are attached to your email.\n\n")
378 (dolist (buffer buffer-list) 374 (dolist (buffer buffer-list)
379 (funcall (symbol-function 'mml-insert-empty-tag) 375 (tramp-compat-funcall
380 'part 'type "text/plain" 'encoding "base64" 376 'mml-insert-empty-tag 'part 'type "text/plain"
381 'disposition "attachment" 'buffer buffer 377 'encoding "base64" 'disposition "attachment" 'buffer buffer
382 'description buffer)) 378 'description buffer))
383 (set-buffer-modified-p nil)) 379 (set-buffer-modified-p nil))
384 380
385 ;; Don't send. Delete the message buffer. 381 ;; Don't send. Delete the message buffer.
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 27a308d8572..a9c4a478c06 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -89,14 +89,25 @@
89 (unless (boundp 'byte-compile-not-obsolete-var) 89 (unless (boundp 'byte-compile-not-obsolete-var)
90 (defvar byte-compile-not-obsolete-var nil)) 90 (defvar byte-compile-not-obsolete-var nil))
91 (setq byte-compile-not-obsolete-var 'directory-sep-char) 91 (setq byte-compile-not-obsolete-var 'directory-sep-char)
92 (if (boundp 'byte-compile-not-obsolete-vars) ; Emacs 23.2 92 ;; Emacs 23.2.
93 (setq byte-compile-not-obsolete-vars '(directory-sep-char))) 93 (unless (boundp 'byte-compile-not-obsolete-vars)
94 (defvar byte-compile-not-obsolete-vars nil))
95 (setq byte-compile-not-obsolete-vars '(directory-sep-char))
94 96
95 ;; `with-temp-message' does not exists in XEmacs. 97 ;; `with-temp-message' does not exists in XEmacs.
96 (condition-case nil 98 (condition-case nil
97 (with-temp-message (current-message) nil) 99 (with-temp-message (current-message) nil)
98 (error (defmacro with-temp-message (message &rest body) `(progn ,@body)))) 100 (error (defmacro with-temp-message (message &rest body) `(progn ,@body))))
99 101
102 ;; For not existing functions, or functions with a changed argument
103 ;; list, there are compiler warnings. We want to avoid them in
104 ;; cases we know what we do.
105 (defmacro tramp-compat-funcall (function &rest arguments)
106 (if (featurep 'xemacs)
107 `(funcall (symbol-function ,function) ,@arguments)
108 `(when (or (subrp ,function) (functionp ,function))
109 (with-no-warnings (funcall ,function ,@arguments)))))
110
100 ;; `set-buffer-multibyte' comes from Emacs Leim. 111 ;; `set-buffer-multibyte' comes from Emacs Leim.
101 (unless (fboundp 'set-buffer-multibyte) 112 (unless (fboundp 'set-buffer-multibyte)
102 (defalias 'set-buffer-multibyte 'ignore)) 113 (defalias 'set-buffer-multibyte 'ignore))
@@ -182,8 +193,8 @@ Calls `line-beginning-position' or `point-at-bol' if defined, else
182own implementation." 193own implementation."
183 (cond 194 (cond
184 ((fboundp 'line-beginning-position) 195 ((fboundp 'line-beginning-position)
185 (funcall (symbol-function 'line-beginning-position))) 196 (tramp-compat-funcall 'line-beginning-position))
186 ((fboundp 'point-at-bol) (funcall (symbol-function 'point-at-bol))) 197 ((fboundp 'point-at-bol) (tramp-compat-funcall 'point-at-bol))
187 (t (save-excursion (beginning-of-line) (point))))) 198 (t (save-excursion (beginning-of-line) (point)))))
188 199
189(defsubst tramp-compat-line-end-position () 200(defsubst tramp-compat-line-end-position ()
@@ -191,8 +202,8 @@ own implementation."
191Calls `line-end-position' or `point-at-eol' if defined, else 202Calls `line-end-position' or `point-at-eol' if defined, else
192own implementation." 203own implementation."
193 (cond 204 (cond
194 ((fboundp 'line-end-position) (funcall (symbol-function 'line-end-position))) 205 ((fboundp 'line-end-position) (tramp-compat-funcall 'line-end-position))
195 ((fboundp 'point-at-eol) (funcall (symbol-function 'point-at-eol))) 206 ((fboundp 'point-at-eol) (tramp-compat-funcall 'point-at-eol))
196 (t (save-excursion (end-of-line) (point))))) 207 (t (save-excursion (end-of-line) (point)))))
197 208
198(defsubst tramp-compat-temporary-file-directory () 209(defsubst tramp-compat-temporary-file-directory ()
@@ -201,7 +212,7 @@ For Emacs, this is the variable `temporary-file-directory', for XEmacs
201this is the function `temp-directory'." 212this is the function `temp-directory'."
202 (cond 213 (cond
203 ((boundp 'temporary-file-directory) (symbol-value 'temporary-file-directory)) 214 ((boundp 'temporary-file-directory) (symbol-value 'temporary-file-directory))
204 ((fboundp 'temp-directory) (funcall (symbol-function 'temp-directory))) 215 ((fboundp 'temp-directory) (tramp-compat-funcall 'temp-directory))
205 ((let ((d (getenv "TEMP"))) (and d (file-directory-p d))) 216 ((let ((d (getenv "TEMP"))) (and d (file-directory-p d)))
206 (file-name-as-directory (getenv "TEMP"))) 217 (file-name-as-directory (getenv "TEMP")))
207 ((let ((d (getenv "TMP"))) (and d (file-directory-p d))) 218 ((let ((d (getenv "TMP"))) (and d (file-directory-p d)))
@@ -227,8 +238,7 @@ Add the extension of FILENAME, if existing."
227 result) 238 result)
228 (if (fboundp 'make-temp-file) 239 (if (fboundp 'make-temp-file)
229 (setq result 240 (setq result
230 (funcall 241 (tramp-compat-funcall 'make-temp-file prefix dir-flag extension))
231 (symbol-function 'make-temp-file) prefix dir-flag extension))
232 ;; We use our own implementation, taken from files.el. 242 ;; We use our own implementation, taken from files.el.
233 (while 243 (while
234 (condition-case () 244 (condition-case ()
@@ -261,19 +271,27 @@ Add the extension of FILENAME, if existing."
261 ((tramp-tramp-file-p filename) 271 ((tramp-tramp-file-p filename)
262 (tramp-file-name-handler 'file-attributes filename id-format)) 272 (tramp-file-name-handler 'file-attributes filename id-format))
263 (t (condition-case nil 273 (t (condition-case nil
264 (funcall (symbol-function 'file-attributes) filename id-format) 274 (tramp-compat-funcall 'file-attributes filename id-format)
265 (wrong-number-of-arguments (file-attributes filename)))))) 275 (wrong-number-of-arguments (file-attributes filename))))))
266 276
267;; PRESERVE-UID-GID has been introduced with Emacs 23. It does not 277;; PRESERVE-UID-GID has been introduced with Emacs 23. It does not
268;; hurt to ignore it for other (X)Emacs versions. 278;; hurt to ignore it for other (X)Emacs versions.
279;; PRESERVE-SELINUX-CONTEXT has been introduced with Emacs 24.
269(defun tramp-compat-copy-file 280(defun tramp-compat-copy-file
270 (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid) 281 (filename newname &optional ok-if-already-exists keep-date
282 preserve-uid-gid preserve-selinux-context)
271 "Like `copy-file' for Tramp files (compat function)." 283 "Like `copy-file' for Tramp files (compat function)."
272 (if preserve-uid-gid 284 (cond
273 (funcall 285 (preserve-selinux-context
274 (symbol-function 'copy-file) 286 (tramp-compat-funcall
275 filename newname ok-if-already-exists keep-date preserve-uid-gid) 287 'copy-file filename newname ok-if-already-exists keep-date
276 (copy-file filename newname ok-if-already-exists keep-date))) 288 preserve-uid-gid preserve-selinux-context))
289 (preserve-uid-gid
290 (tramp-compat-funcall
291 'copy-file filename newname ok-if-already-exists keep-date
292 preserve-uid-gid))
293 (t
294 (copy-file filename newname ok-if-already-exists keep-date))))
277 295
278;; `copy-directory' is a new function in Emacs 23.2. Implementation 296;; `copy-directory' is a new function in Emacs 23.2. Implementation
279;; is taken from there. 297;; is taken from there.
@@ -281,8 +299,7 @@ Add the extension of FILENAME, if existing."
281 (directory newname &optional keep-time parents) 299 (directory newname &optional keep-time parents)
282 "Make a copy of DIRECTORY (compat function)." 300 "Make a copy of DIRECTORY (compat function)."
283 (if (fboundp 'copy-directory) 301 (if (fboundp 'copy-directory)
284 (funcall 302 (tramp-compat-funcall 'copy-directory directory newname keep-time parents)
285 (symbol-function 'copy-directory) directory newname keep-time parents)
286 303
287 ;; If `default-directory' is a remote directory, make sure we find 304 ;; If `default-directory' is a remote directory, make sure we find
288 ;; its `copy-directory' handler. 305 ;; its `copy-directory' handler.
@@ -323,7 +340,7 @@ Add the extension of FILENAME, if existing."
323 (if (null force) 340 (if (null force)
324 (delete-file filename) 341 (delete-file filename)
325 (condition-case nil 342 (condition-case nil
326 (funcall (symbol-function 'delete-file) filename force) 343 (tramp-compat-funcall 'delete-file filename force)
327 ;; This Emacs version does not support the FORCE flag. Setting 344 ;; This Emacs version does not support the FORCE flag. Setting
328 ;; `delete-by-moving-to-trash' shall give us the same effect. 345 ;; `delete-by-moving-to-trash' shall give us the same effect.
329 (wrong-number-of-arguments 346 (wrong-number-of-arguments
@@ -341,7 +358,7 @@ Add the extension of FILENAME, if existing."
341 (if (null recursive) 358 (if (null recursive)
342 (delete-directory directory) 359 (delete-directory directory)
343 (condition-case nil 360 (condition-case nil
344 (funcall (symbol-function 'delete-directory) directory recursive) 361 (tramp-compat-funcall 'delete-directory directory recursive)
345 ;; This Emacs version does not support the RECURSIVE flag. We 362 ;; This Emacs version does not support the RECURSIVE flag. We
346 ;; use the implementation from Emacs 23.2. 363 ;; use the implementation from Emacs 23.2.
347 (wrong-number-of-arguments 364 (wrong-number-of-arguments
@@ -360,7 +377,7 @@ Add the extension of FILENAME, if existing."
360(defun tramp-compat-number-sequence (from &optional to inc) 377(defun tramp-compat-number-sequence (from &optional to inc)
361 "Return a sequence of numbers from FROM to TO as a list (compat function)." 378 "Return a sequence of numbers from FROM to TO as a list (compat function)."
362 (if (or (subrp 'number-sequence) (symbol-file 'number-sequence)) 379 (if (or (subrp 'number-sequence) (symbol-file 'number-sequence))
363 (funcall (symbol-function 'number-sequence) from to inc) 380 (tramp-compat-funcall 'number-sequence from to inc)
364 (if (or (not to) (= from to)) 381 (if (or (not to) (= from to))
365 (list from) 382 (list from)
366 (or inc (setq inc 1)) 383 (or inc (setq inc 1))
@@ -390,15 +407,13 @@ element is not omitted."
390 (cond 407 (cond
391 ;; GNU Emacs 22 on w32. 408 ;; GNU Emacs 22 on w32.
392 ((fboundp 'w32-window-exists-p) 409 ((fboundp 'w32-window-exists-p)
393 (funcall (symbol-function 'w32-window-exists-p) 410 (tramp-compat-funcall 'w32-window-exists-p process-name process-name))
394 process-name process-name))
395 411
396 ;; GNU Emacs 23. 412 ;; GNU Emacs 23.
397 ((and (fboundp 'list-system-processes) (fboundp 'process-attributes)) 413 ((and (fboundp 'list-system-processes) (fboundp 'process-attributes))
398 (let (result) 414 (let (result)
399 (dolist (pid (funcall (symbol-function 'list-system-processes)) result) 415 (dolist (pid (tramp-compat-funcall 'list-system-processes) result)
400 (let ((attributes 416 (let ((attributes (tramp-compat-funcall 'process-attributes pid)))
401 (funcall (symbol-function 'process-attributes) pid)))
402 (when (and (string-equal 417 (when (and (string-equal
403 (cdr (assoc 'user attributes)) (user-login-name)) 418 (cdr (assoc 'user attributes)) (user-login-name))
404 (let ((comm (cdr (assoc 'comm attributes)))) 419 (let ((comm (cdr (assoc 'comm attributes))))
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index f045589a27c..0851f3fe86c 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -629,8 +629,8 @@ is no information where to trace the message.")
629 629
630(defun tramp-gvfs-handle-file-selinux-context (filename) 630(defun tramp-gvfs-handle-file-selinux-context (filename)
631 "Like `file-selinux-context' for Tramp files." 631 "Like `file-selinux-context' for Tramp files."
632 (funcall (symbol-function 'file-selinux-context) 632 (tramp-compat-funcall
633 (tramp-gvfs-fuse-file-name filename))) 633 'file-selinux-context (tramp-gvfs-fuse-file-name filename)))
634 634
635(defun tramp-gvfs-handle-file-writable-p (filename) 635(defun tramp-gvfs-handle-file-writable-p (filename)
636 "Like `file-writable-p' for Tramp files." 636 "Like `file-writable-p' for Tramp files."
diff --git a/lisp/net/tramp-imap.el b/lisp/net/tramp-imap.el
index e9048bcb7a1..68e181ae7d5 100644
--- a/lisp/net/tramp-imap.el
+++ b/lisp/net/tramp-imap.el
@@ -63,6 +63,7 @@
63(autoload 'epg-context-set-progress-callback "epg") 63(autoload 'epg-context-set-progress-callback "epg")
64(autoload 'epg-decrypt-string "epg") 64(autoload 'epg-decrypt-string "epg")
65(autoload 'epg-encrypt-string "epg") 65(autoload 'epg-encrypt-string "epg")
66(autoload 'epg-make-context "epg")
66(autoload 'imap-hash-get "imap-hash") 67(autoload 'imap-hash-get "imap-hash")
67(autoload 'imap-hash-make "imap-hash") 68(autoload 'imap-hash-make "imap-hash")
68(autoload 'imap-hash-map "imap-hash") 69(autoload 'imap-hash-map "imap-hash")
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 7f0c2f2d783..3a291cfb695 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -145,8 +145,7 @@
145 ;; this would load dbus.el. 145 ;; this would load dbus.el.
146 (when (and (featurep 'dbusbind) 146 (when (and (featurep 'dbusbind)
147 (condition-case nil 147 (condition-case nil
148 (funcall (symbol-function 'dbus-get-unique-name) 148 (tramp-compat-funcall 'dbus-get-unique-name :session)
149 :session)
150 (error nil)) 149 (error nil))
151 (tramp-compat-process-running-p "gvfs-fuse-daemon")) 150 (tramp-compat-process-running-p "gvfs-fuse-daemon"))
152 'tramp-gvfs) 151 'tramp-gvfs)
@@ -2274,14 +2273,14 @@ FILE must be a local file name on a connection identified via VEC."
2274 ;; introduced in Emacs 24.1. 2273 ;; introduced in Emacs 24.1.
2275 (when (<= ,level tramp-verbose) 2274 (when (<= ,level tramp-verbose)
2276 (condition-case nil 2275 (condition-case nil
2277 (setq pr (funcall (symbol-function 'make-progress-reporter) ,message) 2276 (setq pr (tramp-compat-funcall 'make-progress-reporter ,message)
2278 tm (run-at-time 3 0.1 'progress-reporter-update pr)) 2277 tm (if pr (run-at-time 3 0.1 'progress-reporter-update pr)))
2279 (error nil))) 2278 (error nil)))
2280 (unwind-protect 2279 (unwind-protect
2281 ;; Execute the body. 2280 ;; Execute the body.
2282 (progn ,@body) 2281 (progn ,@body)
2283 ;; Stop progress reporter. 2282 ;; Stop progress reporter.
2284 (if tm (cancel-timer tm)) 2283 (if tm (tramp-compat-funcall 'cancel-timer tm))
2285 (tramp-message ,vec ,level "%s...done" ,message)))) 2284 (tramp-message ,vec ,level "%s...done" ,message))))
2286 2285
2287(put 'with-progress-reporter 'lisp-indent-function 3) 2286(put 'with-progress-reporter 'lisp-indent-function 3)
@@ -2398,15 +2397,16 @@ Adds another overlay hiding filename parts according to Tramp's
2398special handling of `substitute-in-file-name'." 2397special handling of `substitute-in-file-name'."
2399 (when (symbol-value 'minibuffer-completing-file-name) 2398 (when (symbol-value 'minibuffer-completing-file-name)
2400 (setq tramp-rfn-eshadow-overlay 2399 (setq tramp-rfn-eshadow-overlay
2401 (funcall (symbol-function 'make-overlay) 2400 (tramp-compat-funcall
2402 (funcall (symbol-function 'minibuffer-prompt-end)) 2401 'make-overlay
2403 (funcall (symbol-function 'minibuffer-prompt-end)))) 2402 (tramp-compat-funcall 'minibuffer-prompt-end)
2403 (tramp-compat-funcall 'minibuffer-prompt-end)))
2404 ;; Copy rfn-eshadow-overlay properties. 2404 ;; Copy rfn-eshadow-overlay properties.
2405 (let ((props (funcall (symbol-function 'overlay-properties) 2405 (let ((props (tramp-compat-funcall
2406 (symbol-value 'rfn-eshadow-overlay)))) 2406 'overlay-properties (symbol-value 'rfn-eshadow-overlay))))
2407 (while props 2407 (while props
2408 (funcall (symbol-function 'overlay-put) 2408 (tramp-compat-funcall
2409 tramp-rfn-eshadow-overlay (pop props) (pop props)))))) 2409 'overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props))))))
2410 2410
2411(when (boundp 'rfn-eshadow-setup-minibuffer-hook) 2411(when (boundp 'rfn-eshadow-setup-minibuffer-hook)
2412 (add-hook 'rfn-eshadow-setup-minibuffer-hook 2412 (add-hook 'rfn-eshadow-setup-minibuffer-hook
@@ -2425,10 +2425,12 @@ This is intended to be used as a minibuffer `post-command-hook' for
2425`file-name-shadow-mode'; the minibuffer should have already 2425`file-name-shadow-mode'; the minibuffer should have already
2426been set up by `rfn-eshadow-setup-minibuffer'." 2426been set up by `rfn-eshadow-setup-minibuffer'."
2427 ;; In remote files name, there is a shadowing just for the local part. 2427 ;; In remote files name, there is a shadowing just for the local part.
2428 (let ((end (or (funcall (symbol-function 'overlay-end) 2428 (let ((end (or (tramp-compat-funcall
2429 (symbol-value 'rfn-eshadow-overlay)) 2429 'overlay-end (symbol-value 'rfn-eshadow-overlay))
2430 (funcall (symbol-function 'minibuffer-prompt-end))))) 2430 (tramp-compat-funcall 'minibuffer-prompt-end))))
2431 (when (file-remote-p (buffer-substring-no-properties end (point-max))) 2431 (when
2432 (file-remote-p
2433 (tramp-compat-funcall 'buffer-substring-no-properties end (point-max)))
2432 (save-excursion 2434 (save-excursion
2433 (save-restriction 2435 (save-restriction
2434 (narrow-to-region 2436 (narrow-to-region
@@ -2438,8 +2440,9 @@ been set up by `rfn-eshadow-setup-minibuffer'."
2438 (point-max)) 2440 (point-max))
2439 (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) 2441 (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
2440 (rfn-eshadow-update-overlay-hook nil)) 2442 (rfn-eshadow-update-overlay-hook nil))
2441 (move-overlay rfn-eshadow-overlay (point-max) (point-max)) 2443 (tramp-compat-funcall
2442 (funcall (symbol-function 'rfn-eshadow-update-overlay)))))))) 2444 'move-overlay rfn-eshadow-overlay (point-max) (point-max))
2445 (tramp-compat-funcall 'rfn-eshadow-update-overlay)))))))
2443 2446
2444(when (boundp 'rfn-eshadow-update-overlay-hook) 2447(when (boundp 'rfn-eshadow-update-overlay-hook)
2445 (add-hook 'rfn-eshadow-update-overlay-hook 2448 (add-hook 'rfn-eshadow-update-overlay-hook
@@ -2989,9 +2992,8 @@ of."
2989 ;; local host. 2992 ;; local host.
2990 (and (functionp 'subr-arity) 2993 (and (functionp 'subr-arity)
2991 (subrp (symbol-function 'format-time-string)) 2994 (subrp (symbol-function 'format-time-string))
2992 (= 3 (cdr (funcall (symbol-function 'subr-arity) 2995 (= 3 (cdr (tramp-compat-funcall
2993 (symbol-function 2996 'subr-arity 'format-time-string))))))
2994 'format-time-string)))))))
2995 (tramp-send-command-and-check 2997 (tramp-send-command-and-check
2996 v (format "%s touch -t %s %s" 2998 v (format "%s touch -t %s %s"
2997 (if utc "TZ=UTC; export TZ;" "") 2999 (if utc "TZ=UTC; export TZ;" "")
@@ -4157,8 +4159,8 @@ This is like `dired-recursive-delete-directory' for Tramp files."
4157 (tramp-send-command-and-check 4159 (tramp-send-command-and-check
4158 v (concat (nth 2 suffix) " " 4160 v (concat (nth 2 suffix) " "
4159 (tramp-shell-quote-argument localname)))) 4161 (tramp-shell-quote-argument localname))))
4160 ;; `dired-remove-file' is not defined in XEmacs 4162 ;; `dired-remove-file' is not defined in XEmacs.
4161 (funcall (symbol-function 'dired-remove-file) file) 4163 (tramp-compat-funcall 'dired-remove-file file)
4162 (string-match (car suffix) file) 4164 (string-match (car suffix) file)
4163 (concat (substring file 0 (match-beginning 0)))))) 4165 (concat (substring file 0 (match-beginning 0))))))
4164 (t 4166 (t
@@ -4169,8 +4171,8 @@ This is like `dired-recursive-delete-directory' for Tramp files."
4169 (tramp-send-command-and-check 4171 (tramp-send-command-and-check
4170 v (concat "gzip -f " 4172 v (concat "gzip -f "
4171 (tramp-shell-quote-argument localname)))) 4173 (tramp-shell-quote-argument localname))))
4172 ;; `dired-remove-file' is not defined in XEmacs 4174 ;; `dired-remove-file' is not defined in XEmacs.
4173 (funcall (symbol-function 'dired-remove-file) file) 4175 (tramp-compat-funcall 'dired-remove-file file)
4174 (cond ((file-exists-p (concat file ".gz")) 4176 (cond ((file-exists-p (concat file ".gz"))
4175 (concat file ".gz")) 4177 (concat file ".gz"))
4176 ((file-exists-p (concat file ".z")) 4178 ((file-exists-p (concat file ".z"))
@@ -4714,8 +4716,7 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
4714 ;; There's some output, display it. 4716 ;; There's some output, display it.
4715 (when (with-current-buffer output-buffer (> (point-max) (point-min))) 4717 (when (with-current-buffer output-buffer (> (point-max) (point-min)))
4716 (if (functionp 'display-message-or-buffer) 4718 (if (functionp 'display-message-or-buffer)
4717 (funcall (symbol-function 'display-message-or-buffer) 4719 (tramp-compat-funcall 'display-message-or-buffer output-buffer)
4718 output-buffer)
4719 (pop-to-buffer output-buffer)))))))) 4720 (pop-to-buffer output-buffer))))))))
4720 4721
4721;; File Editing. 4722;; File Editing.
@@ -5638,7 +5639,8 @@ Falls back to normal file name handler if no Tramp file name handler exists."
5638 (featurep 'tramp) ;; If it's loaded, we may as well use it. 5639 (featurep 'tramp) ;; If it's loaded, we may as well use it.
5639 ;; `partial-completion-mode' does not exist in XEmacs. 5640 ;; `partial-completion-mode' does not exist in XEmacs.
5640 ;; It is obsoleted with Emacs 24.1. 5641 ;; It is obsoleted with Emacs 24.1.
5641 (and (boundp 'partial-completion-mode) partial-completion-mode) 5642 (and (boundp 'partial-completion-mode)
5643 (symbol-value 'partial-completion-mode))
5642 ;; FIXME: These may have been loaded even if the user never 5644 ;; FIXME: These may have been loaded even if the user never
5643 ;; intended to use them. 5645 ;; intended to use them.
5644 (featurep 'ido) 5646 (featurep 'ido)
@@ -5730,19 +5732,18 @@ should never be set globally, the intention is to let-bind it.")
5730 ;; `last-input-event' might be nil. 5732 ;; `last-input-event' might be nil.
5731 (not (null last-input-event)) 5733 (not (null last-input-event))
5732 ;; `last-input-event' may have no character approximation. 5734 ;; `last-input-event' may have no character approximation.
5733 (funcall (symbol-function 'event-to-character) last-input-event) 5735 (tramp-compat-funcall 'event-to-character last-input-event)
5734 (or 5736 (or
5735 ;; ?\t has event-modifier 'control. 5737 ;; ?\t has event-modifier 'control.
5736 (equal 5738 (equal
5737 (funcall (symbol-function 'event-to-character) 5739 (tramp-compat-funcall 'event-to-character last-input-event) ?\t)
5738 last-input-event) ?\t)
5739 (and (not (event-modifiers last-input-event)) 5740 (and (not (event-modifiers last-input-event))
5740 (or (equal 5741 (or (equal
5741 (funcall (symbol-function 'event-to-character) 5742 (tramp-compat-funcall 'event-to-character last-input-event)
5742 last-input-event) ?\?) 5743 ?\?)
5743 (equal 5744 (equal
5744 (funcall (symbol-function 'event-to-character) 5745 (tramp-compat-funcall 'event-to-character last-input-event)
5745 last-input-event) ?\ ))))))) 5746 ?\ )))))))
5746 5747
5747(defun tramp-connectable-p (filename) 5748(defun tramp-connectable-p (filename)
5748 "Check, whether it is possible to connect the remote host w/o side-effects. 5749 "Check, whether it is possible to connect the remote host w/o side-effects.
@@ -6777,10 +6778,11 @@ Erase echoed commands if exists."
6777 (when (or (not (tramp-get-connection-property proc "check-remote-echo" nil)) 6778 (when (or (not (tramp-get-connection-property proc "check-remote-echo" nil))
6778 ;; Sometimes, the echo string is suppressed on the remote side. 6779 ;; Sometimes, the echo string is suppressed on the remote side.
6779 (not (string-equal 6780 (not (string-equal
6780 (substring-no-properties 6781 (tramp-compat-funcall
6781 tramp-echo-mark-marker 6782 'substring-no-properties tramp-echo-mark-marker
6782 0 (min tramp-echo-mark-marker-length (1- (point-max)))) 6783 0 (min tramp-echo-mark-marker-length (1- (point-max))))
6783 (buffer-substring-no-properties 6784 (tramp-compat-funcall
6785 'buffer-substring-no-properties
6784 1 (min (1+ tramp-echo-mark-marker-length) (point-max)))))) 6786 1 (min (1+ tramp-echo-mark-marker-length) (point-max))))))
6785 ;; No echo to be handled, now we can look for the regexp. 6787 ;; No echo to be handled, now we can look for the regexp.
6786 (goto-char (point-min)) 6788 (goto-char (point-min))
@@ -6907,7 +6909,7 @@ process to set up. VEC specifies the connection."
6907 (if (featurep 'mule) 6909 (if (featurep 'mule)
6908 ;; Use MULE to select the right EOL convention for communicating 6910 ;; Use MULE to select the right EOL convention for communicating
6909 ;; with the process. 6911 ;; with the process.
6910 (let* ((cs (or (funcall (symbol-function 'process-coding-system) proc) 6912 (let* ((cs (or (tramp-compat-funcall 'process-coding-system proc)
6911 (cons 'undecided 'undecided))) 6913 (cons 'undecided 'undecided)))
6912 cs-decode cs-encode) 6914 cs-decode cs-encode)
6913 (when (symbolp cs) (setq cs (cons cs cs))) 6915 (when (symbolp cs) (setq cs (cons cs cs)))
@@ -6920,8 +6922,8 @@ process to set up. VEC specifies the connection."
6920 (when (search-forward "\r" nil t) 6922 (when (search-forward "\r" nil t)
6921 (setq cs-decode (tramp-coding-system-change-eol-conversion 6923 (setq cs-decode (tramp-coding-system-change-eol-conversion
6922 cs-decode 'dos))) 6924 cs-decode 'dos)))
6923 (funcall (symbol-function 'set-buffer-process-coding-system) 6925 (tramp-compat-funcall
6924 cs-decode cs-encode) 6926 'set-buffer-process-coding-system cs-decode cs-encode)
6925 (tramp-message 6927 (tramp-message
6926 vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode)) 6928 vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode))
6927 ;; Look for ^M and do something useful if found. 6929 ;; Look for ^M and do something useful if found.
@@ -6950,7 +6952,7 @@ process to set up. VEC specifies the connection."
6950 ;; Keep the debug buffer. 6952 ;; Keep the debug buffer.
6951 (rename-buffer 6953 (rename-buffer
6952 (generate-new-buffer-name tramp-temp-buffer-name) 'unique) 6954 (generate-new-buffer-name tramp-temp-buffer-name) 'unique)
6953 (funcall (symbol-function 'tramp-cleanup-connection) vec) 6955 (tramp-compat-funcall 'tramp-cleanup-connection vec)
6954 (if (= (point-min) (point-max)) 6956 (if (= (point-min) (point-max))
6955 (kill-buffer nil) 6957 (kill-buffer nil)
6956 (rename-buffer (tramp-debug-buffer-name vec) 'unique)) 6958 (rename-buffer (tramp-debug-buffer-name vec) 'unique))
@@ -7333,7 +7335,7 @@ Gateway hops are already opened."
7333 'target-alist 7335 'target-alist
7334 (vector 7336 (vector
7335 (tramp-file-name-method hop) (tramp-file-name-user hop) 7337 (tramp-file-name-method hop) (tramp-file-name-user hop)
7336 (funcall (symbol-function 'tramp-gw-open-connection) vec gw hop) nil)) 7338 (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil))
7337 ;; For the password prompt, we need the correct values. 7339 ;; For the password prompt, we need the correct values.
7338 ;; Therefore, we must remember the gateway vector. But we 7340 ;; Therefore, we must remember the gateway vector. But we
7339 ;; cannot do it as connection property, because it shouldn't 7341 ;; cannot do it as connection property, because it shouldn't
@@ -8612,16 +8614,17 @@ Invokes `password-read' if available, `read-passwd' else."
8612 (and (boundp 'auth-sources) 8614 (and (boundp 'auth-sources)
8613 (tramp-get-connection-property v "first-password-request" nil) 8615 (tramp-get-connection-property v "first-password-request" nil)
8614 ;; Try with Tramp's current method. 8616 ;; Try with Tramp's current method.
8615 (funcall (symbol-function 'auth-source-user-or-password) 8617 (tramp-compat-funcall
8616 "password" tramp-current-host tramp-current-method)) 8618 'auth-source-user-or-password
8619 "password" tramp-current-host tramp-current-method))
8617 ;; Try the password cache. 8620 ;; Try the password cache.
8618 (when (functionp 'password-read) 8621 (when (functionp 'password-read)
8619 (unless (tramp-get-connection-property 8622 (unless (tramp-get-connection-property
8620 v "first-password-request" nil) 8623 v "first-password-request" nil)
8621 (funcall (symbol-function 'password-cache-remove) key)) 8624 (tramp-compat-funcall 'password-cache-remove key))
8622 (let ((password 8625 (let ((password
8623 (funcall (symbol-function 'password-read) pw-prompt key))) 8626 (tramp-compat-funcall 'password-read pw-prompt key)))
8624 (funcall (symbol-function 'password-cache-add) key password) 8627 (tramp-compat-funcall 'password-cache-add key password)
8625 password)) 8628 password))
8626 ;; Else, get the password interactively. 8629 ;; Else, get the password interactively.
8627 (read-passwd pw-prompt)) 8630 (read-passwd pw-prompt))
@@ -8629,14 +8632,13 @@ Invokes `password-read' if available, `read-passwd' else."
8629 8632
8630(defun tramp-clear-passwd (vec) 8633(defun tramp-clear-passwd (vec)
8631 "Clear password cache for connection related to VEC." 8634 "Clear password cache for connection related to VEC."
8632 (when (functionp 'password-cache-remove) 8635 (tramp-compat-funcall
8633 (funcall 8636 'password-cache-remove
8634 (symbol-function 'password-cache-remove) 8637 (tramp-make-tramp-file-name
8635 (tramp-make-tramp-file-name 8638 (tramp-file-name-method vec)
8636 (tramp-file-name-method vec) 8639 (tramp-file-name-user vec)
8637 (tramp-file-name-user vec) 8640 (tramp-file-name-host vec)
8638 (tramp-file-name-host vec) 8641 "")))
8639 ""))))
8640 8642
8641;; Snarfed code from time-date.el and parse-time.el 8643;; Snarfed code from time-date.el and parse-time.el
8642 8644
@@ -8673,16 +8675,17 @@ T1 and T2 are time values (as returned by `current-time' for example)."
8673 ;; Pacify byte-compiler with `symbol-function'. 8675 ;; Pacify byte-compiler with `symbol-function'.
8674 (cond ((and (fboundp 'subtract-time) 8676 (cond ((and (fboundp 'subtract-time)
8675 (fboundp 'float-time)) 8677 (fboundp 'float-time))
8676 (funcall (symbol-function 'float-time) 8678 (tramp-compat-funcall
8677 (funcall (symbol-function 'subtract-time) t1 t2))) 8679 'float-time (tramp-compat-funcall 'subtract-time t1 t2)))
8678 ((and (fboundp 'subtract-time) 8680 ((and (fboundp 'subtract-time)
8679 (fboundp 'time-to-seconds)) 8681 (fboundp 'time-to-seconds))
8680 (funcall (symbol-function 'time-to-seconds) 8682 (tramp-compat-funcall
8681 (funcall (symbol-function 'subtract-time) t1 t2))) 8683 'time-to-seconds (tramp-compat-funcall 'subtract-time t1 t2)))
8682 ((fboundp 'itimer-time-difference) 8684 ((fboundp 'itimer-time-difference)
8683 (funcall (symbol-function 'itimer-time-difference) 8685 (tramp-compat-funcall
8684 (if (< (length t1) 3) (append t1 '(0)) t1) 8686 'itimer-time-difference
8685 (if (< (length t2) 3) (append t2 '(0)) t2))) 8687 (if (< (length t1) 3) (append t1 '(0)) t1)
8688 (if (< (length t2) 3) (append t2 '(0)) t2)))
8686 (t 8689 (t
8687 (let ((time (tramp-time-subtract t1 t2))) 8690 (let ((time (tramp-time-subtract t1 t2)))
8688 (+ (* (car time) 65536.0) 8691 (+ (* (car time) 65536.0)
@@ -8693,18 +8696,18 @@ T1 and T2 are time values (as returned by `current-time' for example)."
8693 "Return a coding system like CODING-SYSTEM but with given EOL-TYPE. 8696 "Return a coding system like CODING-SYSTEM but with given EOL-TYPE.
8694EOL-TYPE can be one of `dos', `unix', or `mac'." 8697EOL-TYPE can be one of `dos', `unix', or `mac'."
8695 (cond ((fboundp 'coding-system-change-eol-conversion) 8698 (cond ((fboundp 'coding-system-change-eol-conversion)
8696 (funcall (symbol-function 'coding-system-change-eol-conversion) 8699 (tramp-compat-funcall
8697 coding-system eol-type)) 8700 'coding-system-change-eol-conversion coding-system eol-type))
8698 ((fboundp 'subsidiary-coding-system) 8701 ((fboundp 'subsidiary-coding-system)
8699 (funcall (symbol-function 'subsidiary-coding-system) 8702 (tramp-compat-funcall
8700 coding-system 8703 'subsidiary-coding-system coding-system
8701 (cond ((eq eol-type 'dos) 'crlf) 8704 (cond ((eq eol-type 'dos) 'crlf)
8702 ((eq eol-type 'unix) 'lf) 8705 ((eq eol-type 'unix) 'lf)
8703 ((eq eol-type 'mac) 'cr) 8706 ((eq eol-type 'mac) 'cr)
8704 (t 8707 (t
8705 (error "Unknown EOL-TYPE `%s', must be %s" 8708 (error "Unknown EOL-TYPE `%s', must be %s"
8706 eol-type 8709 eol-type
8707 "`dos', `unix', or `mac'"))))) 8710 "`dos', `unix', or `mac'")))))
8708 (t (error "Can't change EOL conversion -- is MULE missing?")))) 8711 (t (error "Can't change EOL conversion -- is MULE missing?"))))
8709 8712
8710(defun tramp-set-process-query-on-exit-flag (process flag) 8713(defun tramp-set-process-query-on-exit-flag (process flag)
@@ -8712,8 +8715,8 @@ EOL-TYPE can be one of `dos', `unix', or `mac'."
8712If the second argument flag is non-nil, Emacs will query the user before 8715If the second argument flag is non-nil, Emacs will query the user before
8713exiting if process is running." 8716exiting if process is running."
8714 (if (fboundp 'set-process-query-on-exit-flag) 8717 (if (fboundp 'set-process-query-on-exit-flag)
8715 (funcall (symbol-function 'set-process-query-on-exit-flag) process flag) 8718 (tramp-compat-funcall 'set-process-query-on-exit-flag process flag)
8716 (funcall (symbol-function 'process-kill-without-query) process flag))) 8719 (tramp-compat-funcall 'process-kill-without-query) process flag))
8717 8720
8718 8721
8719;; ------------------------------------------------------------ 8722;; ------------------------------------------------------------
@@ -8773,8 +8776,7 @@ Only works for Bourne-like shells."
8773 ;; When Tramp is not loaded yet, its autoloads are still active. 8776 ;; When Tramp is not loaded yet, its autoloads are still active.
8774 (tramp-unload-file-name-handlers) 8777 (tramp-unload-file-name-handlers)
8775 ;; ange-ftp settings must be enabled. 8778 ;; ange-ftp settings must be enabled.
8776 (when (functionp 'tramp-ftp-enable-ange-ftp) 8779 (tramp-compat-funcall 'tramp-ftp-enable-ange-ftp)
8777 (funcall (symbol-function 'tramp-ftp-enable-ange-ftp)))
8778 ;; Maybe its not loaded yet. 8780 ;; Maybe its not loaded yet.
8779 (condition-case nil 8781 (condition-case nil
8780 (unload-feature 'tramp 'force) 8782 (unload-feature 'tramp 'force)