Discussion:
[VM] vm-save-message-hook?
Robert Adesam
2011-04-27 21:28:56 UTC
Permalink
Hi all,

I am using VM 8.1.1 and Orgmode 7.01. I would like to write a custom
trigger when saving a message in VM, looking around I could not find a
vm-save-message-hook or similar. So would I have redefine the
vm-save-message function all together? Any hints?

What I want the trigger to do is update links in org files so they
point to the correct vm folder when moving messages around. I usually
create todo items from new messages with orgmode capture and inserts a
link to the message while doing so. Then i archive the message in some
other folder to get it out of my inbox...

yours,
/robert
--
ROBERT ADESAM, Systems Engineer
Swedish National Graduate School of Language Technology
Department of Philosophy, Linguistics, and Theory of Science
UNIVERSITY OF GOTHENBURG
Phone +46 (0)31 786 5915 | Mobile +46 (0)733 339699
Joost Kremers
2011-04-27 22:44:41 UTC
Permalink
Post by Robert Adesam
I am using VM 8.1.1 and Orgmode 7.01. I would like to write a custom
trigger when saving a message in VM, looking around I could not find a
vm-save-message-hook or similar. So would I have redefine the
vm-save-message function all together? Any hints?
you may be able to advise the function:

(info "(elisp) Advising Functions")
--
Joost Kremers
Life has its moments
Robert Adesam
2011-04-28 09:55:05 UTC
Permalink
Post by Robert Adesam
I am using VM 8.1.1 and Orgmode 7.01. I would like to write a custom
trigger when saving a message in VM, looking around I could not find a
vm-save-message-hook or similar. So would I have redefine the
vm-save-message function all together? Any hints?
JK> you may be able to advise the function:

JK> (info "(elisp) Advising Functions")

ah looks promising. thank you, that was a well-advised advice...

yours,
/robert
--
ROBERT ADESAM, Systems Engineer
Swedish National Graduate School of Language Technology
Department of Philosophy, Linguistics, and Theory of Science
UNIVERSITY OF GOTHENBURG
Phone +46 (0)31 786 5915 | Mobile +46 (0)733 339699
Uday S Reddy
2011-04-28 10:06:53 UTC
Permalink
Post by Robert Adesam
Hi all,
I am using VM 8.1.1 and Orgmode 7.01. I would like to write a custom
trigger when saving a message in VM, looking around I could not find a
vm-save-message-hook or similar. So would I have redefine the
vm-save-message function all together? Any hints?
I have now added a variable called `vm-save-message-hook' in the
development version on Launchpad. If you have never used Launchpad
before, please see the README file in the VM directory.

The variable stores hook functions that take one argument, the folder
being saved to. (My memory is that Emacs Lisp didn't originally have
hook functions taking arguments, but it does now. Good for us.)

I am curious how you are going to use this hook. Will you search
through all the Org files to see which ones reference the saved message?
Or, do you store links from VM folders to the Org files that reference
them? (Well, I guess, if you do then you will have the opposite problem
of updating VM folders when Org files move!)

A better idea in the long run might be to use an index like mairix,
which keep track of where the messages have moved. I recall that
somebody on the Org list mentioned having used it.

Cheers,
Uday
Robert Adesam
2011-04-28 18:37:15 UTC
Permalink
USR> I have now added a variable called `vm-save-message-hook' in the
USR> development version on Launchpad. If you have never used
USR> Launchpad before, please see the README file in the VM directory.

USR> The variable stores hook functions that take one argument, the
USR> folder being saved to. (My memory is that Emacs Lisp didn't
USR> originally have hook functions taking arguments, but it does now.
USR> Good for us.)

That was quick, thank you!

USR> I am curious how you are going to use this hook. Will you search
USR> through all the Org files to see which ones reference the saved
USR> message? Or, do you store links from VM folders to the Org files
USR> that reference them? (Well, I guess, if you do then you will have
USR> the opposite problem of updating VM folders when Org files move!)

Sorry for this very long reply... I like to keep my email inbox small,
when I read emails I capture todos, ideas, somedays, etc that pop up
from reading them in my orgmode inbox.org where I keep all
non-processed stuff (according to my implementation of GTD :). Then I
file away the email in some folder for reference and seldom move it
again. So, I think I only need to update the links in inbox.org, that
should take care of most of my broken links.

USR> A better idea in the long run might be to use an index like mairix,
USR> which keep track of where the messages have moved. I recall that
USR> somebody on the Org list mentioned having used it.

Hmmm, yes this seems to be a good move. :) I actually have been using
mairix earlier for searching but stopped using it... I should really
look into this again. Thanks!

yours,
/robert
--
ROBERT ADESAM, Systems Engineer
Swedish National Graduate School of Language Technology
Department of Philosophy, Linguistics, and Theory of Science
UNIVERSITY OF GOTHENBURG
Phone +46 (0)31 786 5915 | Mobile +46 (0)733 339699
rene
2014-07-18 07:18:17 UTC
Permalink
Post by Robert Adesam
What I want the trigger to do is update links in org files so they
point to the correct vm folder when moving messages around. I usually
create todo items from new messages with orgmode capture and inserts a
link to the message while doing so. Then i archive the message in some
other folder to get it out of my inbox...
That's exactly what I want to do.

Did you manage to set things up so that you can org-capture a task from your
main inbox and still org-store-link to the folder where you will store your
email.

For the time being what I do is

1. vm-save-message the email to the destination folder
2. vm-visit-folder destination
3. open that email
4. org-capture + org-store-link to that email

It's a bit painful.

I would rather have use an org-capture template that would let me
a. chose the destination folder for the current email
b. and create a new task with the right destination link stored.

--
Robert Adesam
2014-08-25 20:15:50 UTC
Permalink
Hi Rene,
r> For the time being what I do is

r> 1. vm-save-message the email to the destination folder
r> 2. vm-visit-folder destination
r> 3. open that email
r> 4. org-capture + org-store-link to that email

r> It's a bit painful.

yes that was similar to what I did, before I discovered mairix and
orgmode's link types. Kudos to Uday Reddy who hinted this solution to
me back in 2011.

r> I would rather have use an org-capture template that would let me
r> a. chose the destination folder for the current email
r> b. and create a new task with the right destination link stored.

After setting up a working mairix and mairix mode, I wrote a new
link type. See my blog posts from 2011/2012

http://robert-adesam.blogspot.se/2012/06/org-mode-vm-mairix-link-type-evolved.html

http://robert-adesam.blogspot.se/2011/07/orgmode-capture-to-insert-mairix-link.html

So when capturing a task from a message in vm, a link with a mairix
search using the message id will be created.

Now following/opening that link via orgmode will execute a mairix
search and you will get the mairix-search-file in vm with that
message, well actually the whole thread as mairix sees it.

Note that I am not longer runing (mairix-update-databse) in the link
type function, but updating the mairix databse via cron...

Hope this helps, it's now a very important part in my everyday work.

yours,
/robert
--
ROBERT ADESAM, Systems and Research Engineer
Department of Philosophy, Linguistics, and Theory of Science
UNIVERSITY OF GOTHENBURG
Phone +46 (0)31 786 6336 | Email ***@gu.se
Continue reading on narkive:
Loading...