From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pierre Neidhardt Subject: Re: org-notmuch: Improved tree support Date: Tue, 09 Apr 2019 19:23:55 +0200 Message-ID: <87v9zn6qj8.fsf@ambrevar.xyz> References: <87h8bzb2jy.fsf@bababa.i-did-not-set--mail-host-address--so-tickle-me> <87k1gbichc.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:45841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDuTZ-000782-65 for emacs-orgmode@gnu.org; Tue, 09 Apr 2019 13:24:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDuTX-00029v-Ur for emacs-orgmode@gnu.org; Tue, 09 Apr 2019 13:24:01 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:53059) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDuTX-00028R-CS for emacs-orgmode@gnu.org; Tue, 09 Apr 2019 13:23:59 -0400 In-Reply-To: <87k1gbichc.fsf@nicolasgoaziou.fr> 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" To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Patch attached. I'm just not sure about what the version number should be for deprecation. =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlys1SsACgkQm9z0l6S7 zH+V2Af+OwLvVj5PseFjWaQB1sjzJvik2amcEBmLpLDPDJ7XQMtsc8CNLYrFqqGI 60xXej4Lqvb2ZTxUnbKre2k49C82nNAXO0cEshHQu2eAe9RudYhwP68aU173s5Wf UQZG4VcrKVGkI5U4pxDjXljgODOa+X0UsANnS+IgoSO9fe4wkrF/wY+COnFbl8pa Njrz7+4homc/hC/0T9Y0O6pzUCsTGBhO9LwiixA+5B5MLAvrfeZ6iltGSylWLP1e OVjvIDB22ZfIzOvdGtjrCJdKUBaxBzhT2fLicXUdboFh8jlMstAQP840jo5fKsZ+ CBAxOpedoMEU8uE4qYs4FpGlh5v55A== =gWSt -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ol-notmuch-Make-distinct-link-types-for-search-view-.patch >From 52191a549c5a75495d9e9be864a42c7906bdfdd3 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Tue, 9 Apr 2019 19:15:22 +0200 Subject: [PATCH] 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. --- contrib/lisp/ol-notmuch.el | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/contrib/lisp/ol-notmuch.el b/contrib/lisp/ol-notmuch.el index ab4ddacf2..eac8a37ca 100644 --- a/contrib/lisp/ol-notmuch.el +++ b/contrib/lisp/ol-notmuch.el @@ -57,11 +57,14 @@ Should accept a notmuch search string as the sole argument." 'org-notmuch-search-follow-link "Function used to follow notmuch-search links. -Should accept a notmuch search string as the sole argument." +Should accept a notmuch search string as the sole argument. + +This is obsolete and `org-notmuch-search-follow-link' will always be used." :group 'org-notmuch :version "24.4" :package-version '(Org . "8.0") :type 'function) +(make-obsolete-variable 'org-notmuch-search-open-function nil "26.2") ; TODO: What is the right version? @@ -116,7 +119,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 +128,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) -- 2.21.0 --=-=-=--