emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug: ol-notmuch.el: calls `notmuch-show' with arbitrary search query


From: racin
Subject: Re: Bug: ol-notmuch.el: calls `notmuch-show' with arbitrary search query
Date: Tue, 26 Nov 2019 20:17:27 +0100 (CET)

Hi,


> 
> Here is my workaround.  If this approach seems sensible I can prepare a
> patch to `org-notmuch-follow-link` in ol-notmuch.el.

Your approach probably works most of the time, but I don't like the idea 
of having to perform 2 queries when one should be enough.

I think a better approach would be to change notmuch-show (or add a new 
version) that would
allow taking arbitrary queries (and especially, message ids) as input. This 
probably used to be the case.

Note that the command line notmuch show function does accept arbitrary search 
terms as an argument

I think updating notmuch-show to compute the thread id from the query (instead 
of assuming that the input is
a thread id) would be the best way to go, but you should see that with the 
notmuch developers.

Best regards
Matthieu Lemerre


> 
>    (use-package org-notmuch
>      :init
>      ;; the default value for `org-notmuch-open-function' is
>      ;; `org-notmuch-follow-link', but that function is broken: it calls
>      ;; `notmuch-show' with a search query rather than a thread ID.  This
>      ;; causes `notmuch-show-thread-id' to be populated with a value
>      ;; which is not a thread ID, which breaks various other things
>      ;;
>      ;; so use a custom function instead
>      (defun spw--org-notmuch-follow-link (search)
>        (let ((thread-id
>               (substring
>                (shell-command-to-string
>                 (combine-and-quote-strings (list "notmuch" "search"
>                                                  "--output=threads" 
> "--limit=1"
>                                                  "--format=text"
>                                                  "--format-version=4" 
> search)))
>                0 -1)))
>          (notmuch-show thread-id nil nil search search)))
>      (setq org-notmuch-open-function 'spw--org-notmuch-follow-link))
> 
> --
> Sean Whitton



reply via email to

[Prev in Thread] Current Thread [Next in Thread]