emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
To: Emacs Org mode <emacs-orgmode@gnu.org>
Subject: [PATCH] New option for org-notmuch links
Date: Wed, 16 Jul 2014 18:36:19 +0200	[thread overview]
Message-ID: <20140716163619.GC2472@chitra.no-ip.org> (raw)

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


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

I have done some light testing, and the patches seem to behave nicely.



Open source is the future. It sets us free.

[-- Attachment #2: 0001-contrib-lisp-org-notmuch.el-customisable-notmuch-ope.patch --]
[-- Type: text/plain, Size: 2176 bytes --]

From bf01edab91f50a6360e142a3762ad259e1db3f05 Mon Sep 17 00:00:00 2001
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
Date: Wed, 16 Jul 2014 18:08:36 +0200
Subject: [PATCH 1/2] contrib/lisp/org-notmuch.el: customisable notmuch open

* 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."

[-- Attachment #3: 0002-contrib-lisp-org-notmuch.el-new-notmuch-open-functio.patch --]
[-- Type: text/plain, Size: 1039 bytes --]

From 0aad539c541d4c17cd1ba2c414902a859419efee Mon Sep 17 00:00:00 2001
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
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

             reply	other threads:[~2014-07-16 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16 16:36 Suvayu Ali [this message]
2014-07-27 13:28 ` [PATCH] New option for org-notmuch links Bastien

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:

  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=20140716163619.GC2472@chitra.no-ip.org \
    --to=fatkasuvayu+linux@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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).