emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Georg C. F. Greve" <greve@fsfeurope.org>
To: emacs-orgmode@gnu.org
Subject: Re: Integration of Org mode and mairix
Date: Tue, 31 Jul 2007 19:19:12 +0200	[thread overview]
Message-ID: <m3wswgze27.fsf@cerebro.fsfeurope.org> (raw)
In-Reply-To: <876440tsul.fsf@presario.homelinux.org> (Xiao-Yong Jin's message of "Tue, 31 Jul 2007 12:56:18 -0400")


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

On Tue, 31 Jul 2007 12:56:18 -0400
Xiao-Yong Jin <xj2106@columbia.edu> wrote: 

 xj> Sorry, but I missed the thread.  Where can I grab the code for
 xj> support in org-mode?

Since there were small changes, allow me to repost.

This is a patch against org.el that incorporates mairix into org.el:

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

--- org.el.orig	2007-07-22 13:52:40.000000000 +0200
+++ org.el	2007-07-30 15:45:10.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,23 @@ 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."
+  (require 'gnus)
+  (funcall (cdr (assq 'gnus org-link-frame-setup)))
+  (if gnus-other-frame-object (select-frame gnus-other-frame-object))
+  (mairix-search string))
+
+(defun org-follow-mairix-link-thread (string)
+  "Follow a Mairix link to its string."
+  (require 'gnus)
+  (funcall (cdr (assq 'gnus org-link-frame-setup)))
+  (if gnus-other-frame-object (select-frame gnus-other-frame-object))
+  (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: 175 bytes --]


The patch should be safe to apply in that it should not break anything.

For it to make sense you'll need to glue it into gnus with additional
code, here is the code I use:


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

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


Beware: This part is a cludge. It works for me, but YMMV.

It allows me to store links the normal way (C-c l) as mairix links and
insert them into my Org files normally (C-c C-l). I can also always
insert the latest SENT mail into my Org files by doing (C-c C-S-l).

Please consider all my stuff under GNU GPL v2 or later (v3 explicitly
allowed) so if someone wants to grab this and turn it into a "clean"
solution, that would be greatly appreciated.

Regards,
Georg


P.S. For completeness, and to make your life easier in trying this, this
is my .mairixrc file:

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

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

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


P.P.S. In theory you can also use other backends to access mairix search
results, but I found nnmaildir to be the fastest by far.

-- 
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-31 17:20 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           ` Integration of Org mode and mairix Georg C. F. Greve
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 [this message]
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=m3wswgze27.fsf@cerebro.fsfeurope.org \
    --to=greve@fsfeurope.org \
    --cc=emacs-orgmode@gnu.org \
    /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).