Ted Zlatanov | 7 Sep 2009 06:13
X-Face
Favicon
Gravatar

Re: Tramp-IMAP works and needs testing

On Sat, 18 Jul 2009 13:11:51 +0200 Michael Albinus <michael.albinus <at> gmx.de> wrote: 

MA> - Several functions in `tramp-imap-file-name-handler-alist' are not
MA>   implemented yet.

I'm trying to get basic file read/write working before those other
functions.  Should I just set them to nil for now?

Sorry for the delay, also.  I've been busy and the weekends are too short...

MA> - I doubt there will be implementation for `shell-command',
MA> `executable-find', and `process-file'. I've disabled them in
MA> `tramp-imap-file-name-handler-alist'.

OK.

MA> - You have used `tramp-debug-message'. I recommend to use
MA>   `tramp-message' instead, the verbose levels allow a better analysis of
MA>   the debug buffer.

OK.

MA> - `tramp-imap-handle-file-directory-p' must not return nil in all
MA>   cases. When I apply (save-buffer), the imap folder is checked for
MA>   being a directory. As workaround, I've changed
MA>   `tramp-imap-handle-file-directory-p' to return `t', but it must be
MA>   more precise.

This is actually tough, because an entry could be both.  We could have
the files INBOX.test/b and INBOX.test/b/c at the same time.  I will have
(Continue reading)

Michael Albinus | 8 Sep 2009 15:33
Picon
Picon
Gravatar

Re: Tramp-IMAP works and needs testing

Ted Zlatanov <tzz <at> lifelogs.com> writes:

> On Sat, 18 Jul 2009 13:11:51 +0200 Michael Albinus <michael.albinus <at> gmx.de> wrote:
>
> MA> - Several functions in `tramp-imap-file-name-handler-alist' are not
> MA>   implemented yet.
>
> I'm trying to get basic file read/write working before those other
> functions.  Should I just set them to nil for now?

We could set them to `ignore', and add a comment. I've done it for all
functions with a missing implementation.

> MA> - `tramp-imap-handle-file-directory-p' must not return nil in all
> MA>   cases. When I apply (save-buffer), the imap folder is checked for
> MA>   being a directory. As workaround, I've changed
> MA>   `tramp-imap-handle-file-directory-p' to return `t', but it must be
> MA>   more precise.
>
> This is actually tough, because an entry could be both.  We could have
> the files INBOX.test/b and INBOX.test/b/c at the same time.  I will have
> to make the directory name the mailbox name and everything above that
> the filename.  Thus no subdirectories are allowed, which simplifies the
> logic.  Otherwise I don't think Tramp can handle it.  So:
>
> /imap:albinus <at> localhost:/INBOX.test = directory
> /imap:albinus <at> localhost:/INBOX.test/ = directory
> /imap:albinus <at> localhost:/INBOX.test/1 = file "1"
> /imap:albinus <at> localhost:/INBOX.test/1/2 = illegal file name
>
(Continue reading)

Ted Zlatanov | 9 Sep 2009 18:13
X-Face
Favicon
Gravatar

Re: Tramp-IMAP works and needs testing

On Tue, 08 Sep 2009 15:33:11 +0200 Michael Albinus <michael.albinus <at> gmx.de> wrote: 
...
MA> Furthermore, I've changed the following:

MA> - Change the copyright owner to FSF. I hope you are OK with this;
MA>   otherwise we have no chance to add your package to Tramp and Emacs.

MA> - Make `tramp-imap-method' and `tramp-imaps-method' a defconst. I know
MA>   that in some other tramp-*.el files the methods are also defcustom's,
MA>   but I don't believe it is necessary (and I shall change it everywhere).

MA> - Change implementation of `tramp-imap-handle-file-readable-p ' and
MA>   `tramp-imap-handle-file-writable-p'.

MA> After all, it is working already pretty fine. I believe we shall add it
MA> to Tramp's CVS repository, and likely we shall add it also to the
MA> upcoming Tramp 2.1.17 release (maybe marked as experimental).

Thanks for all your help.  I am working on a storage layer
(imap-hash.el) that will let me treat a mailbox as a hash table, making
retrieval and storage much easier.  That way I can make tramp-imap.el
correspondingly simpler.  

