emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Notmuch: An emacs interface for fast global search and tagging of email
@ 2009-11-18 10:54 Carl Worth
  2009-11-18 13:16 ` Giovanni Ridolfi
  0 siblings, 1 reply; 16+ messages in thread
From: Carl Worth @ 2009-11-18 10:54 UTC (permalink / raw)
  To: emacs-orgmode

Hello org-mode folks,

I'm a person that has "lived" inside of emacs for a long time. Someeon
just pointed out org-mode to me, and I'll definitely be taking a closer
look. It looks like something that could be very useful to me.

The motivation for someone to point out org-mode to me was that I've
recently written notmuch, which provides an emacs interface for fast
global search and tagging of large email collections.

The idea is that maybe org-mode users would like to be able to reference
email messages for todo items, etc. and that perhaps integrating with
notmuch would make sense.

If any of you want to take a look and see what you think, the code is
all here:

	http://notmuchmail.org

Thanks for your time,

-Carl

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Notmuch: An emacs interface for fast global search and tagging of email
  2009-11-18 10:54 Notmuch: An emacs interface for fast global search and tagging of email Carl Worth
@ 2009-11-18 13:16 ` Giovanni Ridolfi
  2009-11-18 14:13   ` Jan Janak
  0 siblings, 1 reply; 16+ messages in thread
From: Giovanni Ridolfi @ 2009-11-18 13:16 UTC (permalink / raw)
  To: emacs-orgmode, Carl Worth

--- Mer 18/11/09, Carl Worth <cworth@cworth.org> ha scritto:
> The idea is that maybe org-mode users would like to be able
> to reference
> email messages for todo items, etc. and that perhaps
> integrating with notmuch would make sense.

well in Org-mode is it already possible to have links 
to "mails" e.g.:

     mailto:adent@galaxy.net                   Mail link
     vm:folder                                 VM folder link
     vm:folder#id                              VM message link
     vm://myself@some.where.org/folder#id      VM on remote machine
     wl:folder                                 WANDERLUST folder link
     wl:folder#id                              WANDERLUST message link
     mhe:folder                                MH-E folder link
     mhe:folder#id                             MH-E message link
     rmail:folder                              RMAIL folder link
     rmail:folder#id                           RMAIL message link
     gnus:group                                Gnus group link
     gnus:group#id                             Gnus article link 
(Manual: 4.3 External links)

By the way, does  notmuch depend on Xapian?

cheers,
Giovanni




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Notmuch: An emacs interface for fast global search and tagging of email
  2009-11-18 13:16 ` Giovanni Ridolfi
@ 2009-11-18 14:13   ` Jan Janak
  2009-11-18 16:39     ` Tassilo Horn
  2009-11-18 17:39     ` Carsten Dominik
  0 siblings, 2 replies; 16+ messages in thread
From: Jan Janak @ 2009-11-18 14:13 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: Carl Worth, emacs-orgmode

On Wed, Nov 18, 2009 at 2:16 PM, Giovanni Ridolfi
<giovanni.ridolfi@yahoo.it> wrote:
> --- Mer 18/11/09, Carl Worth <cworth@cworth.org> ha scritto:
>> The idea is that maybe org-mode users would like to be able
>> to reference
>> email messages for todo items, etc. and that perhaps
>> integrating with notmuch would make sense.
>
> well in Org-mode is it already possible to have links
> to "mails" e.g.:
>
>     mailto:adent@galaxy.net                   Mail link
>     vm:folder                                 VM folder link
>     vm:folder#id                              VM message link
>     vm://myself@some.where.org/folder#id      VM on remote machine
>     wl:folder                                 WANDERLUST folder link
>     wl:folder#id                              WANDERLUST message link
>     mhe:folder                                MH-E folder link
>     mhe:folder#id                             MH-E message link
>     rmail:folder                              RMAIL folder link
>     rmail:folder#id                           RMAIL message link
>     gnus:group                                Gnus group link
>     gnus:group#id                             Gnus article link
> (Manual: 4.3 External links)

Notmuch goes beyond what the links above can do. Having your mail
indexed with notmuch is kind of like having your own local copy of
gmail with its powerful search options.

If integrated properly with org-mode, we could refer to one particular
message using its message-id (regardless of the folder/directory it is
in), we could refer to whole threads. And when new messages in the
thread arrive, notmuch updates the thread automatically and you will
see everything when you activate the link.

Another interesting possibility would be adding support for notmuch
search strings to org-mode, so that you could do something like:
"notmuch:foo bar" and when you activate the link, a list of messages
that contain the text would show up in a notmuch buffer.

And so on. Notmuch is currently in very early stage, but I think it
has the potential to become a perfect complement for org-mode.

With support for full-text search in local email archives, org-mode
will be even harder to beat than it is now ;).

> By the way, does  notmuch depend on Xapian?

Yes.

  -- Jan

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Notmuch: An emacs interface for fast global search and tagging of email
  2009-11-18 14:13   ` Jan Janak
