Subject: [PATCH] Do not quote "^From " when fetching from IMAP

From: Manuel Giraud <[email-masked]>
Date: Tue, 02 Sep 2025 17:26:11 +0200

Tags: patch

Hi,

I'm using mail-source in Gnus to fetch mail from IMAP.  Whenever I get a
message with a line that start with "From " this line is quoted.

This patch removes this quirk… but maybe it was there for a reason.  We
don't have the history for this modification since it is present in the
code of "mail-source.el" since its import into Emacs (in 2000).  FWIW,
'mail-source-fetch-maildir' have this part commented since 2000 also.

In GNU Emacs 31.0.50 (build 31, x86_64-unknown-openbsd7.7) of 2025-09-01
 built on computer
Repository revision: b52ccb997d598caa321141c0abb553d3b3803eee
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101018
System Description: OpenBSD computer 7.7 GENERIC.MP#10 amd64

Configured using:
 'configure CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
 MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs
 --bindir=/home/manuel/bin --with-x-toolkit=no
 --with-toolkit-scroll-bars=no --without-cairo --without-dbus
 --without-gconf --without-gsettings --without-compress-install'

>From 8e1a23cc3868c2443ea45e218d6582fa00fcea8e Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Tue, 2 Sep 2025 17:16:53 +0200
Subject: [PATCH] Do not quote "^From " when fetching from IMAP

* lisp/gnus/mail-source.el (mail-source-fetch-imap): Do not
quote "^From ".
---
 lisp/gnus/mail-source.el | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 5bf7c7c2b94..e82a77d4cb5 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -1097,12 +1097,7 @@ mail-source-fetch-imap
 			      (imap-fetch uid "RFC822.PEEK" 'RFC822 nil buf)))
 		  (push uid remove)
 		  (insert "From imap " (current-time-string) "\n")
-		  (save-excursion
-		    (insert str "\n\n"))
-		  (while (let ((case-fold-search nil))
-			   (re-search-forward "^From " nil t))
-		    (replace-match ">From "))
-		  (goto-char (point-max))))
+                  (insert str "\n\n")))
 	      (nnheader-ms-strip-cr))
             (incf found (mail-source-callback callback server))
 	    (mail-source-delete-crash-box)
-- 
2.51.0

-- 
Manuel Giraud