discussion and development of piem
 help / color / mirror / code / Atom feed
* [PATCH] lei: Prefer "mid:"  to "m:"
@ 2021-10-23 20:57 Kyle Meyer
  0 siblings, 0 replies; only message in thread
From: Kyle Meyer @ 2021-10-23 20:57 UTC (permalink / raw)
  To: piem

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-23 20:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-23 20:57 [PATCH] lei: Prefer "mid:" to "m:" Kyle Meyer

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