"Georg C. F. Greve" <[EMAIL PROTECTED]> writes:

> I've taken a little bit of time to clean up the integration of Mairix
> with Org.

Great!

> The weakest point right now is the selection of the Gnus group upon
> matching, as I am still looking for a way to do this in Gnus that will
> not generate zombies.

Please have a look at the patch below and tell me if it solves the issue
above. Look for the small FIXME: (bzg) cookies in the patch.

> But overall I'm quite happy now: By default, this will pull an entire
> thread into the search group and automatically select the mail that
> was linked to.

BTW, this might be just personal taste, but I would prefer a shorter
syntax for thread searches (like mairix:t).  

Right now " --thread" in the link is converted as "%20--thread" and this
is not parsed by the (split-string ... " ") part of your code.

> Please test, help debug and extend. I don't have the time to maintain
> this actively, but would be happy if people found it useful.

This *is* definitely very useful!

diff -u /home/guerry/elisp/testing/org-mairix.el /home/guerry/elisp/testing/bzg/org-mairix.el
--- /home/guerry/elisp/testing/org-mairix.el	2007-09-26 16:45:30.000000000 +0200
+++ /home/guerry/elisp/testing/bzg/org-mairix.el	2007-09-26 16:43:03.000000000 +0200
@@ -35,31 +35,31 @@
 
 (defcustom org-mairix-threaded-links t
   "Should new links be created as threaded links?
-   If t, links will be stored as threaded searches.
-   If nil, links will be stored as non-threaded searches."
+If t, links will be stored as threaded searches.
+If nil, links will be stored as non-threaded searches."
   :group 'org-mairix
   :type 'boolean)
 
 (defcustom org-mairix-augmented-links nil
   "Should new links be created as augmenting searches?
-   If t, links will be stored as augmenting searches.
-   If nil, links will be stored as normal searches.
+If t, links will be stored as augmenting searches.
+If nil, links will be stored as normal searches.
 
-   Attention: When activating this option, you will need
-   to remove old articles from your mairix results group
-   in some other way, mairix will not do it for you."
+Attention: When activating this option, you will need
+to remove old articles from your mairix results group
+in some other way, mairix will not do it for you."
   :group 'org-mairix
   :type 'boolean)
 
 (defcustom org-mairix-display-hook 'org-mairix-gnus-display-results
   "Hook to call to display the results of a successful mairix search.
-   Defaults to Gnus, feel free to add your own MUAs or methods."
+Defaults to Gnus, feel free to add your own MUAs or methods."
   :group 'org-mairix
   :type 'hook)
 
 (defcustom org-mairix-executable "mairix"
   "The mairix executable to call. If your paths are set up
-   correctly, you should not need to change this."
+correctly, you should not need to change this."
   :group 'org-mairix
   :type 'string)
 
@@ -70,8 +70,8 @@
 
 (defcustom org-mairix-gnus-results-group "nnmaildir:mairix"
   "The group that is configured to hold the mairix search results,
-   which needs to be setup independently of the org-mairix integration,
-   along with general mairix configuration."
+which needs to be setup independently of the org-mairix integration,
+along with general mairix configuration."
   :group 'org-mairix-gnus
   :type 'string)
 
@@ -85,7 +85,8 @@
 ;;; Generic org-mairix functions
 
 (defun org-mairix-store-link ()
-  "Store a link to the current message as a Mairix search for its Message ID."
+  "Store a link to the current message as a Mairix search for its
+Message ID."
 
   ;; gnus integration
   (when (memq major-mode '(gnus-summary-mode gnus-article-mode))
@@ -94,10 +95,11 @@
 	   (header (gnus-summary-article-header article))
 	   (from (mail-header-from header))
 	   (message-id (mail-header-id header))
-	   (date (mail-header-date header))
+	   ;; FIXME: (bzg) we don't need the date
+	   (date (mail-header-date header)) 
 	   (subject (gnus-summary-subject-string)))
       (org-store-link-props :type "mairix" :from from :subject subject
-			    :message-id message-id )
+			    :message-id message-id)
       (setq cpltxt (org-email-link-description))
       (org-store-link-props :link (concat "mairix:" (org-remove-angle-brackets message-id)
 					  (if org-mairix-threaded-links " --thread")
@@ -107,11 +109,12 @@
 (defun org-mairix-open (path)
   "Function to open mairix link.
 
-   We first need to split it into its individual parts, and then extract the
-   message-id to be passed on to the display function before call mairix, evaluate
-   the number of matches returned, and make sure to only call display of mairix
-   succeeded in matching."
-
+We first need to split it into its individual parts, and then
+extract the message-id to be passed on to the display function
+before call mairix, evaluate the number of matches returned, and
+make sure to only call display of mairix succeeded in matching."
+  ;; FIXME (bzg) mhh... better use let* construct for arguments,
+  ;; message-id and cmdline.
   (setq arguments (split-string path " "))
   (setq message-id (pop arguments))
   (setq cmdline org-mairix-executable)
@@ -132,21 +135,23 @@
 (defun org-mairix-gnus-display-results (message-id)
   "Display results of mairix search in Gnus.
 
-   Note: This does not work as cleanly as I would like it to. The
-   problem being that Gnus should simply reread the group cleanly,
-   without remembering anything. At the moment it seems to be unable
-   to do that -- so you're likely to see zombies floating around.
+Note: This does not work as cleanly as I would like it to. The
+problem being that Gnus should simply reread the group cleanly,
+without remembering anything. At the moment it seems to be unable
+to do that -- so you're likely to see zombies floating around.
 
-   Gnus developers couldn't really help, see:
-    http://article.gmane.org/gmane.emacs.gnus.general/65248
+Gnus developers couldn't really help, see:
+http://article.gmane.org/gmane.emacs.gnus.general/65248
 
-   If you can improve this, please do!"
+If you can improve this, please do!"
   (require 'gnus)
   (require 'gnus-sum)
-  (gnus-group-quick-select-group 0 org-mairix-gnus-results-group)
-  (gnus-summary-reselect-current-group t t)
-  (gnus-summary-select-article nil t t
-			       (car (gnus-find-matching-articles "message-id" message-id))))
+  ;;FIXME (bzg) we need to call Gnus first, don't we?
+  (funcall (cdr (assq 'gnus org-link-frame-setup)))
+  (gnus-group-read-group t nil mairix-gnus-results-group)
+  (gnus-summary-select-article 
+   nil t t (car (gnus-find-matching-articles "message-id" message-id))))
 
 (provide 'org-mairix)
+
 ;;; org-mairix.el ends here

Diff finished.  Wed Sep 26 16:46:10 2007
-- 
Bastien
_______________________________________________
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

Reply via email to