emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Georg C. F. Greve" <greve@fsfeurope.org>
To: emacs-orgmode@gnu.org
Cc: info@hillenius.net
Subject: Re: Integration of Org mode and mairix
Date: Mon, 23 Jul 2007 01:15:31 +0200	[thread overview]
Message-ID: <m3sl7gxc6k.fsf@cerebro.fsfeurope.org> (raw)
In-Reply-To: <20070720160833.GD28297@atlantic.linksys.moosehall> (Adam Spiers's message of "Fri, 20 Jul 2007 17:08:33 +0100")


[-- Attachment #1.1.1: Type: text/plain, Size: 658 bytes --]

On Fri, 20 Jul 2007 17:08:33 +0100
Adam Spiers <orgmode@adamspiers.org> wrote: 

 as> Funnily enough, I implemented exactly this idea about 15 months
 as> ago, except that my implementation uses mairix (the mail indexer),
 as> and is mode-agnostic.

Thanks a lot, this is most interesting and put me on the right track.

Combining your work with that of Guy Hillenius, which he blogged at
http://www.hillenius.net/node/44 I integrated Gnus, Mairix & Org now.

The core is a patch for org.el -- this patch is still somewhat
primitive, but should not break anything and unless the new variables
are changed will not change standard behaviour:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: org.mairix.patch --]
[-- Type: text/x-diff, Size: 3529 bytes --]

--- org.el.orig	2007-07-22 13:52:40.000000000 +0200
+++ org.el	2007-07-22 17:44:51.000000000 +0200
@@ -1100,6 +1100,18 @@ negates this setting for the duration of
   :group 'org-link-store
   :type 'boolean)
 
+(defcustom org-gnus-links-prefer-mairix nil
+  "Non-nil means, `org-store-link' will create links to Mairix searches for gnus.
+When nil, traditional Gnus links (group & article) will be used for such links."
+  :group 'org-link-store
+  :type 'boolean)
+
+(defcustom org-mairix-links-prefer-threaded nil
+  "Non-nil means, that links to Mairix searches will be stored as thread searches.
+   When nil, the links to Mairix searches will be stored as single message searches."
+  :group 'org-link-store
+  :type 'boolean)
+
 (defgroup org-link-follow nil
   "Options concerning following links in Org-mode"
   :tag "Org Follow Link"
@@ -4141,7 +4153,7 @@ that will be added to PLIST.  Returns th
 
 (defconst org-non-link-chars "]\t\n\r<>")
 (defconst org-link-types '("http" "https" "ftp" "mailto" "file" "news" "bbdb" "vm"
-			   "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp"))
+			   "wl" "mhe" "rmail" "mairix" "mairixt" "gnus" "shell" "info" "elisp"))
 (defconst org-link-re-with-space
   (concat
    "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
@@ -10537,14 +10549,18 @@ For file links, arg negates `org-context
 	(org-store-link-props :type "gnus" :from from :subject subject
 			      :message-id message-id :group group)
 	(setq cpltxt (org-email-link-description))
-	(if (org-xor arg org-usenet-links-prefer-google)
-	    (setq link
-		  (concat
-		   cpltxt "\n  "
-		   (format "http://groups.google.com/groups?as_umsgid=%s"
-			   (org-fixup-message-id-for-http message-id))))
-	  (setq link (org-make-link "gnus:" group
-				    "#" (number-to-string article))))))
+	(if org-gnus-links-prefer-mairix
+	    (if org-mairix-links-prefer-threaded
+		(setq link (org-make-link "mairixt:m:" (substring message-id 1 -1)))
+	      (setq link (org-make-link "mairix:m:" (substring message-id 1 -1))))
+	  (if (org-xor arg org-usenet-links-prefer-google)
+	      (setq link
+		    (concat
+		     cpltxt "\n  "
+		     (format "http://groups.google.com/groups?as_umsgid=%s"
+			     (org-fixup-message-id-for-http message-id))))
+	    (setq link (org-make-link "gnus:" group
+				    "#" (number-to-string article)))))))
 
      ((eq major-mode 'w3-mode)
       (setq cpltxt (url-view-url t)
@@ -11105,6 +11121,12 @@ optional argument IN-EMACS is non-nil, E
        ((string= type "news")
 	(org-follow-gnus-link path))
 
+       ((string= type "mairix")
+	(org-follow-mairix-link path))
+
+       ((string= type "mairixt")
+	(org-follow-mairix-link-thread path))
+
        ((string= type "bbdb")
 	(org-follow-bbdb-link path))
 
@@ -11473,6 +11495,17 @@ onto the ring."
           (Info-find-node (match-string 1 name) "Top")))
     (message (concat "Could not open: " name))))
 
+; the following two org-follow-mairix functions should be generalised 
+; to deal with the different mail readers, right now they simply hook
+; into some primitive gnus glue
+(defun org-follow-mairix-link (string)
+  "Follow a Mairix link to its string."
+  (mairix-search string))
+
+(defun org-follow-mairix-link-thread (string)
+  "Follow a Mairix link to its string."
+  (mairix-search-thread string))
+
 (defun org-follow-gnus-link (&optional group article)
   "Follow a Gnus link to GROUP and ARTICLE."
   (require 'gnus)

[-- Attachment #1.1.3: Type: text/plain, Size: 148 bytes --]


But if someone feels like improving this so it can go into mainstream
org.el, that would be great.

Right now it needs some glue in your .gnus.el


[-- Attachment #1.1.4: Type: application/emacs-lisp, Size: 1684 bytes --]

[-- Attachment #1.1.5: Type: text/plain, Size: 125 bytes --]


and you should configure .mairixrc to store its search results where
Gnus stores its nnmaildir data. Mine looks like this:


[-- Attachment #1.1.6: Type: text/plain, Size: 175 bytes --]

base=/home/greve
mbox=Archive/Mail/Auto/incoming/????-??:Archive/Mail/Auto/outgoing/????-??
mformat=maildir
mfolder=.nnmaildir/mairix
database=/home/greve/Tools/Gnus/MairixDB

[-- Attachment #1.1.7: Type: text/plain, Size: 1208 bytes --]


With this you can store Org links as mairix links, including the
possibility to store links to emails that will pull the entire thread
that contains this message into the temporary buffer -- so you'll only
need to link to one and always get the entire thread.

For convenience it also makes sense to define some key bindings.

This gives as much functionality as "normal" Gnus integration otherwise,
although now it is no longer needed to know WHERE things are stored, as
mairix will find it regardless of final location.

So this solves the most urgent problem for me with the old Gnus links
and will hopefully be useful for some others, too.

On top of this some more sophisticated integration might be set up,
although http://thread.gmane.org/gmane.emacs.orgmode/1771 does not
really help me too much, as I have multiple agenda files in which I like
to store things.

Regards,
Georg

-- 
Georg C. F. Greve                                 <greve@fsfeurope.org>
Free Software Foundation Europe	                 (http://fsfeurope.org)
Join the Fellowship and protect your freedom!     (http://www.fsfe.org)
What everyone should know about DRM                   (http://DRM.info)

[-- Attachment #1.2: Type: application/pgp-signature, Size: 306 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2007-07-22 23:21 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-17 19:22 Integration of Org mode and Gnus Georg C. F. Greve
2007-07-18  0:22 ` Jason F. McBrayer
2007-07-18  8:03   ` Georg C. F. Greve
2007-07-18 10:04     ` Bastien
2007-07-18 10:29       ` Georg C. F. Greve
2007-07-20 16:08         ` Integration of Org mode and mairix (was: ... and Gnus) Adam Spiers
2007-07-22 23:15           ` Georg C. F. Greve [this message]
2007-07-23  2:24             ` Is it any function similar to appoinment alert in the planner mode? brianjiang
2007-07-23 12:38               ` Bernt Hansen
2007-07-25 19:15               ` Bastien Guerry
2007-07-26  7:23                 ` Bastien
2007-07-27  5:17                   ` brianjiang
2007-08-07  0:05                   ` Bastien
2007-08-07 17:13                     ` Bastien
2007-08-21  2:37                     ` william
2007-07-24 14:38             ` Integration of Org mode and mairix Bastien
2007-07-30 14:02               ` Georg C. F. Greve
2007-07-30 16:02                 ` Bastien
2007-07-30 16:31                   ` Leo
2007-07-30 17:26                     ` Bastien
2007-08-05  1:32                       ` Xiao-Yong Jin
2007-07-31 15:52                   ` Jason F. McBrayer
2007-07-31 16:56                   ` Xiao-Yong Jin
2007-07-31 17:19                     ` Georg C. F. Greve
2007-08-05  1:40                       ` Xiao-Yong Jin
2007-07-31 18:43                     ` Bastien
2007-08-01 14:52                       ` Jason F. McBrayer
2007-08-01 16:59                         ` Bastien
2007-08-05  1:44                         ` Xiao-Yong Jin
2007-08-05 10:20                           ` Georg C. F. Greve
2007-08-07 17:54                             ` Bastien
2007-08-10  6:56                               ` Carsten Dominik
2007-08-14 11:29                                 ` Adam Spiers
2007-08-15 17:46                                   ` Carsten Dominik
2007-08-21 12:38                                   ` Carsten Dominik
2007-08-14 22:54                                 ` Steven Lumos
2007-08-15 17:46                                   ` Carsten Dominik
2007-08-16 18:48                                     ` Steven Lumos
2007-09-23 15:44                                 ` Georg C. F. Greve
2007-09-23 18:12                                   ` Carsten Dominik
2007-09-23 21:50                                     ` Georg C. F. Greve
2007-09-23 22:05                                       ` Carsten Dominik
2007-09-24 17:38                                         ` Georg C. F. Greve
2007-09-25 14:41                                           ` Carsten Dominik
2007-09-25 22:25                                             ` Georg C. F. Greve
2007-09-25 22:38                                               ` Carsten Dominik
2007-07-18 11:04       ` Integration of Org mode and Gnus Jason F. McBrayer
2007-07-18 12:01         ` Bastien
2007-07-18 12:57           ` Jason F. McBrayer
2007-07-18 13:08           ` Georg C. F. Greve
2007-07-18 15:39             ` Bastien
2007-07-18 19:39               ` Georg C. F. Greve
2007-07-18 22:06                 ` Bastien
2007-07-19 15:29                   ` Georg C. F. Greve
2007-07-18 21:54               ` Carsten Dominik
2007-07-19 15:41                 ` Bastien
2007-07-18 10:20     ` Tassilo Horn
2007-07-18 10:35       ` Georg C. F. Greve
2007-07-18 11:55         ` Tassilo Horn
2007-07-18 12:25           ` Georg C. F. Greve
2007-07-18 12:54             ` Tassilo Horn
2007-07-18 13:18               ` Georg C. F. Greve
2007-07-18 13:32                 ` Tassilo Horn
2007-07-18  0:55 ` Bastien
2007-07-18  7:53   ` Georg C. F. Greve

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3sl7gxc6k.fsf@cerebro.fsfeurope.org \
    --to=greve@fsfeurope.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=info@hillenius.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).