@ 2009-11-18 16:39     ` Tassilo Horn
  2009-11-18 17:39     ` Carsten Dominik
  1 sibling, 0 replies; 16+ messages in thread
From: Tassilo Horn @ 2009-11-18 16:39 UTC (permalink / raw)
  To: emacs-orgmode

Jan Janak <jan@ryngle.com> writes:

Hi Jan,

>>     gnus:group                                Gnus group link
>>     gnus:group#id                             Gnus article link
>> (Manual: 4.3 External links)
>
> Notmuch goes beyond what the links above can do. Having your mail
> indexed with notmuch is kind of like having your own local copy of
> gmail with its powerful search options.

Hm, currently I use a local dovecot imap server for storing all my mails
and use Gnus' nnir to search using the dovecot full text search (it
indexes automatically).

This works pretty good, but the nnir interface or imap search in general
is not so advanced, and possibly I could do better querying with
notmuch.  Since dovecot runs local, all the mails are local, too, and I
could index them with notmuch.  But some questions come in mind:

1. Does notmuch require some special mailbox format?

   I use dovecot's dbox format, which is somehow similar to Maildir (one
   file per message), but there are some special lines with escape chars
   like ^A, ^B, ^C.

2. Is there a way to search for an article with notmuch, read id there
   and then get into Gnus' summary buffer with this article opened, so
   that I can reply?

   What I basically need for that was an easy way to extract the
   message-id and the mail file's path.

3. Does the underlying indexing tool somehow recognize new messages and
   index them on the fly, so that the index is always up to date?

Bye,
Tassilo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Notmuch: An emacs interface for fast global search and tagging of email
  2009-11-18 14:13   ` Jan Janak
  2009-11-18 16:39     ` Tassilo Horn
@ 2009-11-18 17:39     ` Carsten Dominik
  2009-11-19  0:12       ` Carl Worth
  1 sibling, 1 reply; 16+ messages in thread
From: Carsten Dominik @ 2009-11-18 17:39 UTC (permalink / raw)
  To: Jan Janak; +Cc: Carl Worth, emacs-orgmode

Hi,

this sounds interesting, but I'd like to know:
what is the difference with, for example mh-search, or mairix?

- Carsten

On Nov 18, 2009, at 3:13 PM, Jan Janak wrote:

> On Wed, Nov 18, 2009 at 2:16 PM, Giovanni Ridolfi
> <giovanni.ridolfi@yahoo.it> wrote:
>> --- Mer 18/11/09, Carl Worth <cworth@cworth.org> ha scritto:
>>> The idea is that maybe org-mode users would like to be able
>>> to reference
>>> email messages for todo items, etc. and that perhaps
>>> integrating with notmuch would make sense.
>>
>> well in Org-mode is it already possible to have links
>> to "mails" e.g.:
>>
>>     mailto:adent@galaxy.net                   Mail link
>>     vm:folder                                 VM folder link
>>     vm:folder#id                              VM message link
>>     vm://myself@some.where.org/folder#id      VM on remote machine
>>     wl:folder                                 WANDERLUST folder link
>>     wl:folder#id                              WANDERLUST message link
>>     mhe:folder                                MH-E folder link
>>     mhe:folder#id                             MH-E message link
>>     rmail:folder                              RMAIL folder link
>>     rmail:folder#id                           RMAIL message link
>>     gnus:group                                Gnus group link
>>     gnus:group#id                             Gnus article link
>> (Manual: 4.3 External links)
>
> Notmuch goes beyond what the links above can do. Having your mail
> indexed with notmuch is kind of like having your own local copy of
> gmail with its powerful search options.
>
> If integrated properly with org-mode, we could refer to one particular
> message using its message-id (regardless of the folder/directory it is
> in), we could refer to whole threads. And when new messages in the
> thread arrive, notmuch updates the thread automatically and you will
> see everything when you activate the link.
>
> Another interesting possibility would be adding support for notmuch
> search strings to org-mode, so that you could do something like:
> "notmuch:foo bar" and when you activate the link, a list of messages
> that contain the text would show up in a notmuch buffer.
>
> And so on. Notmuch is currently in very early stage, but I think it
> has the potential to become a perfect complement for org-mode.
>
> With support for full-text search in local email archives, org-mode
> will be even harder to beat than it is now ;).
>
>> By the way, does  notmuch depend on Xapian?
>
> Yes.
>
>  -- Jan
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Notmuch: An emacs interface for fast global search and  tagging of email
  2009-11-18 17:39     ` Carsten Dominik
@ 2009-11-19  0:12       ` Carl Worth
  2009-11-19 13:15         ` Carsten Dominik
                           ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Carl Worth @ 2009-11-19  0:12 UTC (permalink / raw)
  To: Carsten Dominik, Jan Janak; +Cc: emacs-orgmode

On Wed, 18 Nov 2009 18:39:03 +0100, Carsten Dominik <carsten.dominik@gmail.com> wrote:
> this sounds interesting, but I'd like to know:
> what is the difference with, for example mh-search, or mairix?

I'm not familiar with mh-search, so I can't comment there.

As for mairix, I think a big improvement that notmuch has is its search
syntax, (including phrase-based searching). With notmuch searches look
like this:

        notmuch search from:carsten.dominik and mairix
        notmuch search subject:"emacs interface" and "Carl Worth"
        notmuch search tag:important

Of course, that all falls out almost entirely due to just being based on
Xapian.

Mairix has the interesting mode of being able to deliver search results
as a maildir of symlinks. We might add something like that to notmuch.

Some things that notmuch has that mairix doesn't and that aren't related
just to general Xapian features:

  * A "notmuch show" command that does proper threading/nesting of
    messages.

  * The ability to add/remove arbitrary tags to any message and use them
    in search terms later.

  * An emacs interface to display search results, quickly filter search
    results by adding a term, display a thread from the search-results
    view, start composing a reply from a thread view, etc.

I haven't compared performance and scalability of mairix and notmuch.
And all of the above is just from my own recollection of using mairix
for a few months so I may have gotten some details wrong.

-Carl

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Notmuch: An emacs interface for fast global search and tagging of email
  2009-11-19  0:12       ` Carl Worth