I will incorporate all your changes as well; my changes are at the
storage layer and don't interfere with the Tramp functionality.  I am
working hard on this so I expect imap-hash.el to be ready soon.
Afterwards I can merge your changes and overhaul the tramp-imap.el code.
Can you hold on before adding the old tramp-imap.el to Tramp?  I don't
want my bad code harming other programmers' minds ;)  I think I can
make the 2.1.17 release; I'll follow up with a progress report in a week
(Continue reading)

Michael Albinus | 10 Sep 2009 09:18
Picon
Picon
Gravatar

Re: Tramp-IMAP works and needs testing

Ted Zlatanov <tzz <at> lifelogs.com> writes:

> MA> After all, it is working already pretty fine. I believe we shall add it
> MA> to Tramp's CVS repository, and likely we shall add it also to the
> MA> upcoming Tramp 2.1.17 release (maybe marked as experimental).
>
> Can you hold on before adding the old tramp-imap.el to Tramp?  I don't
> want my bad code harming other programmers' minds ;)  I think I can
> make the 2.1.17 release; I'll follow up with a progress report in a week
> if I'm not done by then.

That's easy. Starting on Saturday, I'll be almost offline for a week.

> Thanks
> Ted

Best regards, Michael.
Ted Zlatanov | 21 Sep 2009 21:28
X-Face
Favicon
Gravatar

imap-hash.el and tramp-imap.el

Attached are imap-hash.el and tramp-imap.el, I worked on them this
weekend.

imap-hash.el lets you treat an IMAP mailbox as a hash.  It lets you get
individual keys' headers and body data (keys are message UIDs) or map a
function across *all the messages in the mailbox*.  The function is only
called for those that match a given subject, but really I should be
using SEARCH.  So the library is not optimized for speed.  Also, it does
not handle invalid mailbox names gracefully yet.  Consider it an alpha
version.

I plan to eventually use imap-hash.el to store distributed Gnus data,
specifically the Gnus registry, the newsrc file, scoring files,
etc.

