annotate lisp/net/tramp-imap.el @ 105489:8db047b72241

* play/animate.el (animate-string): For good effect, make sure `indent-tabs-mode' and `show-trailing-whitespace' are nil. * play/animate.el (animate-sequence, animate-birthday-present): * misc.el (butterfly): Don't set `indent-tabs-mode'.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 06 Oct 2009 11:15:01 +0000
parents 7f4c7f5c0eba
children bbf5bbea0d69
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
105250
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
1 ;;; tramp-imap.el --- Tramp interface to IMAP through imap.el
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
2
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
3 ;; Copyright (C) 2009 Free Software Foundation, Inc.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
4
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
5 ;; Author: Teodor Zlatanov <tzz@lifelogs.com>
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
6 ;; Keywords: mail, comm
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
7
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
9
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
13 ;; (at your option) any later version.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
14
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
18 ;; GNU General Public License for more details.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
19
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
22
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
23 ;;; Commentary:
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
24
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
25 ;; Package to provide Tramp over IMAP
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
26
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
27 ;;; Setup:
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
28
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
29 ;; just load and open files, e.g.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
30 ;; /imaps:user@yourhosthere.com:/INBOX.test/1
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
31 ;; or
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
32 ;; /imap:user@yourhosthere.com:/INBOX.test/1
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
33
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
34 ;; where `imap' goes over IMAP, while `imaps' goes over IMAP+SSL
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
35
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
36 ;; This module will use imap-hash.el to access the IMAP mailbox.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
37
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
38 ;; This module will use auth-source.el to authenticate against the
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
39 ;; IMAP server, PLUS it will use auth-source.el to get your passphrase
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
40 ;; for the symmetrically encrypted messages. For the former, use the
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
41 ;; usual IMAP ports. For the latter, use the port "tramp-imap".
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
42
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
43 ;; example .authinfo / .netrc file:
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
44
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
45 ;; machine yourhosthere.com port tramp-imap login USER password SYMMETRIC-PASSPHRASE
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
46
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
47 ;; note above is the symmetric encryption passphrase for GPG
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
48 ;; below is the regular password for IMAP itself and other things on that host
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
49
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
50 ;; machine yourhosthere.com login USER password NORMAL-PASSWORD
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
51
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
52
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
53 ;;; Code:
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
54
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
55 (require 'assoc)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
56 (require 'tramp)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
57 (require 'tramp-compat)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
58 (require 'message)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
59 (require 'imap-hash)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
60 (require 'epa)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
61 (autoload 'auth-source-user-or-password "auth-source")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
62
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
63 ;; Define Tramp IMAP method ...
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
64 (defconst tramp-imap-method "imap"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
65 "*Method to connect via IMAP protocol.")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
66
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
67 (add-to-list 'tramp-methods (list tramp-imap-method '(tramp-default-port 143)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
68
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
69 ;; Add a default for `tramp-default-user-alist'. Default is the local user.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
70 (add-to-list 'tramp-default-user-alist
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
71 `(,tramp-imap-method nil ,(user-login-name)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
72
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
73 ;; Define Tramp IMAPS method ...
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
74 (defconst tramp-imaps-method "imaps"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
75 "*Method to connect via secure IMAP protocol.")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
76
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
77 ;; ... and add it to the method list.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
78 (add-to-list 'tramp-methods (list tramp-imaps-method '(tramp-default-port 993)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
79
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
80 ;; Add a default for `tramp-default-user-alist'. Default is the local user.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
81 (add-to-list 'tramp-default-user-alist
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
82 `(,tramp-imaps-method nil ,(user-login-name)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
83
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
84 ;; Add completion function for IMAP method.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
85 ;; (tramp-set-completion-function
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
86 ;; tramp-imap-method tramp-completion-function-alist-ssh) ; TODO: test this
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
87 ;; tramp-imaps-method tramp-completion-function-alist-ssh) ; TODO: test this
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
88
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
89 ;; New handlers should be added here.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
90 (defconst tramp-imap-file-name-handler-alist
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
91 '(
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
92 ;; `access-file' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
93 (add-name-to-file . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
94 ;; `byte-compiler-base-file-name' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
95 (copy-file . tramp-imap-handle-copy-file)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
96 (delete-directory . ignore) ;; tramp-imap-handle-delete-directory)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
97 (delete-file . tramp-imap-handle-delete-file)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
98 ;; `diff-latest-backup-file' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
99 (directory-file-name . tramp-handle-directory-file-name)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
100 (directory-files . tramp-handle-directory-files)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
101 (directory-files-and-attributes
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
102 . tramp-imap-handle-directory-files-and-attributes)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
103 ;; `dired-call-process' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
104 ;; `dired-compress-file' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
105 ;; `dired-uncache' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
106 (expand-file-name . tramp-imap-handle-expand-file-name)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
107 ;; `file-accessible-directory-p' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
108 (file-attributes . tramp-imap-handle-file-attributes)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
109 (file-directory-p . tramp-imap-handle-file-directory-p)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
110 (file-executable-p . tramp-imap-handle-file-executable-p)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
111 (file-exists-p . tramp-imap-handle-file-exists-p)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
112 (file-local-copy . tramp-imap-handle-file-local-copy)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
113 (file-remote-p . tramp-handle-file-remote-p)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
114 (file-modes . tramp-handle-file-modes)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
115 (file-name-all-completions . tramp-imap-handle-file-name-all-completions)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
116 (file-name-as-directory . tramp-handle-file-name-as-directory)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
117 (file-name-completion . tramp-handle-file-name-completion)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
118 (file-name-directory . tramp-handle-file-name-directory)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
119 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
120 ;; `file-name-sans-versions' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
121 (file-newer-than-file-p . tramp-imap-handle-file-newer-than-file-p)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
122 (file-ownership-preserved-p . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
123 (file-readable-p . tramp-imap-handle-file-readable-p)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
124 (file-regular-p . tramp-handle-file-regular-p)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
125 (file-symlink-p . tramp-handle-file-symlink-p)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
126 ;; `file-truename' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
127 (file-writable-p . tramp-imap-handle-file-writable-p)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
128 (find-backup-file-name . tramp-handle-find-backup-file-name)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
129 ;; `find-file-noselect' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
130 ;; `get-file-buffer' performed by default handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
131 (insert-directory . tramp-imap-handle-insert-directory)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
132 (insert-file-contents . tramp-imap-handle-insert-file-contents)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
133 (load . tramp-handle-load)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
134 (make-directory . ignore) ;; tramp-imap-handle-make-directory)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
135 (make-directory-internal . ignore) ;; tramp-imap-handle-make-directory-internal)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
136 (make-symbolic-link . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
137 (rename-file . tramp-imap-handle-rename-file)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
138 (set-file-modes . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
139 (set-file-times . ignore) ;; tramp-imap-handle-set-file-times)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
140 (set-visited-file-modtime . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
141 (shell-command . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
142 (substitute-in-file-name . tramp-handle-substitute-in-file-name)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
143 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
144 (vc-registered . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
145 (verify-visited-file-modtime . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
146 (write-region . tramp-imap-handle-write-region)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
147 (executable-find . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
148 (start-file-process . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
149 (process-file . ignore)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
150 )
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
151 "Alist of handler functions for Tramp IMAP method.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
152 Operations not mentioned here will be handled by the default Emacs primitives.")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
153
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
154 (defgroup tramp-imap nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
155 "Tramp over IMAP configuration."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
156 :version "23.2"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
157 :group 'applications)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
158
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
159 (defcustom tramp-imap-subject-marker "tramp-imap-subject-marker"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
160 "The subject marker that Tramp-IMAP will use."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
161 :type 'string
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
162 :version "23.2"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
163 :group 'tramp-imap)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
164
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
165 ;; TODO: these will be defcustoms later.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
166 (defvar tramp-imap-passphrase-cache nil) ;; can be t or 'never
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
167 (defvar tramp-imap-passphrase nil)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
168
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
169 (defun tramp-imap-file-name-p (filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
170 "Check if it's a filename for IMAP protocol."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
171 (let ((v (tramp-dissect-file-name filename)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
172 (or
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
173 (string= (tramp-file-name-method v) tramp-imap-method)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
174 (string= (tramp-file-name-method v) tramp-imaps-method))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
175
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
176 (defun tramp-imap-file-name-handler (operation &rest args)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
177 "Invoke the IMAP related OPERATION.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
178 First arg specifies the OPERATION, second arg is a list of arguments to
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
179 pass to the OPERATION."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
180 (let ((fn (assoc operation tramp-imap-file-name-handler-alist)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
181 (if fn
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
182 (save-match-data (apply (cdr fn) args))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
183 (tramp-run-real-handler operation args))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
184
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
185 (add-to-list 'tramp-foreign-file-name-handler-alist
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
186 (cons 'tramp-imap-file-name-p 'tramp-imap-file-name-handler))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
187
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
188 (defun tramp-imap-handle-copy-file
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
189 (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
190 "Like `copy-file' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
191 (tramp-imap-do-copy-or-rename-file
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
192 'copy filename newname ok-if-already-exists keep-date preserve-uid-gid))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
193
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
194 (defun tramp-imap-handle-rename-file
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
195 (filename newname &optional ok-if-already-exists)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
196 "Like `rename-file' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
197 (tramp-imap-do-copy-or-rename-file
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
198 'rename filename newname ok-if-already-exists t t))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
199
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
200 (defun tramp-imap-do-copy-or-rename-file
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
201 (op filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
202 "Copy or rename a remote file.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
203 OP must be `copy' or `rename' and indicates the operation to perform.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
204 FILENAME specifies the file to copy or rename, NEWNAME is the name of
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
205 the new file (for copy) or the new name of the file (for rename).
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
206 OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
207 KEEP-DATE means to make sure that NEWNAME has the same timestamp
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
208 as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
209 the uid and gid if both files are on the same host.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
210
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
211 This function is invoked by `tramp-imap-handle-copy-file' and
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
212 `tramp-imap-handle-rename-file'. It is an error if OP is neither
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
213 of `copy' and `rename'."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
214 (unless (memq op '(copy rename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
215 (error "Unknown operation `%s', must be `copy' or `rename'" op))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
216 (setq filename (expand-file-name filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
217 (setq newname (expand-file-name newname))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
218 (when (file-directory-p newname)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
219 (setq newname (expand-file-name (file-name-nondirectory filename) newname)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
220
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
221 (let ((t1 (and (tramp-tramp-file-p filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
222 (tramp-imap-file-name-p filename)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
223 (t2 (and (tramp-tramp-file-p newname)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
224 (tramp-imap-file-name-p newname))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
225
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
226 (when (and (not ok-if-already-exists) (file-exists-p newname))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
227 (with-parsed-tramp-file-name (if t1 filename newname) nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
228 (tramp-error
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
229 v 'file-already-exists "File %s already exists" newname)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
230
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
231 (with-parsed-tramp-file-name (if t1 filename newname) nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
232 (tramp-message v 0 "Transferring %s to %s..." filename newname))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
233
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
234 ;; We just make a local copy of FILENAME, and write it then to
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
235 ;; NEWNAME. This must be optimized, when both files are located
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
236 ;; on the same IMAP server.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
237 (with-temp-buffer
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
238 (if (and t1 t2)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
239 ;; We don't encrypt.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
240 (with-parsed-tramp-file-name newname nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
241 (insert (tramp-imap-get-file filename nil))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
242 (tramp-imap-put-file
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
243 v (current-buffer)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
244 (tramp-imap-file-name-name v)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
245 (tramp-imap-get-file-inode newname)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
246 nil))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
247 ;; One of them is not located on a IMAP mailbox.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
248 (insert-file-contents filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
249 (write-region (point-min) (point-max) newname)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
250
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
251 (with-parsed-tramp-file-name (if t1 filename newname) nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
252 (tramp-message v 0 "Transferring %s to %s...done" filename newname))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
253
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
254 (when (eq op 'rename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
255 (delete-file filename))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
256
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
257 ;; TODO: revise this much
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
258 (defun tramp-imap-handle-expand-file-name (name &optional dir)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
259 "Like `expand-file-name' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
260 ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
261 (setq dir (or dir default-directory "/"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
262 ;; Unless NAME is absolute, concat DIR and NAME.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
263 (unless (file-name-absolute-p name)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
264 (setq name (concat (file-name-as-directory dir) name)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
265 ;; If NAME is not a Tramp file, run the real handler.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
266 (if (or (tramp-completion-mode-p) (not (tramp-tramp-file-p name)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
267 (tramp-drop-volume-letter
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
268 (tramp-run-real-handler 'expand-file-name (list name nil)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
269 ;; Dissect NAME.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
270 (with-parsed-tramp-file-name name nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
271 (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
272 (setq localname (concat "/" localname)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
273 ;; There might be a double slash, for example when "~/"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
274 ;; expands to "/". Remove this.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
275 (while (string-match "//" localname)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
276 (setq localname (replace-match "/" t t localname)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
277 ;; Do normal `expand-file-name' (this does "/./" and "/../").
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
278 ;; We bind `directory-sep-char' here for XEmacs on Windows,
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
279 ;; which would otherwise use backslash. `default-directory' is
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
280 ;; bound, because on Windows there would be problems with UNC
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
281 ;; shares or Cygwin mounts.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
282 (let ((default-directory (tramp-compat-temporary-file-directory)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
283 (tramp-make-tramp-file-name
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
284 method user host
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
285 (tramp-drop-volume-letter
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
286 (tramp-run-real-handler
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
287 'expand-file-name (list localname))))))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
288
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
289 ;; This function should return "foo/" for directories and "bar" for
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
290 ;; files.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
291 (defun tramp-imap-handle-file-name-all-completions (filename directory)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
292 "Like `file-name-all-completions' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
293 (all-completions
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
294 filename
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
295 (with-parsed-tramp-file-name (expand-file-name directory) nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
296 (save-match-data
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
297 (let ((entries
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
298 (tramp-imap-get-file-entries v localname)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
299 (mapcar
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
300 (lambda (x)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
301 (list
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
302 (if (string-match "d" (nth 9 x))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
303 (file-name-as-directory (nth 0 x))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
304 (nth 0 x))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
305 entries))))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
306
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
307 (defun tramp-imap-get-file-entries (vec localname &optional exact)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
308 "Read entries returned by IMAP server. EXACT limits to exact matches.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
309 Result is a list of (LOCALNAME LINK COUNT UID GID ATIME MTIME CTIME
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
310 SIZE MODE WEIRD INODE DEVICE)."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
311 (tramp-message vec 5 "working on %s" localname)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
312 (let* ((name (tramp-imap-file-name-name vec))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
313 (search-name (or name ""))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
314 (search-name (if exact (concat search-name "$") search-name))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
315 (iht (tramp-imap-make-iht vec search-name)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
316 ;; TODO: catch errors
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
317 ;; (tramp-error vec 'none "bad name %s or mailbox %s" name mbox))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
318 (imap-hash-map (lambda (uid headers body)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
319 (let ((subject (substring
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
320 (aget headers 'Subject "")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
321 (length tramp-imap-subject-marker))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
322 (list
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
323 subject
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
324 nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
325 -1
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
326 1
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
327 1
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
328 '(0 0)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
329 '(0 0)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
330 '(0 0)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
331 1
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
332 "-rw-rw-rw-"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
333 nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
334 uid
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
335 (tramp-get-device vec))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
336 iht t)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
337
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
338 (defun tramp-imap-handle-write-region (start end filename &optional append visit lockname confirm)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
339 "Like `write-region' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
340 (setq filename (expand-file-name filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
341 (with-parsed-tramp-file-name filename nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
342 ;; XEmacs takes a coding system as the seventh argument, not `confirm'.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
343 (when (and (not (featurep 'xemacs))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
344 confirm (file-exists-p filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
345 (unless (y-or-n-p (format "File %s exists; overwrite anyway? "
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
346 filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
347 (tramp-error v 'file-error "File not overwritten")))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
348 (tramp-flush-file-property v localname)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
349 (let* ((old-buffer (current-buffer))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
350 (inode (tramp-imap-get-file-inode filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
351 (min 1)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
352 (max (point-max))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
353 ;; Make sure we have good start and end values.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
354 (start (or start min))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
355 (end (or end max))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
356 temp-buffer)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
357 (with-temp-buffer
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
358 (setq temp-buffer (if (and (eq start min) (eq end max))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
359 old-buffer
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
360 ;; If this is a region write, insert the substring.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
361 (insert
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
362 (with-current-buffer old-buffer
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
363 (buffer-substring-no-properties start end)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
364 (current-buffer)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
365 (tramp-imap-put-file v
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
366 temp-buffer
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
367 (tramp-imap-file-name-name v)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
368 inode
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
369 t)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
370 (when (eq visit t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
371 (set-visited-file-modtime))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
372
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
373 (defun tramp-imap-handle-insert-directory
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
374 (filename switches &optional wildcard full-directory-p)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
375 "Like `insert-directory' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
376 (setq filename (expand-file-name filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
377 (when full-directory-p
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
378 ;; Called from `dired-add-entry'.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
379 (setq filename (file-name-as-directory filename)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
380 (with-parsed-tramp-file-name filename nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
381 (save-match-data
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
382 (let ((base (file-name-nondirectory localname))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
383 (entries (copy-sequence
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
384 (tramp-imap-get-file-entries
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
385 v (file-name-directory localname)))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
386
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
387 (when wildcard
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
388 (when (string-match "\\." base)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
389 (setq base (replace-match "\\\\." nil nil base)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
390 (when (string-match "\\*" base)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
391 (setq base (replace-match ".*" nil nil base)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
392 (when (string-match "\\?" base)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
393 (setq base (replace-match ".?" nil nil base))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
394
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
395 ;; Filter entries.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
396 (setq entries
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
397 (delq
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
398 nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
399 (if (or wildcard (zerop (length base)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
400 ;; Check for matching entries.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
401 (mapcar
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
402 (lambda (x)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
403 (when (string-match
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
404 (format "^%s" base) (nth 0 x))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
405 x))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
406 entries)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
407 ;; We just need the only and only entry FILENAME.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
408 (list (assoc base entries)))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
409
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
410 ;; Sort entries.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
411 (setq entries
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
412 (sort
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
413 entries
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
414 (lambda (x y)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
415 (if (string-match "t" switches)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
416 ;; Sort by date.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
417 (tramp-time-less-p (nth 6 y) (nth 6 x))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
418 ;; Sort by name.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
419 (string-lessp (nth 0 x) (nth 0 y))))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
420
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
421 ;; Handle "-F" switch.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
422 (when (string-match "F" switches)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
423 (mapc
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
424 (lambda (x)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
425 (when (not (zerop (length (car x))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
426 (cond
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
427 ((char-equal ?d (string-to-char (nth 9 x)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
428 (setcar x (concat (car x) "/")))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
429 ((char-equal ?x (string-to-char (nth 9 x)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
430 (setcar x (concat (car x) "*"))))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
431 entries))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
432
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
433 ;; Print entries.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
434 (mapcar
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
435 (lambda (x)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
436 (when (not (zerop (length (nth 0 x))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
437 (insert
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
438 (format
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
439 "%10s %3d %-8s %-8s %8s %s "
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
440 (nth 9 x) ; mode
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
441 (nth 11 x) ; inode
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
442 "nobody" "nogroup"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
443 (nth 8 x) ; size
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
444 (format-time-string
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
445 (if (tramp-time-less-p
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
446 (tramp-time-subtract (current-time) (nth 6 x))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
447 tramp-half-a-year)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
448 "%b %e %R"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
449 "%b %e %Y")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
450 (nth 6 x)))) ; date
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
451 ;; For the file name, we set the `dired-filename'
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
452 ;; property. This allows to handle file names with
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
453 ;; leading or trailing spaces as well.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
454 (let ((pos (point)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
455 (insert (format "%s" (nth 0 x))) ; file name
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
456 (put-text-property pos (point) 'dired-filename t))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
457 (insert "\n")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
458 (forward-line)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
459 (beginning-of-line)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
460 entries)))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
461
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
462 (defun tramp-imap-handle-insert-file-contents
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
463 (filename &optional visit beg end replace)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
464 "Like `insert-file-contents' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
465 (barf-if-buffer-read-only)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
466 (when visit
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
467 (setq buffer-file-name (expand-file-name filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
468 (set-visited-file-modtime)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
469 (set-buffer-modified-p nil))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
470 (with-parsed-tramp-file-name filename nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
471 (if (not (file-exists-p filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
472 (tramp-error
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
473 v 'file-error "File `%s' not found on remote host" filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
474 (let ((point (point))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
475 size data)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
476 (tramp-message v 4 "Fetching file %s..." filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
477 (insert (tramp-imap-get-file filename t))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
478 (setq size (- (point) point))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
479 ;;; TODO: handle ranges.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
480 ;;; (let ((beg (or beg (point-min)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
481 ;;; (end (min (or end (point-max)) (point-max))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
482 ;;; (setq size (- end beg))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
483 ;;; (buffer-substring beg end))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
484 (goto-char point)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
485 (tramp-message v 4 "Fetching file %s...done" filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
486 (list (expand-file-name filename) size)))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
487
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
488 (defun tramp-imap-handle-file-exists-p (filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
489 "Like `file-exists-p' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
490 (and (file-attributes filename) t))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
491
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
492 (defun tramp-imap-handle-file-directory-p (filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
493 "Like `file-directory-p' for Tramp-IMAP files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
494 ;; We allow only mailboxes to be a directory.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
495 (with-parsed-tramp-file-name (expand-file-name filename default-directory) nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
496 (and (string-match "^/[^/]*$" (directory-file-name localname)) t)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
497
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
498 (defun tramp-imap-handle-file-attributes (filename &optional id-format)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
499 "Like `file-attributes' for Tramp-IMAP FILENAME."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
500 (with-parsed-tramp-file-name (expand-file-name filename) nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
501 (cdr-safe (nth 0 (tramp-imap-get-file-entries v localname)))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
502
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
503 (defun tramp-imap-get-file-inode (filename &optional id-format)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
504 "Get inode equivalent \(actually the UID) for Tramp-IMAP FILENAME."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
505 (nth 10 (tramp-compat-file-attributes filename id-format)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
506
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
507 (defun tramp-imap-handle-file-executable-p (filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
508 "Like `file-executable-p' for Tramp files. False for IMAP."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
509 nil)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
510
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
511 (defun tramp-imap-handle-file-readable-p (filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
512 "Like `file-readable-p' for Tramp files. True for IMAP."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
513 (file-exists-p filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
514
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
515 (defun tramp-imap-handle-file-writable-p (filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
516 "Like `file-writable-p' for Tramp files. True for IMAP."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
517 ;; `file-exists-p' does not work yet for directories.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
518 ;; (file-exists-p (file-name-directory filename)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
519 (file-directory-p (file-name-directory filename)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
520
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
521 (defun tramp-imap-handle-delete-file (filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
522 "Like `delete-file' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
523 (cond
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
524 ((not (file-exists-p filename)) nil)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
525 (t (with-parsed-tramp-file-name (expand-file-name filename) nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
526 (let ((iht (tramp-imap-make-iht v)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
527 (imap-hash-rem (tramp-imap-get-file-inode filename) iht))))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
528
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
529 (defun tramp-imap-handle-directory-files-and-attributes
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
530 (directory &optional full match nosort id-format)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
531 "Like `directory-files-and-attributes' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
532 (mapcar
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
533 (lambda (x)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
534 (cons x (tramp-compat-file-attributes
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
535 (if full x (expand-file-name x directory)) id-format)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
536 (directory-files directory full match nosort)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
537
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
538 ;; TODO: fix this in tramp-imap-get-file-entries.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
539 (defun tramp-imap-handle-file-newer-than-file-p (file1 file2)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
540 "Like `file-newer-than-file-p' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
541 (cond
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
542 ((not (file-exists-p file1)) nil)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
543 ((not (file-exists-p file2)) t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
544 (t (tramp-time-less-p (nth 5 (file-attributes file2))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
545 (nth 5 (file-attributes file1))))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
546
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
547 (defun tramp-imap-handle-file-local-copy (filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
548 "Like `file-local-copy' for Tramp files."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
549 (with-parsed-tramp-file-name (expand-file-name filename) nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
550 (unless (file-exists-p filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
551 (tramp-error
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
552 v 'file-error
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
553 "Cannot make local copy of non-existing file `%s'" filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
554 (let ((tmpfile (tramp-compat-make-temp-file filename)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
555 (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
556 (with-temp-buffer
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
557 (insert-file-contents filename)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
558 (write-region (point-min) (point-max) tmpfile)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
559 (tramp-message v 4 "Fetching %s to tmp file %s...done" filename tmpfile)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
560 tmpfile))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
561
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
562 (defun tramp-imap-put-file (vec filename-or-buffer &optional subject inode encode)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
563 "Write contents of FILENAME-OR-BUFFER to Tramp-IMAP file VEC with name SUBJECT.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
564 When INODE is given, delete that old remote file after writing the new one
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
565 \(normally this is the old file with the same name)."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
566 ;; `tramp-current-host' is used in `tramp-imap-passphrase-callback-function'.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
567 (let ((tramp-current-host (tramp-file-name-real-host vec))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
568 (iht (tramp-imap-make-iht vec)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
569 (imap-hash-put (list
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
570 (list (cons
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
571 'Subject
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
572 (format
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
573 "%s%s"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
574 tramp-imap-subject-marker
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
575 (or subject "no subject"))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
576 (cond ((bufferp filename-or-buffer)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
577 (with-current-buffer filename-or-buffer
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
578 (if encode
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
579 (tramp-imap-encode-buffer)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
580 (buffer-string))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
581 ;; TODO: allow file names.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
582 (t "No body available")))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
583 iht
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
584 inode)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
585
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
586 (defun tramp-imap-get-file (filename &optional decode)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
587 ;; (debug (tramp-imap-get-file-inode filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
588 (with-parsed-tramp-file-name (expand-file-name filename) nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
589 (condition-case ()
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
590 ;; `tramp-current-host' is used in
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
591 ;; `tramp-imap-passphrase-callback-function'.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
592 (let* ((tramp-current-host (tramp-file-name-real-host v))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
593 (iht (tramp-imap-make-iht v))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
594 (inode (tramp-imap-get-file-inode filename))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
595 (data (imap-hash-get inode iht t)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
596 (if decode
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
597 (with-temp-buffer
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
598 (insert (nth 1 data))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
599 ;;(debug inode (buffer-string))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
600 (tramp-imap-decode-buffer))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
601 (nth 1 data)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
602 (error (tramp-error
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
603 v 'file-error "File `%s' could not be read" filename)))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
604
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
605 (defun tramp-imap-passphrase-callback-function (context key-id handback)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
606 "Called by EPG to get a passphrase for Tramp-IMAP.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
607 CONTEXT is the encryption/decryption EPG context.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
608 HANDBACK is just carried through.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
609 KEY-ID can be 'SYM or 'PIN among others."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
610 (let* ((server tramp-current-host)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
611 (port "tramp-imap") ; this is NOT the server password!
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
612 (auth-passwd
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
613 (auth-source-user-or-password "password" server port)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
614 (or
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
615 (copy-sequence auth-passwd)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
616 ;; If we cache the passphrase and we have one.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
617 (if (and (eq tramp-imap-passphrase-cache t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
618 tramp-imap-passphrase)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
619 ;; Do we reuse it?
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
620 (if (y-or-n-p "Reuse the passphrase? ")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
621 (copy-sequence tramp-imap-passphrase)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
622 ;; Don't reuse: revert caching behavior to nil, erase passphrase,
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
623 ;; call ourselves again.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
624 (setq tramp-imap-passphrase-cache nil)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
625 (setq tramp-imap-passphrase nil)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
626 (tramp-imap-passphrase-callback-function context key-id handback))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
627 (let ((p (if (eq key-id 'SYM)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
628 (read-passwd
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
629 "Tramp-IMAP passphrase for symmetric encryption: "
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
630 (eq (epg-context-operation context) 'encrypt)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
631 tramp-imap-passphrase)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
632 (read-passwd
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
633 (if (eq key-id 'PIN)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
634 "Tramp-IMAP passphrase for PIN: "
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
635 (let ((entry (assoc key-id epg-user-id-alist)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
636 (if entry
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
637 (format "Tramp-IMAP passphrase for %s %s: "
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
638 key-id (cdr entry))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
639 (format "Tramp-IMAP passphrase for %s: " key-id))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
640 nil
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
641 tramp-imap-passphrase))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
642
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
643 ;; If we have an answer, the passphrase has changed,
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
644 ;; the user hasn't declined keeping the passphrase,
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
645 ;; and they answer yes to keep it now...
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
646 (when (and
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
647 p
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
648 (not (equal tramp-imap-passphrase p))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
649 (not (eq tramp-imap-passphrase-cache 'never))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
650 (y-or-n-p "Keep the passphrase? "))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
651 (setq tramp-imap-passphrase (copy-sequence p))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
652 (setq tramp-imap-passphrase-cache t))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
653
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
654 ;; If we still don't have a passphrase, the user didn't want
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
655 ;; to keep it.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
656 (when (and
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
657 p
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
658 (not tramp-imap-passphrase))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
659 (setq tramp-imap-passphrase-cache 'never))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
660
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
661 p)))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
662
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
663 (defun tramp-imap-encode-buffer ()
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
664 (let ((context (epg-make-context 'OpenPGP))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
665 cipher)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
666 (epg-context-set-armor context t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
667 (epg-context-set-passphrase-callback context
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
668 #'tramp-imap-passphrase-callback-function)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
669 (epg-context-set-progress-callback context
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
670 (cons #'epa-progress-callback-function
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
671 "Encrypting..."))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
672 (message "Encrypting...")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
673 (setq cipher (epg-encrypt-string
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
674 context
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
675 (encode-coding-string (buffer-string) 'utf-8)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
676 nil))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
677 (message "Encrypting...done")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
678 cipher))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
679
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
680 (defun tramp-imap-decode-buffer ()
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
681 (let ((context (epg-make-context 'OpenPGP))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
682 plain)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
683 (epg-context-set-passphrase-callback context
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
684 #'tramp-imap-passphrase-callback-function)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
685 (epg-context-set-progress-callback context
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
686 (cons #'epa-progress-callback-function
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
687 "Decrypting..."))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
688 (message "Decrypting...")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
689 (setq plain (decode-coding-string
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
690 (epg-decrypt-string context (buffer-string))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
691 'utf-8))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
692 (message "Decrypting...done")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
693 plain))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
694
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
695 (defun tramp-imap-file-name-mailbox (vec)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
696 (nth 0 (tramp-imap-file-name-parse vec)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
697
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
698 (defun tramp-imap-file-name-name (vec)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
699 (nth 1 (tramp-imap-file-name-parse vec)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
700
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
701 (defun tramp-imap-file-name-localname (vec)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
702 (nth 1 (tramp-imap-file-name-parse vec)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
703
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
704 (defun tramp-imap-file-name-parse (vec)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
705 (let ((name (substring-no-properties (tramp-file-name-localname vec))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
706 (if (string-match "^/\\([^/]+\\)/?\\(.*\\)$" name)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
707 (list (match-string 1 name)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
708 (match-string 2 name))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
709 nil)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
710
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
711 (defun tramp-imap-make-iht (vec &optional needed-subject)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
712 "Translate the Tramp vector VEC to the imap-hash structure.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
713 With NEEDED-SUBJECT, alters the imap-hash test accordingly."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
714 (let* ((mbox (tramp-imap-file-name-mailbox vec))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
715 (server (tramp-file-name-real-host vec))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
716 (method (tramp-file-name-method vec))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
717 (user (tramp-file-name-user vec))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
718 (ssl (string-equal method tramp-imaps-method))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
719 (port (or (tramp-file-name-port vec)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
720 (tramp-get-method-parameter method 'tramp-default-port)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
721 (result (imap-hash-make server port mbox)))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
722 ;; Return the IHT with a test override to look for the subject
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
723 ;; marker. Set also user and ssl tags.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
724 (setq result (plist-put result :user user)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
725 result (plist-put result :ssl ssl)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
726 result (plist-put
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
727 result
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
728 :test (format "^%s%s"
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
729 tramp-imap-subject-marker
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
730 (if needed-subject needed-subject ""))))))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
731
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
732 ;;; TODO:
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
733
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
734 ;; * Implement `tramp-imap-handle-delete-directory',
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
735 ;; `tramp-imap-handle-make-directory',
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
736 ;; `tramp-imap-handle-make-directory-internal',
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
737 ;; `tramp-imap-handle-set-file-times'.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
738
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
739 ;; * Encode the subject. If the filename has trailing spaces (like
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
740 ;; "test "), those characters get lost, for example in dired listings.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
741
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
742 ;; * When opening a dired buffer, like "/imap::INBOX.test", there are
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
743 ;; several error messages:
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
744 ;; "Buffer has a running process; kill it? (yes or no) "
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
745 ;; "error in process filter: Internal error, tag 6 status BAD code nil text No mailbox selected."
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
746 ;; Afterwards, everything seems to be fine.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
747
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
748 ;; * imaps works for local IMAP servers. Accessing
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
749 ;; "/imaps:imap.gmail.com:/INBOX.test/" results in error
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
750 ;; "error in process filter: Internal error, tag 5 status BAD code nil text UNSELECT not allowed now.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
751
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
752 (provide 'tramp-imap)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
753 ;;; tramp-imap.el ends here
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
754
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
755 ;; Ignore, for testing only.
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
756
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
757 ;;; (setq tramp-imap-subject-marker "T")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
758 ;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/4") t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
759 ;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/") t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
760 ;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/test/4") t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
761 ;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/test/") t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
762 ;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen") t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
763 ;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen") t t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
764 ;;;(tramp-imap-get-file-inode "/imap:yourhosthere.com:/test/welcome")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
765 ;;; (dired-copy-file "/etc/fstab" "/imap:yourhosthere.com:/test/welcome" t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
766 ;;; (write-region 1 100 "/imap:yourhosthere.com:/test/welcome")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
767 ;;; (tramp-imap-get-file "/imap:yourhosthere.com:/test/welcome" t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
768 ;;(with-temp-buffer (insert "hello") (write-file "/imap:yourhosthere.com:/test/welcome"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
769 ;;(with-temp-buffer (insert "hello") (write-file "/imap:yourhosthere.com:/test/welcome2"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
770 ;;(file-writable-p "/imap:yourhosthere.com:/test/welcome2")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
771 ;;(file-name-directory "/imap:yourhosthere.com:/test/welcome2")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
772 ;;(with-temp-buffer (insert "hello") (delete-file "/tmp/hellotest") (write-file "/tmp/hellotest") (write-file "/imap:yourhosthere.com:/test/welcome2"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
773 ;;;(file-exists-p "/imap:yourhosthere.com:/INBOX.test/4")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
774 ;;;(file-attributes "/imap:yourhosthere.com:/INBOX.test/4")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
775 ;;;(setq vec (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/4"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
776 ;;;(tramp-imap-handle-file-attributes "/imap:yourhosthere.com:/INBOX.test/4")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
777 ;;; (tramp-imap-handle-insert-file-contents "/imap:user@yourhosthere.com:/INBOX.test/4" nil nil nil nil)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
778 ;;;(insert-file-contents "/imap:yourhosthere.com:/INBOX.test/4")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
779 ;;;(file-attributes "/imap:yourhosthere.com:/test/welcommen")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
780 ;;;(insert-file-contents "/imap:yourhosthere.com:/test/welcome")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
781 ;;;(file-exists-p "/imap:yourhosthere.com:/test/welcome2")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
782 ;;;(tramp-imap-handle-file-attributes "/imap:yourhosthere.com:/test/welcome")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
783 ;;;(tramp-imap-get-file-inode "/imap:yourhosthere.com:/test/welcommen")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
784 ;;;(tramp-imap-get-file-inode "/imap:yourhosthere.com:/test/welcome")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
785 ;;;(file-writable-p "/imap:yourhosthere.com:/test/welcome2")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
786 ;;; (delete-file "/imap:yourhosthere.com:/test/welcome")
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
787 ;;; (tramp-imap-get-file "/imap:yourhosthere.com:/test/welcommen" t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
788 ;;; (tramp-imap-get-file "/imap:yourhosthere.com:/test/welcome" t)
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
789 ;;;(tramp-imap-file-name-mailbox (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
790 ;;;(tramp-imap-file-name-mailbox (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/new/old"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
791 ;;;(tramp-imap-file-name-mailbox (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/new"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
792 ;;;(tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/new/two"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
793 ;;;(tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/new/one"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
794 ;;;(tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
795 ;;; (tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/test/4"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
796 ;;; (tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/test/"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
797 ;;; (tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
798 ;;; (tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
799 ;;; (tramp-imap-make-iht (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
800 ;;; (tramp-imap-make-iht (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/4"))
ceeb0491fbb4 * net/tramp-imap.el: New package.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
801 ;;; (tramp-imap-make-iht (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/4") "extra")
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105250
diff changeset
802
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105250
diff changeset
803 ;; arch-tag: f2723749-58fb-4f29-894e-39708096e850