@ 2009-11-19 13:15         ` Carsten Dominik
  2010-04-06  0:42           ` Updated patches for linking to notmuch mail from org David Bremner
                             ` (2 more replies)
  2009-11-19 14:26         ` Notmuch: An emacs interface for fast global search and tagging of email Richard Riley
  2009-12-05 16:40         ` David Bremner
  2 siblings, 3 replies; 16+ messages in thread
From: Carsten Dominik @ 2009-11-19 13:15 UTC (permalink / raw)
  To: Carl Worth; +Cc: emacs-orgmode

Well,

I think it would be useful to get support for this in Org-mode, so if  
someone would like to write the interface - please go ahead.

- Carsten

On Nov 19, 2009, at 1:12 AM, Carl Worth wrote:

> On Wed, 18 Nov 2009 18:39:03 +0100, Carsten Dominik <carsten.dominik@gmail.com 
> > wrote:
>> this sounds interesting, but I'd like to know:
>> what is the difference with, for example mh-search, or mairix?
>
> I'm not familiar with mh-search, so I can't comment there.
>
> As for mairix, I think a big improvement that notmuch has is its  
> search
> syntax, (including phrase-based searching). With notmuch searches look
> like this:
>
>        notmuch search from:carsten.dominik and mairix
>        notmuch search subject:"emacs interface" and "Carl Worth"
>        notmuch search tag:important
>
> Of course, that all falls out almost entirely due to just being  
> based on
> Xapian.
>
> Mairix has the interesting mode of being able to deliver search  
> results
> as a maildir of symlinks. We might add something like that to notmuch.
>
> Some things that notmuch has that mairix doesn't and that aren't  
> related
> just to general Xapian features:
>
>  * A "notmuch show" command that does proper threading/nesting of
>    messages.
>
>  * The ability to add/remove arbitrary tags to any message and use  
> them
>    in search terms later.
>
>  * An emacs interface to display search results, quickly filter search
>    results by adding a term, display a thread from the search-results
>    view, start composing a reply from a thread view, etc.
>
> I haven't compared performance and scalability of mairix and notmuch.
> And all of the above is just from my own recollection of using mairix
> for a few months so I may have gotten some details wrong.
>
> -Carl

- Carsten

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Notmuch: An emacs interface for fast global search and tagging of email
  2009-11-19  0:12       ` Carl Worth
  2009-11-19 13:15         ` Carsten Dominik
@ 2009-11-19 14:26         ` Richard Riley
  2009-12-05 16:40         ` David Bremner
  2 siblings, 0 replies; 16+ messages in thread
From: Richard Riley @ 2009-11-19 14:26 UTC (permalink / raw)
  To: emacs-orgmode

Carl Worth <cworth@cworth.org> writes:

> On Wed, 18 Nov 2009 18:39:03 +0100, Carsten Dominik <carsten.dominik@gmail.com> wrote:
>> this sounds interesting, but I'd like to know:
>> what is the difference with, for example mh-search, or mairix?
>
> I'm not familiar with mh-search, so I can't comment there.
>
> As for mairix, I think a big improvement that notmuch has is its search
> syntax, (including phrase-based searching). With notmuch searches look
> like this:
>
>         notmuch search from:carsten.dominik and mairix
>         notmuch search subject:"emacs interface" and "Carl Worth"
>         notmuch search tag:important
>
> Of course, that all falls out almost entirely due to just being based on
> Xapian.
>
> Mairix has the interesting mode of being able to deliver search results
> as a maildir of symlinks. We might add something like that to notmuch.
>
> Some things that notmuch has that mairix doesn't and that aren't related
> just to general Xapian features:
>
>   * A "notmuch show" command that does proper threading/nesting of
>     messages.
>
>   * The ability to add/remove arbitrary tags to any message and use them
>     in search terms later.
>
>   * An emacs interface to display search results, quickly filter search
>     results by adding a term, display a thread from the search-results
>     view, start composing a reply from a thread view, etc.
>
> I haven't compared performance and scalability of mairix and notmuch.
> And all of the above is just from my own recollection of using mairix
> for a few months so I may have gotten some details wrong.
>

<OT for org-mode>

I just thought (for completeness) I might mention Dovecot IMAP indexing
at this stage since I know a good few here use gnus and IMAP : thanks to
Tassilo Horn for the heads up about it. My select element is:-

       gnus-select-method '(nnimap "mymail"
				   (nnimap-stream tls)
				   (nnimap-authinfo-file "~/.authinfo.gpg")
				   (nnimap-address "my-server.net")
				   (nnimap-expunge-on-close always)
				   (nnimap-nov-is-evil nil)
				   (nnir-search-engine imap))

Note the nnir-search component.

Then a key to control it:-

     ;; Fast index based mail search on nnmairix server.
     (define-key gnus-group-mode-map (kbd "<f3>")
     'gnus-group-make-nnir-group)

And finally the Dovecot config  (/etc/dovecot/dovecot.conf):-

    protocol imap {
      mail_plugins = fts fts_squat
      listen = *:143
      ssl_listen = *:993
    }

    plugin {
     fts = squat
     fts_squat = partial=4 full=10
    }

It will index when you first search that group.

regards

r.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Notmuch: An emacs interface for fast global search and tagging of email
  2009-11-19  0:12       ` Carl Worth
  2009-11-19 13:15         ` Carsten Dominik
  2009-11-19 14:26         ` Notmuch: An emacs interface for fast global search and tagging of email Richard Riley
