emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: emacs-orgmode@gnu.org
Subject: Re: Integration of Org mode with Mairix: org-mairix.el
Date: Wed, 26 Sep 2007 16:50:42 +0200	[thread overview]
Message-ID: <87wsudv5tp.fsf@bzg.ath.cx> (raw)
In-Reply-To: <m31wclzgkf.fsf@cerebro.fsfeurope.org> (Georg C. F. Greve's message of "Wed, 26 Sep 2007 15:45:04 +0200")

[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]

"Georg C. F. Greve" <greve@fsfeurope.org> 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!


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

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

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
Bastien

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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	other threads:[~2007-09-26 14:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-26 13:45 Integration of Org mode with Mairix: org-mairix.el Georg C. F. Greve
2007-09-26 14:50 ` Bastien [this message]
2007-09-26 22:30   ` Georg C. F. Greve
2008-02-07 11:41 ` Carsten Dominik
2008-02-10 11:56   ` Adam Spiers
2008-02-10 19:59     ` Bastien Guerry
2008-02-11  7:12       ` Gijs Hillenius
2008-02-11  7:19         ` cezar
2008-02-17 17:36           ` Adam Spiers
2008-02-17 20:59             ` Cezar Halmagean
2008-02-17 21:34               ` Adam Spiers
2008-02-17 21:51                 ` Cezar Halmagean
2008-02-18 12:32                 ` Jürgen Doser
2008-02-18 16:02                   ` Adam Spiers
2008-02-18 16:50                     ` Jürgen Doser
2008-05-22  9:49     ` Dan Davison
2008-05-25 19:24       ` Cezar Halmagean
2008-05-25 19:39         ` Gour
2008-05-27 21:33         ` Adam Spiers

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=87wsudv5tp.fsf@bzg.ath.cx \
    --to=bzg@altern.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).