diff options
author | Pierre Neidhardt <mail@ambrevar.xyz> | 2019-04-09 19:15:22 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2019-04-10 15:16:56 +0200 |
commit | ea4876869c05ff58bfdeefdfcd69bd510b280c01 (patch) | |
tree | d83a5e65cb5bf13ac6df8701ba4153957534eb8c | |
parent | 21fa859c4d693a8d23233aa332d8d2e141b1ab07 (diff) | |
download | org-mode-ea4876869c05ff58bfdeefdfcd69bd510b280c01.tar.gz |
ol-notmuch: Make distinct link types for search view and tree view
* contrib/lisp/ol-notmuch.el (org-notmuch-search-open-function): Deprecate.
(org-notmuch-tree-store-link): New function.
(org-notmuch-tree-open): New function.
"notmuch-tree": Set new "notmuch-tree" parameters with the above functions.
-rw-r--r-- | contrib/lisp/ol-notmuch.el | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/contrib/lisp/ol-notmuch.el b/contrib/lisp/ol-notmuch.el index ab4ddac..3ad8298 100644 --- a/contrib/lisp/ol-notmuch.el +++ b/contrib/lisp/ol-notmuch.el @@ -56,13 +56,14 @@ Should accept a notmuch search string as the sole argument." (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) +(make-obsolete-variable 'org-notmuch-search-open-function nil "9.3") + ;; Install the link type @@ -116,7 +117,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 "%s" path) - (funcall org-notmuch-search-open-function 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." @@ -125,6 +126,25 @@ Can link to more than one message, if so all matching messages are shown." +(org-link-set-parameters "notmuch-tree" + :follow #'org-notmuch-tree-open + :store #'org-notmuch-tree-store-link) + +(defun org-notmuch-tree-store-link () + "Store a link to a notmuch search or message." + (when (eq major-mode 'notmuch-tree-mode) + (let ((link (concat "notmuch-tree:" (notmuch-tree-get-query))) + (desc (concat "Notmuch tree: " (notmuch-tree-get-query)))) + (org-store-link-props :type "notmuch-tree" + :link link + :description desc) + link))) + +(defun org-notmuch-tree-open (path) + "Follow a notmuch message link specified by PATH." + (message "%s" path) + (org-notmuch-tree-follow-link path)) + (defun org-notmuch-tree-follow-link (search) "Follow a notmuch link by displaying SEARCH in notmuch-tree mode." (require 'notmuch) |