@ 2009-12-05 16:40         ` David Bremner
  2009-12-08 16:56           ` Carsten Dominik
  2 siblings, 1 reply; 16+ messages in thread
From: David Bremner @ 2009-12-05 16:40 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Carl Worth


For those of you interested in notmuch and org-mode, I have a
preliminary version of support for links from org-mode files to
notmuch.  Currently the following are working

* Supported by org-store-link
** Link to a thread
[[notmuch:thread:35471bef770cf624005d52a155bd140e][Email from Aneesh Kumar K. V.: {notmuch} {PATCH 1/2} notmuch-]]

** Link to a specific message
[[notmuch:id:87pr9724pv.fsf@fastmail.fm][Email from Matt Lundin: {Orgmode} Re: HTML export: How]]

* Manually created links
** Link to a tag search
   [[notmuch:tag:notmuch][Search notmuch about notmuch]]
** Link to an aritrary search
   [[notmuch:"Thisbe%20dog"][Search for "Thisby dog"]]

If you want to try it out, you need a recent org-mode, the file org-notmuch.el

   http://pivot.cs.unb.ca/git/?p=org-mode.git;a=blob_plain;f=lisp/org-notmuch.el;hb=notmuch-link

And a patched notmuch.el from

    http://pivot.cs.unb.ca/git/?p=notmuch.git;a=blob_plain;f=notmuch.el;hb=org-link

Of course you can just clone those two git repos if you want.

The org-mode side is still subject to change as Carl
merges/modifies/rejects my proposed patches to notmuch.

David

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Notmuch: An emacs interface for fast global search and tagging of email
  2009-12-05 16:40         ` David Bremner
@ 2009-12-08 16:56           ` Carsten Dominik
  0 siblings, 0 replies; 16+ messages in thread
From: Carsten Dominik @ 2009-12-08 16:56 UTC (permalink / raw)
  To: David Bremner; +Cc: Carl Worth, emacs-orgmode

Hi David,

please make sure to tell me when there is a final version of the stuff  
we should add to Org-mode.

Thanks!

- Carsten


On Dec 5, 2009, at 5:40 PM, David Bremner wrote:

