From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Integration of Org mode with Mairix: org-mairix.el Date: Wed, 26 Sep 2007 16:50:42 +0200 Message-ID: <87wsudv5tp.fsf@bzg.ath.cx> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IaYDz-0001sZ-AH for emacs-orgmode@gnu.org; Wed, 26 Sep 2007 10:50:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IaYDy-0001qs-9T for emacs-orgmode@gnu.org; Wed, 26 Sep 2007 10:50:50 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IaYDy-0001qW-2v for emacs-orgmode@gnu.org; Wed, 26 Sep 2007 10:50:50 -0400 Received: from ug-out-1314.google.com ([66.249.92.170]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IaYDx-00069K-EG for emacs-orgmode@gnu.org; Wed, 26 Sep 2007 10:50:49 -0400 Received: by ug-out-1314.google.com with SMTP id m4so1323744uge for ; Wed, 26 Sep 2007 07:50:48 -0700 (PDT) In-Reply-To: (Georg C. F. Greve's message of "Wed, 26 Sep 2007 15:45:04 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= "Georg C. F. Greve" 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! --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=org-mairix.patch 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--