]> code.delx.au - gnu-emacs/blobdiff - lisp/net/tramp-compat.el
Update copyright year to 2015
[gnu-emacs] / lisp / net / tramp-compat.el
index ca70c1384cbf9251a9c6974ca646edd83bf14b65..3ec90ca556f1616ede0373072441029782706a2a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; tramp-compat.el --- Tramp compatibility functions
 
-;; Copyright (C) 2007-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2015 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
 
 (eval-and-compile
 
+  ;; GNU Emacs 22.
+  (unless (fboundp 'ignore-errors)
+    (load "cl" 'noerror)
+    (load "cl-macs" 'noerror))
+
   ;; Some packages must be required for XEmacs, because we compile
   ;; with -no-autoloads.
   (when (featurep 'xemacs)
@@ -44,7 +49,8 @@
     (require 'outline)
     (require 'passwd)
     (require 'pp)
-    (require 'regexp-opt))
+    (require 'regexp-opt)
+    (require 'time-date))
 
   (require 'advice)
   (require 'custom)
@@ -416,6 +422,13 @@ Not actually used.  Use `(format \"%o\" i)' instead?"
                directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
      (delete-directory directory))))
 
+;; MUST-SUFFIX doesn't exist on XEmacs.
+(defun tramp-compat-load (file &optional noerror nomessage nosuffix must-suffix)
+  "Like `load' for Tramp files (compat function)."
+  (if must-suffix
+      (tramp-compat-funcall 'load file noerror nomessage nosuffix must-suffix)
+    (load file noerror nomessage nosuffix)))
+
 ;; `number-sequence' does not exist in XEmacs.  Implementation is
 ;; taken from Emacs 23.
 (defun tramp-compat-number-sequence (from &optional to inc)
@@ -471,7 +484,7 @@ element is not omitted."
 
      ;; Fallback, if there is no Lisp support yet.
      (t (let ((default-directory
-               (if (file-remote-p default-directory)
+               (if (tramp-tramp-file-p default-directory)
                    (tramp-compat-temporary-file-directory)
                  default-directory))
              (unix95 (getenv "UNIX95"))
@@ -578,8 +591,13 @@ and replace a sub-expression, e.g.
        (setq matches (cons (substring string start l) matches)) ; leftover
        (apply #'concat (nreverse matches))))))
 
+;; `default-toplevel-value' has been declared in Emacs 24.
+(unless (fboundp 'default-toplevel-value)
+  (defalias 'default-toplevel-value 'symbol-value))
+
 (add-hook 'tramp-unload-hook
          (lambda ()
+           (unload-feature 'tramp-loaddefs 'force)
            (unload-feature 'tramp-compat 'force)))
 
 (provide 'tramp-compat)