>
> For those of you interested in notmuch and org-mode, I have a
> preliminary version of support for links from org-mode files to
> notmuch.  Currently the following are working
>
> * Supported by org-store-link
> ** Link to a thread
> [[notmuch:thread:35471bef770cf624005d52a155bd140e][Email from Aneesh  
> Kumar K. V.: {notmuch} {PATCH 1/2} notmuch-]]
>
> ** Link to a specific message
> [[notmuch:id:87pr9724pv.fsf@fastmail.fm][Email from Matt Lundin:  
> {Orgmode} Re: HTML export: How]]
>
> * Manually created links
> ** Link to a tag search
>   [[notmuch:tag:notmuch][Search notmuch about notmuch]]
> ** Link to an aritrary search
>   [[notmuch:"Thisbe%20dog"][Search for "Thisby dog"]]
>
> If you want to try it out, you need a recent org-mode, the file org- 
> notmuch.el
>
>   http://pivot.cs.unb.ca/git/?p=org-mode.git;a=blob_plain;f=lisp/org-notmuch.el;hb=notmuch-link
>
> And a patched notmuch.el from
>
>    http://pivot.cs.unb.ca/git/?p=notmuch.git;a=blob_plain;f=notmuch.el;hb=org-link
>
> Of course you can just clone those two git repos if you want.
>
> The org-mode side is still subject to change as Carl
> merges/modifies/rejects my proposed patches to notmuch.
>
> David
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Updated patches for linking to notmuch mail from org
  2009-11-19 13:15         ` Carsten Dominik
@ 2010-04-06  0:42           ` David Bremner
  2010-04-06 10:13             ` Carsten Dominik
  2010-04-06  0:42           ` [PATCH 1/2] Initial version of link support for the notmuch mail system David Bremner
  2010-04-06  0:42           ` [PATCH 2/2] Add org-notmuch.el to Makefile and to org-modules David Bremner
  2 siblings, 1 reply; 16+ messages in thread
From: David Bremner @ 2010-04-06  0:42 UTC (permalink / raw)
  To: emacs-orgmode

I'm happy to report that my patches for org-mode to support linking to
notmuch mail are usable with the current master branch of notmuch (as
of a few hours ago).  These have been tested for a while, but I think
only by me. I find them incredibly useful (well, I found the links to
Wanderlust very useful as well, but notmuch is much faster for various
reasons).

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] Initial version of link support for the notmuch mail system.
  2009-11-19 13:15         ` Carsten Dominik
  2010-04-06  0:42           ` Updated patches for linking to notmuch mail from org David Bremner
@ 2010-04-06  0:42           ` David Bremner
  2010-04-06  0:42           ` [PATCH 2/2] Add org-notmuch.el to Makefile and to org-modules David Bremner
  2 siblings, 0 replies; 16+ messages in thread
From: David Bremner @ 2010-04-06  0:42 UTC (permalink / raw)
  To: emacs-orgmode

It requires a version of notmuch from git after April 5 2010.  The
code here is based on org-wl.el. One thing to note is that links to
threads are faked as a collection of message ids. This is because
notmuch thread-ids are currently not stable between dump/restore of
the database.
---
 lisp/org-notmuch.el |   87 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 0 deletions(-)
 create mode 100644 lisp/org-notmuch.el

diff --git a/lisp/org-notmuch.el b/lisp/org-notmuch.el
new file mode 100644
index 0000000..82c31a5
--- /dev/null
+++ b/lisp/org-notmuch.el
@@ -0,0 +1,87 @@
+;;; org-notmuch.el --- Support for links to notmuch messages from within Org-mode
+;; Author: David Bremner <david@tethera.net>
+;; License: GPL3+
+;;; Commentary:
+
+;; This file implements links to notmuch messages from within Org-mode.
+;; Link types supported include 
+;; - notmuch:id:message-id
+;; - notmuch:show:search-terms
+;; - notmuch:search:search-terms
+;;
+;; The latter two pass the search terms to the corresponding notmuch-*
+;; function.  'id:' is an abbreviation for 'show:id:' search-terms is
+;; a space delimited list of notmuch search-terms.
+;;
+;; Currently storing links is supported in notmuch-search and
+;; notmuch-show mode.  It might make sense to support notmuch-folder
+;; mode too.  Because threads-ids are currently not save/restore safe,
+;; they are converted into a list of message-ids.
+;;
+;; Org-mode loads this module by default - if this is not what you want,
+;; configure the variable `org-modules'.
+;;; Code:
+
+;; Install the link type
+(org-add-link-type "notmuch" 'org-notmuch-open)
+(add-hook 'org-store-link-functions 'org-notmuch-store-link)
+
+;; Configuration
+(defvar org-notmuch-mid-limit 10
+  "Maximum number of message ids to store for a thread")
+
+;; Implementation
+(defun org-notmuch-store-link ()
+  "Store a link to the currently selected thread."
+  (require 'notmuch)
+  (when (memq major-mode '(notmuch-show-mode notmuch-search-mode))
+    (if (equal major-mode 'notmuch-search-mode)
+	(org-notmuch-do-store-link 
+	 (org-notmuch-build-thread-link)
+	 (notmuch-search-find-authors)
+	 (notmuch-search-find-subject))
+      (org-notmuch-do-store-link  (notmuch-show-get-message-id)
+				  (notmuch-show-get-from)
+				  (notmuch-show-get-subject)))))
+
+;; sigh. there doesn't seem to be such a function.
+(defun org-notmuch-n-first (list n)
+  (if (> n 0)
+      (cons (car list)
+	    (org-notmuch-n-first (cdr list) (1- n)))
+    nil))
+
+(defun org-notmuch-build-thread-link ()
+  "Expand the thread-id on the current line to a list of message-ids"
+  (require 'notmuch-query)
+  (let* ((current-thread (or (notmuch-search-find-thread-id) 
+			    (error "End of search results")))
+	 (message-ids 
+	  (org-notmuch-n-first 
+	   (notmuch-query-get-message-ids current-thread)
+	   org-notmuch-mid-limit)))
+    (concat "show:" 
+	    (mapconcat (lambda (id) (concat "id:" id)) message-ids " "))))
+
+(defun org-notmuch-do-store-link (id author subject)
+  (let ((link  (org-make-link "notmuch:" id)))
+    (org-store-link-props :type "notmuch" :from author :subject subject)
+    (org-add-link-props :link link :description (org-email-link-description))
+    link))
+
+
+(defun org-notmuch-open (link)
+  "Open a link with notmuch. id: or show: links are opened directly with notmuch-show
+otherwise notmuch-search is used to give an index view"
+  (require 'notmuch)
+  (cond 
+   ((string-match "^show:\\(.*\\)" link)
+    (notmuch-show (match-string 1 link)))
+   ((string-match "^search:\\(.*\\)" link)
+    (notmuch-search (match-string 1 link)))
+   ((string-match "^id:.*" link)
+    (notmuch-show link))
+   (t (notmuch-search link))))
+
+    
+(provide 'org-notmuch)
-- 
1.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] Add org-notmuch.el to Makefile and to org-modules.
  2009-11-19 13:15         ` Carsten Dominik
  2010-04-06  0:42           ` Updated patches for linking to notmuch mail from org David Bremner
  2010-04-06  0:42           ` [PATCH 1/2] Initial version of link support for the notmuch mail system David Bremner
@ 2010-04-06  0:42           ` David Bremner
  2 siblings, 0 replies; 16+ messages in thread
From: David Bremner @ 2010-04-06  0:42 UTC (permalink / raw)
  To: emacs-orgmode

---
 Makefile    |    1 +
 lisp/org.el |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 18b37d3..177139f 100644
--- a/Makefile
+++ b/Makefile
@@ -99,6 +99,7 @@ LISPF      = 	org.el			\
 		org-mhe.el		\
 		org-mobile.el		\
 		org-mouse.el		\
+		org-notmuch.el		\
 		org-publish.el		\
 		org-plot.el		\
 		org-protocol.el		\
diff --git a/lisp/org.el b/lisp/org.el
index 48ec349..a27b431 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -170,7 +170,7 @@ With prefix arg HERE, insert it at point."
   (let ((a (member 'org-infojs org-modules)))
     (and a (setcar a 'org-jsinfo))))
 
-(defcustom org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl)
+(defcustom org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl org-notmuch)
   "Modules that should always be loaded together with org.el.
 If a description starts with <C>, the file is not part of Emacs
 and loading it will require that you have downloaded and properly installed
@@ -201,6 +201,7 @@ to add the symbol `xyz', and the package must have a call to
 	(const :tag "   mac-message:       Links to messages in Apple Mail" org-mac-message)
 	(const :tag "   mew                Links to Mew folders/messages" org-mew)
 	(const :tag "   mhe:               Links to MHE folders/messages" org-mhe)
+	(const :tag "   notmuch:           Links to Notmuch threads/messages" org-notmuch)
 	(const :tag "   protocol:          Intercept calls from emacsclient" org-protocol)
 	(const :tag "   rmail:             Links to RMAIL folders/messages" org-rmail)
 	(const :tag "   vm:                Links to VM folders/messages" org-vm)
-- 
1.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: Updated patches for linking to notmuch mail from org
  2010-04-06  0:42           ` Updated patches for linking to notmuch mail from org David Bremner
@ 2010-04-06 10:13             ` Carsten Dominik
  2010-04-06 11:22               ` David Bremner
  0 siblings, 1 reply; 16+ messages in thread
From: Carsten Dominik @ 2010-04-06 10:13 UTC (permalink / raw)
  To: David Bremner; +Cc: emacs-orgmode

Hi David,

before we take this further, what is your copyright status with the FSF?

- Carsten

On Apr 6, 2010, at 2:42 AM, David Bremner wrote:

> I'm happy to report that my patches for org-mode to support linking to
> notmuch mail are usable with the current master branch of notmuch (as
> of a few hours ago).  These have been tested for a while, but I think
> only by me. I find them incredibly useful (well, I found the links to
> Wanderlust very useful as well, but notmuch is much faster for various
> reasons).
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Updated patches for linking to notmuch mail from org
  2010-04-06 10:13             ` Carsten Dominik
@ 2010-04-06 11:22               ` David Bremner
  2010-04-06 12:53                 ` Carsten Dominik
  0 siblings, 1 reply; 16+ messages in thread
From: David Bremner @ 2010-04-06 11:22 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

On Tue, 6 Apr 2010 12:13:48 +0200, Carsten Dominik <carsten.dominik@gmail.com> wrote:
> Hi David,
> 
> before we take this further, what is your copyright status with the FSF?
> 
> - Carsten

Some years ago (possible 20) I sent a copyright assignment for some
contributions to bookmark.el (see the comments therein), so it should be
OK. I don't know if there is some way to verify that is less work than
sending another assignment.

d

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Updated patches for linking to notmuch mail from org
  2010-04-06 11:22               ` David Bremner
@ 2010-04-06 12:53                 ` Carsten Dominik
  0 siblings, 0 replies; 16+ messages in thread
From: Carsten Dominik @ 2010-04-06 12:53 UTC (permalink / raw)
  To: David Bremner; +Cc: emacs-orgmode


On Apr 6, 2010, at 1:22 PM, David Bremner wrote:

> On Tue, 6 Apr 2010 12:13:48 +0200, Carsten Dominik <carsten.dominik@gmail.com 
> > wrote:
>> Hi David,
>>
>> before we take this further, what is your copyright status with the  
>> FSF?
>>
>> - Carsten
>
> Some years ago (possible 20) I sent a copyright assignment for some
> contributions to bookmark.el (see the comments therein), so it  
> should be
> OK. I don't know if there is some way to verify that is less work than
> sending another assignment.

Was this a past and future changes for Emacs assignment, or just for  
bookmark.el?

You can just ask at assign@gnu.org, they will tell you if they can  
find it :-)

- Carsten

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-04-06 12:53 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-18 10:54 Notmuch: An emacs interface for fast global search and tagging of email Carl Worth
2009-11-18 13:16 ` Giovanni Ridolfi
2009-11-18 14:13   ` Jan Janak
2009-11-18 16:39     ` Tassilo Horn
2009-11-18 17:39     ` Carsten Dominik
2009-11-19  0:12       ` Carl Worth
2009-11-19 13:15         ` Carsten Dominik
2010-04-06  0:42           ` Updated patches for linking to notmuch mail from org David Bremner
2010-04-06 10:13             ` Carsten Dominik
2010-04-06 11:22               ` David Bremner
2010-04-06 12:53                 ` Carsten Dominik
2010-04-06  0:42           ` [PATCH 1/2] Initial version of link support for the notmuch mail system David Bremner
2010-04-06  0:42           ` [PATCH 2/2] Add org-notmuch.el to Makefile and to org-modules David Bremner
2009-11-19 14:26         ` Notmuch: An emacs interface for fast global search and tagging of email Richard Riley
2009-12-05 16:40         ` David Bremner
2009-12-08 16:56           ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).