aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2015-10-04 13:00:33 +0200
committerMichael Albinus2015-10-04 13:00:33 +0200
commitacfb5cd0353406784f085ddb6edfb0d0587048c8 (patch)
tree8e42498109553516b9aee8662b91c365995d16ee
parentb28beb11f3ed93af0f53fb87838bbcab0b469dfb (diff)
downloademacs-acfb5cd0353406784f085ddb6edfb0d0587048c8.tar.gz
emacs-acfb5cd0353406784f085ddb6edfb0d0587048c8.zip
Improve XEmacs compatibility of Tramp
* lisp/net/tramp-compat.el (directory-listing-before-filename-regexp): Declare if it doesn't exist. (file-remote-p): Remove defalias, which was necessary for GNU Emacs 21. (redisplay): Make it an alias if it doesn't exist. * lisp/net/tramp.el (tramp-get-remote-tmpdir): Don't use `file-remote-p' (due to XEmacs compatibility). * lisp/net/trampver.el (locate-dominating-file) (tramp-compat-replace-regexp-in-string): Autoload. (tramp-repository-get-version): Do not dupe byte-compiler.
-rw-r--r--lisp/net/tramp-compat.el22
-rw-r--r--lisp/net/tramp.el2
-rw-r--r--lisp/net/trampver.el11
3 files changed, 18 insertions, 17 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 9848325e45a..e6451956dc4 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -105,6 +105,12 @@
105 (unless (boundp 'remote-file-name-inhibit-cache) 105 (unless (boundp 'remote-file-name-inhibit-cache)
106 (defvar remote-file-name-inhibit-cache nil)) 106 (defvar remote-file-name-inhibit-cache nil))
107 107
108 ;; `directory-listing-before-filename-regexp' does not exist in
109 ;; XEmacs. Since we use it only in tramp-adb.el, it doesn't harm to
110 ;; declare it here.
111 (unless (boundp 'directory-listing-before-filename-regexp)
112 (defvar directory-listing-before-filename-regexp nil))
113
108 ;; For not existing functions, or functions with a changed argument 114 ;; For not existing functions, or functions with a changed argument
109 ;; list, there are compiler warnings. We want to avoid them in 115 ;; list, there are compiler warnings. We want to avoid them in
110 ;; cases we know what we do. 116 ;; cases we know what we do.
@@ -122,16 +128,6 @@
122 ;; `tramp-handle-*' functions, because this would bypass the locking 128 ;; `tramp-handle-*' functions, because this would bypass the locking
123 ;; mechanism. 129 ;; mechanism.
124 130
125 ;; `file-remote-p' has been introduced with Emacs 22. The version
126 ;; of XEmacs is not a magic file name function (yet).
127 (unless (fboundp 'file-remote-p)
128 (defalias 'file-remote-p
129 (lambda (file &optional identification connected)
130 (when (tramp-tramp-file-p file)
131 (tramp-compat-funcall
132 'tramp-file-name-handler
133 'file-remote-p file identification connected)))))
134
135 ;; `process-file' does not exist in XEmacs. 131 ;; `process-file' does not exist in XEmacs.
136 (unless (fboundp 'process-file) 132 (unless (fboundp 'process-file)
137 (defalias 'process-file 133 (defalias 'process-file
@@ -187,7 +183,11 @@
187 (lambda () 183 (lambda ()
188 (ad-remove-advice 184 (ad-remove-advice
189 'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards) 185 'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards)
190 (ad-activate 'file-expand-wildcards))))) 186 (ad-activate 'file-expand-wildcards))))
187
188 ;; `redisplay' does not exist in XEmacs.
189 (unless (fboundp 'redisplay)
190 (defalias 'redisplay 'ignore)))
191 191
192;; `with-temp-message' does not exist in XEmacs. 192;; `with-temp-message' does not exist in XEmacs.
193(if (fboundp 'with-temp-message) 193(if (fboundp 'with-temp-message)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index fbb8c8a349e..df64f49e1e6 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4005,7 +4005,7 @@ be granted."
4005 (or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp")))) 4005 (or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp"))))
4006 (with-tramp-connection-property vec "tmpdir" 4006 (with-tramp-connection-property vec "tmpdir"
4007 (or (and (file-directory-p dir) (file-writable-p dir) 4007 (or (and (file-directory-p dir) (file-writable-p dir)
4008 (file-remote-p dir 'localname)) 4008 (tramp-file-name-handler 'file-remote-p dir 'localname))
4009 (tramp-error vec 'file-error "Directory %s not accessible" dir))) 4009 (tramp-error vec 'file-error "Directory %s not accessible" dir)))
4010 dir)) 4010 dir))
4011 4011
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index bba27e39469..5c42f3a828a 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -38,12 +38,14 @@
38(defconst tramp-bug-report-address "tramp-devel@gnu.org" 38(defconst tramp-bug-report-address "tramp-devel@gnu.org"
39 "Email address to send bug reports to.") 39 "Email address to send bug reports to.")
40 40
41;; `locate-dominating-file' does not exist in XEmacs. But it is not used here.
42(autoload 'locate-dominating-file "files")
43(autoload 'tramp-compat-replace-regexp-in-string "tramp-compat")
44
41(defun tramp-repository-get-version () 45(defun tramp-repository-get-version ()
42 "Try to return as a string the repository revision of the Tramp sources." 46 "Try to return as a string the repository revision of the Tramp sources."
43 (unless (featurep 'xemacs) 47 (unless (featurep 'xemacs)
44 (let ((dir 48 (let ((dir (locate-dominating-file (locate-library "tramp") ".git")))
45 (funcall
46 (intern "locate-dominating-file") (locate-library "tramp") ".git")))
47 (when dir 49 (when dir
48 (with-temp-buffer 50 (with-temp-buffer
49 (let ((default-directory (file-name-as-directory dir))) 51 (let ((default-directory (file-name-as-directory dir)))
@@ -51,8 +53,7 @@
51 (ignore-errors 53 (ignore-errors
52 (call-process "git" nil '(t nil) nil "rev-parse" "HEAD"))) 54 (call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
53 (not (zerop (buffer-size))) 55 (not (zerop (buffer-size)))
54 (funcall 56 (tramp-compat-replace-regexp-in-string
55 (intern "tramp-compat-replace-regexp-in-string")
56 "\n" "" (buffer-string))))))))) 57 "\n" "" (buffer-string)))))))))
57 58
58;; Check for (X)Emacs version. 59;; Check for (X)Emacs version.