tramp-imap.el uses imap-hash.el to provide a Tramp interface to read and
write files as messages in an IMAP mailbox.  It's also an alpha version,
but it will at least let you (given a valid IMAP mailbox) read and write
directory contents.  It uses EPG (thanks to Daiki Ueno's help) to
encrypt the file contents when they are stored as messages.

Ted

Attachment (tramp-imap.el): application/emacs-lisp, 24 KiB
Attachment (imap-hash.el): application/emacs-lisp, 13 KiB
Michael Albinus | 22 Sep 2009 16:52
Picon
Picon
Gravatar

Re: imap-hash.el and tramp-imap.el

Ted Zlatanov <tzz <at> lifelogs.com> writes:

Hi Ted,

> Attached are imap-hash.el and tramp-imap.el, I worked on them this
> weekend.

Thanks for this. I've played a little bit with them (no real test yet).

> imap-hash.el lets you treat an IMAP mailbox as a hash.  It lets you get
> individual keys' headers and body data (keys are message UIDs) or map a
> function across *all the messages in the mailbox*.  The function is only
> called for those that match a given subject, but really I should be
> using SEARCH.  So the library is not optimized for speed.  Also, it does
> not handle invalid mailbox names gracefully yet.  Consider it an alpha
> version.

Could you, please, add "(require 'assoc)"? It's not loaded by default.

> tramp-imap.el uses imap-hash.el to provide a Tramp interface to read and
> write files as messages in an IMAP mailbox.  It's also an alpha version,
> but it will at least let you (given a valid IMAP mailbox) read and write
> directory contents.  It uses EPG (thanks to Daiki Ueno's help) to
> encrypt the file contents when they are stored as messages.

As usual, I have some few patches :-)

* imaps didn't work for me any longer. I've patched
  `tramp-imap-make-iht' until it worked ... maybe my sledge-hammer patch
  could be done more elegant. There is still an error message in the
(Continue reading)

Ted Zlatanov | 23 Sep 2009 23:07
X-Face
Favicon
Gravatar

Re: imap-hash.el and tramp-imap.el

On Tue, 22 Sep 2009 16:52:59 +0200 Michael Albinus <michael.albinus <at> gmx.de> wrote: 

MA> Could you, please, add "(require 'assoc)"? It's not loaded by default.

OK.

MA> * imaps didn't work for me any longer. I've patched
MA>   `tramp-imap-make-iht' until it worked ... maybe my sledge-hammer patch
MA>   could be done more elegant. There is still an error message in the
MA>   mini-buffer when opening the IMAP folder, but it doesn't seem to hurt.

Looks OK.  I haven't tested imaps thoroughly and it's not crucial to
releasing IMO.  The approach is OK; I want the clients of imap-hash.el
to modify the IHT as needed after it's created, so it can carry extra
information as appropriate to the particular client.

MA> * I have renamed `tramp-imap-handle-file-inode' to
MA>   `tramp-imap-get-file-inode'. tramp-*-handle-* function names shall be
MA>   reserved to basic file name operations implementation.

MA> * I have used `tramp-current-host' to solve the problem of unresolved
MA>   vector in `tramp-imap-passphrase-callback-function'.  That variable
MA>   was introduced in tramp.el for exactly this kind of problems.

Great.  Thanks so much for looking into this.

MA> * When you byte-compile tramp-imap.el, there is a warning about unknown
MA>   function `tramp-imap-get-message-headers'. No idea, what to do here.

I don't see that warning.  I do see:
(Continue reading)

Reiner Steib | 24 Sep 2009 08:44
X-Face

Re: imap-hash.el and tramp-imap.el

On Mon, Sep 21 2009, Ted Zlatanov wrote:

>     ;; TODO: make this search better
>     (if (search-forward "--text follows this line--" nil t)
> 	(delete-region (line-beginning-position) (line-end-position))
>       (error "Could not find the body separator in the encoded message!"))))

Why not use `mail-header-separator'?

Bye, Reiner.
--

-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

Michael Albinus | 24 Sep 2009 12:38
Picon
Picon
Gravatar

Re: imap-hash.el and tramp-imap.el

Ted Zlatanov <tzz <at> lifelogs.com> writes:

> MA> * imaps didn't work for me any longer. I've patched
> MA>   `tramp-imap-make-iht' until it worked ... maybe my sledge-hammer patch
> MA>   could be done more elegant. There is still an error message in the
> MA>   mini-buffer when opening the IMAP folder, but it doesn't seem to hurt.
>
> Looks OK.  I haven't tested imaps thoroughly and it's not crucial to
> releasing IMO.  The approach is OK; I want the clients of imap-hash.el
> to modify the IHT as needed after it's created, so it can carry extra
> information as appropriate to the particular client.

I have polished my change a little bit. The default port numbers are
kept now in `tramp-methods', like it is done for other methods as
well. And I also update the user tag in the structure.

> MA> * When you byte-compile tramp-imap.el, there is a warning about unknown
> MA>   function `tramp-imap-get-message-headers'. No idea, what to do here.
>
> I don't see that warning.  I do see:
>
> tramp-imap.el:364:53:Warning: reference to free variable `filename'
>
> which is strange, because with-parsed-tramp-file-name should set
> `filename'.

This I have fixed. However, there is still the warning for
`tramp-imap-get-message-headers. You could check the source code; this
function does not seem to be defined, indeed.

(Continue reading)

Ted Zlatanov | 25 Sep 2009 22:48
X-Face
Favicon
Gravatar

Re: imap-hash.el and tramp-imap.el

On Thu, 24 Sep 2009 12:38:43 +0200 Michael Albinus <michael.albinus <at> gmx.de> wrote: 

MA> Ted Zlatanov <tzz <at> lifelogs.com> writes:
MA> * imaps didn't work for me any longer. I've patched
MA> `tramp-imap-make-iht' until it worked ... maybe my sledge-hammer patch
MA> could be done more elegant. There is still an error message in the
MA> mini-buffer when opening the IMAP folder, but it doesn't seem to hurt.
>> 
>> Looks OK.  I haven't tested imaps thoroughly and it's not crucial to
>> releasing IMO.  The approach is OK; I want the clients of imap-hash.el
>> to modify the IHT as needed after it's created, so it can carry extra
>> information as appropriate to the particular client.

MA> I have polished my change a little bit. The default port numbers are
MA> kept now in `tramp-methods', like it is done for other methods as
MA> well. And I also update the user tag in the structure.

OK.  We'll assume Tramp's version of tramp-imap.el is authoritative from
now on, and I'll commit my updates there.

MA> This I have fixed. However, there is still the warning for
MA> `tramp-imap-get-message-headers. You could check the source code; this
MA> function does not seem to be defined, indeed.

OK, I'll make a patch for this and also to reflect Reiner's comment
about the message-mode body separator.

MA> I really would like to add tramp-imap.el to the CVS repository. I test
MA> on different machines, and the current situation is inconvenient for
MA> me. Do you agree for a checkin?
(Continue reading)


Gmane