From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suvayu Ali Subject: [PATCH] New option for org-notmuch links Date: Wed, 16 Jul 2014 18:36:19 +0200 Message-ID: <20140716163619.GC2472@chitra.no-ip.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="8P1HSweYDcXXzwPJ" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7SBu-0000Nj-Dj for emacs-orgmode@gnu.org; Wed, 16 Jul 2014 12:36:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7SBt-0002cF-5D for emacs-orgmode@gnu.org; Wed, 16 Jul 2014 12:36:26 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:40894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7SBs-0002bn-Qx for emacs-orgmode@gnu.org; Wed, 16 Jul 2014 12:36:25 -0400 Received: by mail-wi0-f177.google.com with SMTP id ho1so1670459wib.10 for ; Wed, 16 Jul 2014 09:36:23 -0700 (PDT) Received: from chitra.no-ip.org ([2001:610:120:3001:2ad2:44ff:fe4a:b029]) by mx.google.com with ESMTPSA id w10sm10757561wie.22.2014.07.16.09.36.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jul 2014 09:36:21 -0700 (PDT) Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Emacs Org mode --8P1HSweYDcXXzwPJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, The latest version of notmuch (actually for quite a while now) ships with an alternate nicely threaded search interface called notmuch-tree. Earlier this was in contrib, but now it is part of core. So I thought it would be nice to use that to follow org-notmuch links. Attached are two patches: the first adds the customize options, the second provides a function that uses notmuch-tree to follow links. The defaults are set to the old behaviour, so this should not cause any surprises. I have done some light testing, and the patches seem to behave nicely. Cheers, -- Suvayu Open source is the future. It sets us free. --8P1HSweYDcXXzwPJ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-contrib-lisp-org-notmuch.el-customisable-notmuch-ope.patch" >From bf01edab91f50a6360e142a3762ad259e1db3f05 Mon Sep 17 00:00:00 2001 From: Suvayu Ali Date: Wed, 16 Jul 2014 18:08:36 +0200 Subject: [PATCH 1/2] contrib/lisp/org-notmuch.el: customisable notmuch open functions * contrib/lisp/org-notmuch.el: org-notmuch-open-function, org-notmuch-open-search-function: New defcustoms, can be used to set custom notmuch-open functions. --- contrib/lisp/org-notmuch.el | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/contrib/lisp/org-notmuch.el b/contrib/lisp/org-notmuch.el index 2ab5c17..e6dbfa6 100644 --- a/contrib/lisp/org-notmuch.el +++ b/contrib/lisp/org-notmuch.el @@ -41,6 +41,29 @@ (require 'org) +;; customisable notmuch open functions +(defcustom org-notmuch-open-function + 'org-notmuch-follow-link + "Function used to follow notmuch links. + +Should accept a notmuch search string as the sole argument." + :group 'org-notmuch + :version "24.4" + :package-version '(Org . "8.0") + :type 'function) + +(defcustom org-notmuch-search-open-function + 'org-notmuch-search-follow-link + "Function used to follow notmuch-search links. + +Should accept a notmuch search string as the sole argument." + :group 'org-notmuch + :version "24.4" + :package-version '(Org . "8.0") + :type 'function) + + + ;; Install the link type (org-add-link-type "notmuch" 'org-notmuch-open) (add-hook 'org-store-link-functions 'org-notmuch-store-link) @@ -62,7 +85,7 @@ (defun org-notmuch-open (path) "Follow a notmuch message link specified by PATH." - (org-notmuch-follow-link path)) + (funcall org-notmuch-open-function path)) (defun org-notmuch-follow-link (search) "Follow a notmuch link to SEARCH. @@ -91,7 +114,7 @@ Can link to more than one message, if so all matching messages are shown." (defun org-notmuch-search-open (path) "Follow a notmuch message link specified by PATH." (message path) - (org-notmuch-search-follow-link path)) + (funcall org-notmuch-search-open-function path)) (defun org-notmuch-search-follow-link (search) "Follow a notmuch link by displaying SEARCH in notmuch-search mode." -- 1.9.3 --8P1HSweYDcXXzwPJ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0002-contrib-lisp-org-notmuch.el-new-notmuch-open-functio.patch" >From 0aad539c541d4c17cd1ba2c414902a859419efee Mon Sep 17 00:00:00 2001 From: Suvayu Ali Date: Wed, 16 Jul 2014 18:17:56 +0200 Subject: [PATCH 2/2] contrib/lisp/org-notmuch.el: new notmuch open function * contrib/lisp/org-notmuch.el: org-notmuch-tree-follow-link: New function, can be used to follow notmuch or notmuch-search links. --- contrib/lisp/org-notmuch.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/lisp/org-notmuch.el b/contrib/lisp/org-notmuch.el index e6dbfa6..ae9b50b 100644 --- a/contrib/lisp/org-notmuch.el +++ b/contrib/lisp/org-notmuch.el @@ -121,6 +121,13 @@ Can link to more than one message, if so all matching messages are shown." (require 'notmuch) (notmuch-search (org-link-unescape search))) + + +(defun org-notmuch-tree-follow-link (search) + "Follow a notmuch link by displaying SEARCH in notmuch-tree mode." + (require 'notmuch) + (notmuch-tree (org-link-unescape search))) + (provide 'org-notmuch) ;;; org-notmuch.el ends here -- 1.9.3 --8P1HSweYDcXXzwPJ--