diff lisp/net/tramp-compat.el @ 108285:e14a0bf9fbd0

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Thu, 06 May 2010 22:42:55 +0000
parents 96984953f99e
children 7827d5a5c826
line wrap: on
line diff
--- a/lisp/net/tramp-compat.el	Thu May 06 06:11:19 2010 +0000
+++ b/lisp/net/tramp-compat.el	Thu May 06 22:42:55 2010 +0000
@@ -262,7 +262,7 @@
     (tramp-file-name-handler 'file-attributes filename id-format))
    (t (condition-case nil
 	  (funcall (symbol-function 'file-attributes) filename id-format)
-	(error (file-attributes filename))))))
+	(wrong-number-of-arguments (file-attributes filename))))))
 
 ;; PRESERVE-UID-GID has been introduced with Emacs 23.  It does not
 ;; hurt to ignore it for other (X)Emacs versions.
@@ -320,13 +320,20 @@
 ;; FORCE has been introduced with Emacs 24.1.
 (defun tramp-compat-delete-file (filename &optional force)
   "Like `delete-file' for Tramp files (compat function)."
-  (condition-case nil
-      (funcall (symbol-function 'delete-file) filename force)
-    ;; This Emacs version does not support the FORCE flag.  Setting
-    ;; `delete-by-moving-to-trash' shall give us the same effect.
-    (error
-     (let ((delete-by-moving-to-trash (null force)))
-       (delete-file filename)))))
+  (if (null force)
+      (delete-file filename)
+    (condition-case nil
+	(funcall (symbol-function 'delete-file) filename force)
+      ;; This Emacs version does not support the FORCE flag.  Setting
+      ;; `delete-by-moving-to-trash' shall give us the same effect.
+      (wrong-number-of-arguments
+       (let ((delete-by-moving-to-trash
+	      (cond
+	       ((null force) t)
+	       ((boundp 'delete-by-moving-to-trash)
+		(symbol-value 'delete-by-moving-to-trash))
+	       (t nil))))
+	 (delete-file filename))))))
 
 ;; RECURSIVE has been introduced with Emacs 23.2.
 (defun tramp-compat-delete-directory (directory &optional recursive)
@@ -337,7 +344,7 @@
 	(funcall (symbol-function 'delete-directory) directory recursive)
       ;; This Emacs version does not support the RECURSIVE flag.  We
       ;; use the implementation from Emacs 23.2.
-      (error
+      (wrong-number-of-arguments
        (setq directory (directory-file-name (expand-file-name directory)))
        (if (not (file-symlink-p directory))
 	   (mapc (lambda (file)