Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 99D29429E21 for ; Mon, 7 Feb 2011 13:06:35 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.011 X-Spam-Level: X-Spam-Status: No, score=0.011 tagged_above=-999 required=5 tests=[FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_MIME_NO_TEXT=0.01] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w4GR+FX-2mAE for ; Mon, 7 Feb 2011 13:06:35 -0800 (PST) Received: from smtp3-g21.free.fr (smtp3-g21.free.fr [212.27.42.3]) by olra.theworths.org (Postfix) with ESMTP id 0B1B8429E20 for ; Mon, 7 Feb 2011 13:06:33 -0800 (PST) Received: from racin (unknown [82.239.207.166]) by smtp3-g21.free.fr (Postfix) with ESMTP id F0721A622B for ; Mon, 7 Feb 2011 22:06:29 +0100 (CET) From: Matthieu Lemerre To: notmuch Subject: Org-mode support User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Mon, 07 Feb 2011 22:22:17 +0100 Message-ID: <87aai7k0ae.fsf@free.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Feb 2011 21:06:35 -0000 --=-=-= Hi everyone, I have written the org-mode support for notmuch a while ago. It allows to open links to notmuch from org-mode and create org-mode link from notmuch buffers. The current maintainer of the package is looking for feedback for inclusion of the package in the org-mode trunk, so if anyone is using org-mode, I think it would be a good idea to say so on the orgmode mailing list! I have attached the corresponding file. Matthieu --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=org-notmuch.el Content-Transfer-Encoding: quoted-printable ;;; org-notmuch.el --- Support for links to notmuch messages from within Or= g-mode ;; Copyright (C) 2010 Matthieu Lemerre ;; Author: Matthieu Lemerre ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This file is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: ;; This file implements links to notmuch messages and "searchs". A ;; search is a query to be performed by notmuch; it is the equivalent ;; to folders in other mail clients. Similarly, mails are refered to ;; by a query, so both a link can refer to several mails. ;; Links have one the following form ;; notmuch: ;; notmuch-search:.=20 ;; The first form open the queries in notmuch-show mode, whereas the ;; second link open it in notmuch-search mode. Note that queries are ;; performed at the time the link is opened, and the result may be ;; different from whet the link was stored. ;;; Code: ;; Install the link type (org-add-link-type "notmuch" 'org-notmuch-open) (add-hook 'org-store-link-functions 'org-notmuch-store-link) (defun org-notmuch-store-link () "Store a link to a notmuch search or message." (when (eq major-mode 'notmuch-show-mode) (let* ((message-id (notmuch-show-get-prop :id)) (subject (notmuch-show-get-subject)) (to (notmuch-show-get-to)) (from (notmuch-show-get-from)) desc link) (org-store-link-props :type "notmuch" :from from :to to :subject subject :message-id message-id) (setq desc (org-email-link-description)) (setq link (org-make-link "notmuch:" "id:" message-id)) (org-add-link-props :link link :description desc) link))) =20=20 (defun org-notmuch-open (path) "Follow a notmuch message link specified by PATH." (org-notmuch-follow-link path)) (defun org-notmuch-follow-link (search) "Follow a notmuch link to SEARCH.=20 Can link to more than one message, if so all matching messages are shown." (require 'notmuch) (notmuch-show (org-link-unescape search))) (org-add-link-type "notmuch-search" 'org-notmuch-search-open) (add-hook 'org-store-link-functions 'org-notmuch-search-store-link) (defun org-notmuch-search-store-link () "Store a link to a notmuch search or message." (when (eq major-mode 'notmuch-search-mode) (let ((link (org-make-link "notmuch-search:"=20 (org-link-escape notmuch-search-query-string))) (desc (concat "Notmuch search: " notmuch-search-query-string))) (org-store-link-props :type "notmuch-search"=20 :link link :description desc) link))) (defun org-notmuch-search-open (path) "Follow a notmuch message link specified by PATH." (message path) (org-notmuch-search-follow-link path)) (defun org-notmuch-search-follow-link (search) "Follow a notmuch link by displaying SEARCH in notmuch-search mode." (require 'notmuch) (notmuch-search (org-link-unescape search))) (provide 'org-notmuch) ;;; org-notmuch.el ends here --=-=-=--