emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-notmuch: Improved tree support
@ 2019-03-19 10:07 Pierre Neidhardt
  2019-04-03 10:56 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Neidhardt @ 2019-03-19 10:07 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,

1. `org-notmuch-store-link' does not allow to store links to email at
point in tree view.  Easy fix:

--8<---------------cut here---------------start------------->8---
(defun org-notmuch-store-link ()
  "Store a link to a notmuch search or message."
-  (when (eq major-mode 'notmuch-show-mode)
+  (when (or (eq major-mode 'notmuch-show-mode)
+            (eq major-mode 'notmuch-tree-mode))
    (let* ((message-id (notmuch-show-get-message-id t))
--8<---------------cut here---------------end--------------->8---

2. A while back
https://lists.gnu.org/archive/html/emacs-orgmode/2014-07/msg00380.html
was merged.  I think using a defcustom here is not very intuitive for
people who use both the tree view and the thread view.  I would expect
the following:

- Opening a tree link will open the tree view.
- Opening a search link will open the search view.

It's easy to implement:

- Deprecate the former defcustom.
- Copy/paste the org-notmuch-search* code to org-notmuch-tree*.

Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-notmuch: Improved tree support
  2019-03-19 10:07 org-notmuch: Improved tree support Pierre Neidhardt
@ 2019-04-03 10:56 ` Nicolas Goaziou
  2019-04-09 17:23   ` Pierre Neidhardt
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2019-04-03 10:56 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: emacs-orgmode

Hello,

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> 1. `org-notmuch-store-link' does not allow to store links to email at
> point in tree view.  Easy fix:
>
> --8<---------------cut here---------------start------------->8---
> (defun org-notmuch-store-link ()
>   "Store a link to a notmuch search or message."
> -  (when (eq major-mode 'notmuch-show-mode)
> +  (when (or (eq major-mode 'notmuch-show-mode)
> +            (eq major-mode 'notmuch-tree-mode))
>     (let* ((message-id (notmuch-show-get-message-id t))
> --8<---------------cut here---------------end--------------->8---

Applied. Thank you.

> 2. A while back
> https://lists.gnu.org/archive/html/emacs-orgmode/2014-07/msg00380.html
> was merged.  I think using a defcustom here is not very intuitive for
> people who use both the tree view and the thread view.  I would expect
> the following:
>
> - Opening a tree link will open the tree view.
> - Opening a search link will open the search view.
>
> It's easy to implement:
>
> - Deprecate the former defcustom.
> - Copy/paste the org-notmuch-search* code to org-notmuch-tree*.

I do not use ol-notmuch (new name in master for org-notmuch), but it
sounds reasonable.

Do you want to take care of it?

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-notmuch: Improved tree support
  2019-04-03 10:56 ` Nicolas Goaziou
@ 2019-04-09 17:23   ` Pierre Neidhardt
  2019-04-10 13:19     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Neidhardt @ 2019-04-09 17:23 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 142 bytes --]

Patch attached.
I'm just not sure about what the version number should be for
deprecation.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ol-notmuch-Make-distinct-link-types-for-search-view-.patch --]
[-- Type: text/x-patch, Size: 2673 bytes --]

From 52191a549c5a75495d9e9be864a42c7906bdfdd3 Mon Sep 17 00:00:00 2001
From: Pierre Neidhardt <mail@ambrevar.xyz>
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?
 
 \f
 
@@ -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."
 
 \f
 
+(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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: org-notmuch: Improved tree support
  2019-04-09 17:23   ` Pierre Neidhardt
@ 2019-04-10 13:19     ` Nicolas Goaziou
  2019-04-10 13:27       ` Pierre Neidhardt
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2019-04-10 13:19 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: emacs-orgmode

Hello,

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Patch attached.
> I'm just not sure about what the version number should be for
> deprecation.

Applied. I fixed the version number.

Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-notmuch: Improved tree support
  2019-04-10 13:19     ` Nicolas Goaziou
@ 2019-04-10 13:27       ` Pierre Neidhardt
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Neidhardt @ 2019-04-10 13:27 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

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

Thanks!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-10 13:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-19 10:07 org-notmuch: Improved tree support Pierre Neidhardt
2019-04-03 10:56 ` Nicolas Goaziou
2019-04-09 17:23   ` Pierre Neidhardt
2019-04-10 13:19     ` Nicolas Goaziou
2019-04-10 13:27       ` Pierre Neidhardt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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