diff lisp/net/tramp-imap.el @ 110776:073caec7510f

* net/tramp.el (tramp-handle-directory-files-and-attributes) (tramp-handle-file-exists-p, tramp-handle-file-newer-than-file-p): New defuns, taken from tramp-smb.el. (tramp-coding-system-change-eol-conversion) (tramp-set-process-query-on-exit-flag): Removed. * net/tramp-compat.el (top): Do not check for byte-compiler objects. (tramp-compat-coding-system-change-eol-conversion) (tramp-compat-set-process-query-on-exit-flag): New defuns, taken from tramp.el. * net/tramp-gvfs.el: * net/tramp-gw.el: Replace `tramp-set-process-query-on-exit-flag' by `tramp-compat-set-process-query-on-exit-flag'. * net/tramp-imap.el (tramp-imap-file-name-handler-alist): Use `tramp-handle-directory-files-and-attributes', `tramp-handle-file-exists-p' and `tramp-handle-file-newer-than-file-p'. (tramp-imap-handle-file-exists-p) (tramp-imap-handle-file-executable-p) (tramp-imap-handle-file-readable-p) (tramp-imap-handle-directory-files-and-attributes) (tramp-imap-handle-file-newer-than-file-p): Removed. * net/tramp-sh.el: Replace `tramp-set-process-query-on-exit-flag' by `tramp-compat-set-process-query-on-exit-flag' and `tramp-coding-system-change-eol-conversion' by `tramp-compat-coding-system-change-eol-conversion'. * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Use `tramp-handle-directory-files-and-attributes', `tramp-handle-file-exists-p' and `tramp-handle-file-newer-than-file-p'. (tramp-smb-handle-directory-files-and-attributes) (tramp-smb-handle-file-exists-p) (tramp-smb-handle-file-newer-than-file-p): Removed. (tramp-smb-maybe-open-connection): Replace `tramp-set-process-query-on-exit-flag' by `tramp-compat-set-process-query-on-exit-flag'.
author Michael Albinus <michael.albinus@gmx.de>
date Tue, 05 Oct 2010 16:20:24 +0200
parents ec526909f60b
children 8e746f396237
line wrap: on
line diff
--- a/lisp/net/tramp-imap.el	Tue Oct 05 13:19:07 2010 +0000
+++ b/lisp/net/tramp-imap.el	Tue Oct 05 16:20:24 2010 +0200
@@ -122,7 +122,7 @@
     (directory-file-name . tramp-handle-directory-file-name)
     (directory-files . tramp-handle-directory-files)
     (directory-files-and-attributes
-     . tramp-imap-handle-directory-files-and-attributes)
+     . tramp-handle-directory-files-and-attributes)
     (dired-call-process . ignore)
     ;; `dired-compress-file' performed by default handler
     ;; `dired-uncache' performed by default handler
@@ -130,8 +130,8 @@
     ;; `file-accessible-directory-p' performed by default handler
     (file-attributes . tramp-imap-handle-file-attributes)
     (file-directory-p .  tramp-imap-handle-file-directory-p)
-    (file-executable-p . tramp-imap-handle-file-executable-p)
-    (file-exists-p . tramp-imap-handle-file-exists-p)
+    (file-executable-p . ignore)
+    (file-exists-p . tramp-handle-file-exists-p)
     (file-local-copy . tramp-imap-handle-file-local-copy)
     (file-modes . tramp-handle-file-modes)
     (file-name-all-completions . tramp-imap-handle-file-name-all-completions)
@@ -140,9 +140,9 @@
     (file-name-directory . tramp-handle-file-name-directory)
     (file-name-nondirectory . tramp-handle-file-name-nondirectory)
     ;; `file-name-sans-versions' performed by default handler
-    (file-newer-than-file-p . tramp-imap-handle-file-newer-than-file-p)
+    (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
     (file-ownership-preserved-p . ignore)
-    (file-readable-p . tramp-imap-handle-file-readable-p)
+    (file-readable-p . tramp-handle-file-exists-p)
     (file-regular-p . tramp-handle-file-regular-p)
     (file-remote-p . tramp-handle-file-remote-p)
     ;; `file-selinux-context' performed by default handler.
@@ -526,10 +526,6 @@
 	  (goto-char point)
 	  (list (expand-file-name filename) size))))))
 
-(defun tramp-imap-handle-file-exists-p (filename)
-  "Like `file-exists-p' for Tramp files."
-  (and (file-attributes filename) t))
-
 (defun tramp-imap-handle-file-directory-p (filename)
   "Like `file-directory-p' for Tramp-IMAP files."
   ;; We allow only mailboxes to be a directory.
@@ -549,14 +545,6 @@
   "Get inode equivalent \(actually the UID) for Tramp-IMAP FILENAME."
   (nth 10 (tramp-compat-file-attributes filename id-format)))
 
-(defun tramp-imap-handle-file-executable-p (filename)
-  "Like `file-executable-p' for Tramp files.  False for IMAP."
-  nil)
-
-(defun tramp-imap-handle-file-readable-p (filename)
-  "Like `file-readable-p' for Tramp files.  True for IMAP."
-  (file-exists-p filename))
-
 (defun tramp-imap-handle-file-writable-p (filename)
   "Like `file-writable-p' for Tramp files.  True for IMAP."
   ;; `file-exists-p' does not work yet for directories.
@@ -571,24 +559,6 @@
 	(let ((iht (tramp-imap-make-iht v)))
 	  (imap-hash-rem (tramp-imap-get-file-inode filename) iht))))))
 
-(defun tramp-imap-handle-directory-files-and-attributes
-  (directory &optional full match nosort id-format)
-  "Like `directory-files-and-attributes' for Tramp files."
-  (mapcar
-   (lambda (x)
-     (cons x (tramp-compat-file-attributes
-	      (if full x (expand-file-name x directory)) id-format)))
-   (directory-files directory full match nosort)))
-
-;; TODO: fix this in tramp-imap-get-file-entries.
-(defun tramp-imap-handle-file-newer-than-file-p (file1 file2)
-  "Like `file-newer-than-file-p' for Tramp files."
-  (cond
-   ((not (file-exists-p file1)) nil)
-   ((not (file-exists-p file2)) t)
-   (t (tramp-time-less-p (nth 5 (file-attributes file2))
-			 (nth 5 (file-attributes file1))))))
-
 (defun tramp-imap-handle-file-local-copy (filename)
   "Like `file-local-copy' for Tramp files."
   (with-parsed-tramp-file-name (expand-file-name filename) nil