Discussion:
[VM] visit specific imap-folder
Salome Södergran
2011-05-24 20:00:10 UTC
Permalink
Hi!

I still encounter difficulties in adjusting vm to my needs and
desires. I will open a thread of its of for each difficulty.

This one is about creating a keybinding for visiting a certain imap-
folder. My vm-primary-inbox is a pop-folder. But I have also one imap-
account that I visit rather frequently, and I'd like to give that a
keybinding. I tried to create a function in analogy to the one
suggested by Uday for sending mails to a trash-folder but this
produces "Wrong type argument: consp, nil". I've been looking for a
solution and got as far as emacs' cons cells. But trying to adjust the
code to the cons cells syntax just resulted in other error messages.
This, of course, is a general emacs question, not just vm, but since I
ran into the problem in the context of configuring vm, I post it here.

How do I have to change the code below to get a function that will
make vm visit the inbox of my imap-account? (Whereas "myimap" is the
shortname for the connection to my imap-account, stored in an
encrypted authinfo.pgp-file. M-x vm-visit-imap-folder myimap:inbox
works just fine.)

(defvar vm-myiamp "myimap:inbox")
(defun vm-visit-myimap ()
(interactive)
(vm-visit-imap-folder vm-myimap))

Thanks in advance!
Salome
Uday Reddy
2011-05-24 20:00:13 UTC
Permalink
Post by Salome Södergran
How do I have to change the code below to get a function that will
make vm visit the inbox of my imap-account? (Whereas "myimap" is the
shortname for the connection to my imap-account, stored in an
encrypted authinfo.pgp-file. M-x vm-visit-imap-folder myimap:inbox
works just fine.)
(defvar vm-myiamp "myimap:inbox")
(defun vm-visit-myimap ()
(interactive)
(vm-visit-imap-folder vm-myimap))
The short name of IMAP accounts is only available for the interactive
user interface. When you call vm-visit-imap-folder from a program, you
need to specify the full IMAP maildrop specification of the folder.

(That is how the function was defined originally, and it can't be
changed without breaking the existing code. I have added the short
names for interactive use. The situation is still not entirely ideal.
I intend to move to the URL notation for a future version of VM.)

On another note, I personally don't like using up valuable key-bindings
for commands that I use only occasionally. Rather, I define short
command names, e.g.,

(defalias 'imap 'vm-visit-imap-folder)
(defalias 'pop 'vm-visit-pop-folder)
(defalias 'folder 'vm-visit-folder)
(defalias 'virtual 'vm-visit-virtual-folder)

Then I just have to type `M-x imap' to visit an IMAP folder.

You might also try using the menubar, which not only lists these
commands, but also the folders visited during the current session so
that you can easily go back to them.

Cheers,
Uday
Salome Södergran
2011-05-24 20:00:14 UTC
Permalink
Thank you, Uday, for the explanations!

Loading...