From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:e8e3::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id YEVHGD13dGE/LgAAsNZ9tg (envelope-from ); Sat, 23 Oct 2021 20:57:33 +0000 Received: from out10.migadu.com ([2001:41d0:2:e8e3::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id WPPhEz13dGFMZQAAbx9fmQ (envelope-from ); Sat, 23 Oct 2021 20:57:33 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1635022653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=FS3HZbPV1urNrF4iY4cgFuy8n4UY/IfbURVJ4DGE0JQ=; b=dkXXlyODG6/hZwUnVrTpjREHNiGMqKXkXXuyluxY4uIZuW//V3qpvUcuUbDiH/GOVa6J7k TXQRAaUFSdtmHTw2Hj2jJls3178+V5j/oW96jt+HeLq7CsUZ+CnQXaMQnr5WZLw03b32sh 2Q8UEeKJQvkP3wXpHwbKvGI4q029kA+LsgHaD6Z0yuntcSjogy8qkZGyDEXWoHikZ4m7E4 5QIjCEW4PSY0E5y43+gnNosey4cPQMNQfoYTTTX5hl220OaISaFd1FVooOq9h6Ukd9QRCk f9c/uezghqtUfcB/QAmiEsjcUGv2BkMlokTdC5ANYrddxiv6WeKDWcRCyj6/dw== From: Kyle Meyer To: piem@inbox.kyleam.com Subject: [PATCH] lei: Prefer "mid:" to "m:" Date: Sat, 23 Oct 2021 16:57:12 -0400 Message-Id: <20211023205712.202126-1-kyle@kyleam.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-TUID: heOsjFkbriLu The "m:" prefix is probabilistic and can do partial matches, whereas "mid:" is boolean (see lib/PublicInbox/Search.pm). When "m:" is used in lei, the intention is to get the one and only, so switch to using "mid:". --- This change was prompted by me noticing that lei' isn't outputting anything for the following message in yhetil.org's guix-devel inbox: $ lei q \ 'm:nGryWLpTkg6CypUliNjgBxXbrpSLCjWKpxT3V_t_lBsIf8y2JThZqlQP0P8XEfvyG_fGuUpePy_sO8sZXn1lfzcWgb7PIFTxkeoILaHHfcA=@protonmail.com' [null] With "mid:", the message is found. I'm confused by why the probabilistic match doesn't work here, but I haven't dug any deeper. piem-lei.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/piem-lei.el b/piem-lei.el index cd1dbe02..6bd977d8 100644 --- a/piem-lei.el +++ b/piem-lei.el @@ -121,7 +121,7 @@ (defun piem-lei-show (mid &optional display) (let ((inhibit-read-only t)) (erase-buffer) (call-process "lei" nil '(t nil) nil - "q" "--format=text" (concat "m:" mid)) + "q" "--format=text" (concat "mid:" mid)) (goto-char (point-min)) (when (looking-at-p "# blob:") (delete-region (line-beginning-position) @@ -502,7 +502,7 @@ (defun piem-lei-query-thread (mid) (list (or (piem-lei-get-mid) (read-string "Message ID: " nil nil (piem-mid))))) (let* ((records (piem-lei-query--slurp - (list "--threads" (concat "m:" mid)))) + (list "--threads" (concat "mid:" mid)))) (msgs (piem-lei-query--thread records)) depths pt-final subject-prev) (with-current-buffer (get-buffer-create "*lei-thread*") @@ -571,7 +571,7 @@ (defun piem-lei-get-inbox () (when-let ((mid (piem-lei-get-mid))) (with-temp-buffer (call-process "lei" nil '(t nil) nil - "q" "--format=mboxrd" (concat "m:" mid)) + "q" "--format=mboxrd" (concat "mid:" mid)) (goto-char (point-min)) (piem-inbox-by-header-match)))) @@ -581,7 +581,7 @@ (defun piem-lei-known-mid-p (mid) (not (string-empty-p (with-temp-buffer (call-process "lei" nil '(t nil) nil - "q" "--format=ldjson" (concat "m:" mid)) + "q" "--format=ldjson" (concat "mid:" mid)) (buffer-string))))) (defun piem-lei-mid-to-thread (mid) @@ -590,7 +590,7 @@ (defun piem-lei-mid-to-thread (mid) (lambda () (call-process "lei" nil '(t nil) nil "q" "--format=mboxrd" "--threads" - (concat "m:" mid))))) + (concat "mid:" mid))))) ;;;###autoload (define-minor-mode piem-lei-mode base-commit: b9f1fec92ae03f9f97e20455aa8804d3e04d640e -- 2.33.1