discussion and development of piem
 help / color / mirror / code / Atom feed
* [PATCH] inject: Anchor 'From mboxrd@z ...' search
@ 2021-01-19  5:40 Kyle Meyer
  0 siblings, 0 replies; only message in thread
From: Kyle Meyer @ 2021-01-19  5:40 UTC (permalink / raw)
  To: piem

piem--write-mbox-to-maildir finds the bounds for each message by doing
a plain search for "From mboxrd@z", but of course nothing prevents
that from being within the text of the message.  Anchor it to the
start of the line to prevent false positives.

  This embarrassing gem was found when trying to inject

 piem.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/piem.el b/piem.el
index 8c23e7b..867a7e5 100644
--- a/piem.el
+++ b/piem.el
@@ -489,9 +489,9 @@ (defun piem--write-mbox-to-maildir ()
   (let ((n-added 0)
         (n-skipped 0))
     (while (and (not (eobp))
-                (search-forward "From mboxrd@z" nil t))
+                (re-search-forward "^From mboxrd@z" nil t))
       (let* ((beg (line-beginning-position 2))
-             (end (or (and (search-forward "From mboxrd@z" nil t)
+             (end (or (and (re-search-forward "^From mboxrd@z" nil t)
                            (progn (goto-char (line-beginning-position 0))

base-commit: 9abfc09d24e73044f2392f45fc41169ee4afd72f

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

only message in thread, other threads:[~2021-01-19  5:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-19  5:40 [PATCH] inject: Anchor 'From mboxrd@z ...' search Kyle Meyer

Code repositories for project(s) associated with this public inbox


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