emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp


From: Michael Albinus
Subject: [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp
Date: Sun, 04 Oct 2015 11:00:42 +0000

branch: master
commit acfb5cd0353406784f085ddb6edfb0d0587048c8
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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.
---
 lisp/net/tramp-compat.el |   22 +++++++++++-----------
 lisp/net/tramp.el        |    2 +-
 lisp/net/trampver.el     |   11 ++++++-----
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 9848325..e645195 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -105,6 +105,12 @@
   (unless (boundp 'remote-file-name-inhibit-cache)
     (defvar remote-file-name-inhibit-cache nil))
 
+  ;; `directory-listing-before-filename-regexp' does not exist in
+  ;; XEmacs.  Since we use it only in tramp-adb.el, it doesn't harm to
+  ;; declare it here.
+  (unless (boundp 'directory-listing-before-filename-regexp)
+      (defvar directory-listing-before-filename-regexp nil))
+
   ;; For not existing functions, or functions with a changed argument
   ;; list, there are compiler warnings.  We want to avoid them in
   ;; cases we know what we do.
@@ -122,16 +128,6 @@
   ;; `tramp-handle-*' functions, because this would bypass the locking
   ;; mechanism.
 
-  ;; `file-remote-p' has been introduced with Emacs 22.  The version
-  ;; of XEmacs is not a magic file name function (yet).
-  (unless (fboundp 'file-remote-p)
-    (defalias 'file-remote-p
-      (lambda (file &optional identification connected)
-       (when (tramp-tramp-file-p file)
-         (tramp-compat-funcall
-          'tramp-file-name-handler
-          'file-remote-p file identification connected)))))
-
   ;; `process-file' does not exist in XEmacs.
   (unless (fboundp 'process-file)
     (defalias 'process-file
@@ -187,7 +183,11 @@
      (lambda ()
        (ad-remove-advice
        'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards)
-       (ad-activate 'file-expand-wildcards)))))
+       (ad-activate 'file-expand-wildcards))))
+
+  ;; `redisplay' does not exist in XEmacs.
+  (unless (fboundp 'redisplay)
+    (defalias 'redisplay 'ignore)))
 
 ;; `with-temp-message' does not exist in XEmacs.
 (if (fboundp 'with-temp-message)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index fbb8c8a..df64f49 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4005,7 +4005,7 @@ be granted."
              (or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp"))))
     (with-tramp-connection-property vec "tmpdir"
       (or (and (file-directory-p dir) (file-writable-p dir)
-              (file-remote-p dir 'localname))
+              (tramp-file-name-handler 'file-remote-p dir 'localname))
          (tramp-error vec 'file-error "Directory %s not accessible" dir)))
     dir))
 
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index bba27e3..5c42f3a 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -38,12 +38,14 @@
 (defconst tramp-bug-report-address "address@hidden"
   "Email address to send bug reports to.")
 
+;; `locate-dominating-file' does not exist in XEmacs. But it is not used here.
+(autoload 'locate-dominating-file "files")
+(autoload 'tramp-compat-replace-regexp-in-string "tramp-compat")
+
 (defun tramp-repository-get-version ()
   "Try to return as a string the repository revision of the Tramp sources."
   (unless (featurep 'xemacs)
-    (let ((dir
-          (funcall
-           (intern "locate-dominating-file") (locate-library "tramp") ".git")))
+    (let ((dir (locate-dominating-file (locate-library "tramp") ".git")))
       (when dir
        (with-temp-buffer
          (let ((default-directory (file-name-as-directory dir)))
@@ -51,8 +53,7 @@
                  (ignore-errors
                    (call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
                 (not (zerop (buffer-size)))
-                (funcall
-                 (intern "tramp-compat-replace-regexp-in-string")
+                (tramp-compat-replace-regexp-in-string
                  "\n" "" (buffer-string)))))))))
 
 ;; Check for (X)Emacs version.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]