From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Whitton Subject: Re: Bug: ol-notmuch.el: calls `notmuch-show' with arbitrary search query Date: Tue, 26 Nov 2019 14:52:37 -0700 Message-ID: <87tv6q1f16.fsf@iris.silentflame.com> References: <87h82wrjvb.fsf@iris.silentflame.com> <87y2w21qn4.fsf@iris.silentflame.com> <1630223474.433436589.1574795847430.JavaMail.zimbra@free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1630223474.433436589.1574795847430.JavaMail.zimbra-GANU6spQydw@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: notmuch-bounces-gxuj+Tv9EO5zyzON3hdc1g@public.gmane.org Sender: "notmuch" To: racin-GANU6spQydw@public.gmane.org Cc: notmuch , emacs-orgmode List-Id: emacs-orgmode.gnu.org Hello, On Tue 26 Nov 2019 at 08:17PM +01, racin-GANU6spQydw@public.gmane.org wrote: > 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. I agree with you that it would be best if `notmuch-show' were extended to accept arbitrary notmuch queries instead of only thread IDs. However, I also believe that ol-notmuch.el should be updated in the meantime. notmuch.el presently exposes an API, `notmuch-show', which takes a thread ID. ol-notmuch.el is misusing that API by passing in a value of a different type -- a notmuch query rather than a thread ID. That's a bug: even if an API is more limited than we would like it to be, we should use it in the way that it is documented to be used by its developers. This misuse of the API causes numerous other hard-to-diagnose bugs. For example, if you use `org-notmuch-follow-link' to open an Org-mode link like "notmuch:id:foo-o+HKXD+gRuM@public.gmane.org", the standard notmuch command `notmuch-show-filter-thread' doesn't work. And if you use `C-u c i` to yank the thread ID for pasting into a shell, say, you will yank a value which is not a thread ID. -- Sean Whitton