From: Kyle Meyer <kyle@kyleam.com>
To: piem@inbox.kyleam.com
Subject: [PATCH] lei: Prefer "mid:" to "m:"
Date: Sat, 23 Oct 2021 16:57:12 -0400 [thread overview]
Message-ID: <20211023205712.202126-1-kyle@kyleam.com> (raw)
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
reply other threads:[~2021-10-23 20:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://git.kyleam.com/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211023205712.202126-1-kyle@kyleam.com \
--to=kyle@kyleam.com \
--cc=piem@inbox.kyleam.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.kyleam.com/piem/
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).