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.
This commit is contained in:
Suvayu Ali 2014-07-16 18:08:36 +02:00 committed by Bastien Guerry
parent d4799ebfc1
commit e6f2e8fe88
1 changed files with 25 additions and 2 deletions

View File

@ -41,6 +41,29 @@
(require 'org) (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 ;; Install the link type
(org-add-link-type "notmuch" 'org-notmuch-open) (org-add-link-type "notmuch" 'org-notmuch-open)
(add-hook 'org-store-link-functions 'org-notmuch-store-link) (add-hook 'org-store-link-functions 'org-notmuch-store-link)
@ -62,7 +85,7 @@
(defun org-notmuch-open (path) (defun org-notmuch-open (path)
"Follow a notmuch message link specified by 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) (defun org-notmuch-follow-link (search)
"Follow a notmuch link to 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) (defun org-notmuch-search-open (path)
"Follow a notmuch message link specified by PATH." "Follow a notmuch message link specified by PATH."
(message path) (message path)
(org-notmuch-search-follow-link path)) (funcall org-notmuch-search-open-function path))
(defun org-notmuch-search-follow-link (search) (defun org-notmuch-search-follow-link (search)
"Follow a notmuch link by displaying SEARCH in notmuch-search mode." "Follow a notmuch link by displaying SEARCH in notmuch-search mode."