From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sandra Snan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71017: fill-flowed-encode Date: Sun, 30 Jun 2024 10:32:34 +0200 Message-ID: <871q4ej0f1.fsf@ellen.idiomdrottning.org> References: <87v83cfaqx.fsf@ellen.idiomdrottning.org> Reply-To: Sandra Snan Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29219"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71017@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 30 10:33:15 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sNpzm-0007OU-Uo for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Jun 2024 10:33:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNpzc-000721-9h; Sun, 30 Jun 2024 04:33:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNpza-00071n-KE for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2024 04:33:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sNpza-00006U-Bu for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2024 04:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sNpzZ-0000pI-S2 for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2024 04:33:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sandra Snan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Jun 2024 08:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71017 X-GNU-PR-Package: emacs Original-Received: via spool by 71017-submit@debbugs.gnu.org id=B71017.17197363613149 (code B ref 71017); Sun, 30 Jun 2024 08:33:01 +0000 Original-Received: (at 71017) by debbugs.gnu.org; 30 Jun 2024 08:32:41 +0000 Original-Received: from localhost ([127.0.0.1]:54956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNpzF-0000oj-4B for submit@debbugs.gnu.org; Sun, 30 Jun 2024 04:32:41 -0400 Original-Received: from halsen.idiomdrottning.org ([74.207.231.133]:55062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNpzD-0000ob-Ks for 71017@debbugs.gnu.org; Sun, 30 Jun 2024 04:32:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idiomdrottning.org; s=idiomdrottningorg; t=1719736359; bh=+bzUEKMoxMOX88JNCeSx8uxV33R8fjq6rhTWeFG+5r4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=qVqfLg7jferlNcjc3Xpn07HQ5Me9xkpWf5o5KoDWHPxQB+ODuHdOeknON+nllmBsp WxJiVeKLLFKfBvGJmiEKEQmuEG1aCMs6i5ztieoRZhvJnfVnnukfHuaJiYBoGLLnEK UhxrKE0hOYHlOMIMN+ZVWfKuaaBYTLewrbgP9uWC4blf3mWIGx4TgNLmysJaFGcWnC 3T2kBI7cN6z2xZQw/bHS/oueI76YR4v7R5JxHiVlTdnkgF3dro6Ht3C4P7acHJh5yY 8zF73q8BNi8COe+2a2LRnw+bog3dOslUOSbqQZEgttM03rt0wXlbKGlN05zh+DFk5i h3iynErDbt/ew== Original-Received: from localhost (31-211-247-254.customers.ownit.se [31.211.247.254]) by halsen.idiomdrottning.org (Postfix) with ESMTPSA id 12CEC21B05; Sun, 30 Jun 2024 10:32:35 +0200 (CEST) In-Reply-To: Autocrypt: addr=sandra.snan@idiomdrottning.org; prefer-encrypt=mutual; keydata= mDMEZWEIEhYJKwYBBAHaRw8BAQdAahVPtpoqkiV62AL3GSY4JaPS0i3Bu3fhbe5WIFQG9pa0LFNh bmRyYSBTbmFuIDxzYW5kcmEuc25hbkBpZGlvbWRyb3R0bmluZy5vcmc+iJMEExYIADsCGwMFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AWIQSM+QwgZjV9IBEt0Difw0TKEvFISgUCZWJbSgIZAQAKCRCf w0TKEvFIShsYAPsFMXn+tFcAwdI2hrkqqQY8I5EC9UWYC9t57VjiYv2uYQD+PUNVHVSBGQDycf3V /nXqXvZvTfcFMOz0PVMzibPl0AiIkAQTFggAOBYhBIz5DCBmNX0gES3QOJ/DRMoS8UhKBQJlYQgS AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEJ/DRMoS8UhK07EA/iV2B5e3r8t8/StJT38d x9YbuoSBmbYZJ6JHH9hoyv0hAPwMiH1M8zZUeQK/TQDqkg2Hjk0xL+U7i9ggocLJEAWQDbg4BGVh CBISCisGAQQBl1UBBQEBB0BqHjRRmoXeZmeeUZOqL1ebAflzYFA3jHwxl2sLMLlMCgMBCAeIeAQY FggAIBYhBIz5DCBmNX0gES3QOJ/DRMoS8UhKBQJlYQgSAhsMAAoJEJ/DRMoS8UhK4o0BAOB7ChkN Jc0oxRDg9WvrbUCnpLU/QdjMFcC8ymLRdzxaAP4gZVL0JQfxulc/JAxotCevk1PAF+UXpY8QalTI dooaAA== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288177 Archived-At: Stefan Kangas writes: > Could you please resend the above as patches formatted by > > git format-patch -1 > > ? > I'm glad I'm gonna get a chance to resend because I've fixed some=20 more bugs in the version I've been dogfooding since I first sent=20 that so I wanna send an updated version that has that. Normally when I'm sending Emacs lisp patches, it's on packages and=20 they're usually in git already. Here it's a core file so the=20 question I've got is what is the git repo I should make the change=20 in? Then I could git send-email to this In-Reply-To thread id. Stefan Kangas writes: > Sandra Snan writes: > >> Hi y'all. > > Hi Sandra, > >> flow-fill.el.gz has a pair of functions, fill-flowed-encode and=20 >> fill-flowed-fill-buffer (the latter is only called from the=20 >> former). >> Here is a fixed version of the former that then also=20 >> deprecates the latter (I have signed FSF copyright papers): >>=20 >> (defun fill-flowed-encode (&optional buffer) (with-current-buffer=20 >> (or buffer (current-buffer)) ;; No point in doing this unless=20 >> hard newlines is used. (when use-hard-newlines (let ((start=20 >> (point-min)) end) ;; Go through each paragraph, filling it and=20 >> adding SPC ;; as the last character on each line. (while (and (<=20 >> start (point-max)) (setq end (or (text-property-any start=20 >> (point-max) 'hard 't) (point-max)))) (save-restriction=20=09=20= =20=20 >> (narrow-to-region start end) (let ((fill-column (eval=20 >> fill-flowed-encode-column t)) (prefix (concat "\n"=20=09=09=09= =20=20=20 >> (or (and (looking-at ">[> ]*") (match-string 0)) ""))))=20=09=20= =20=20 >> (while (search-forward prefix nil t) (replace-match " " t t))=20 >> (goto-char start) (while (< (+ (point) fill-column)=20 >> (point-max)) (forward-char fill-column) (search-backward " ")=20 >> (forward-char) (insert prefix))) (setq start (1+=20 >> (point-max)))))) t))) >> This fixes two bugs when sending RFC=20 >> 2646=E2=80=93formatted email. >> First, the old code didn't refill or=20 >> encode the last paragraph at all unless there was at least one hard=20 >> newline EOF. >> Second, the old code borked up code indented with=20 >> tabs and spaces (iff that code had overly long lines), such as the=20 >> Lisp code in this email. It could sometimes insert extra in the=20 >> middle of such long lines. >> Here is an example of what it would=20 >> do. It would turn this: >> (defun lorem (ipsum) (dolor sit amet)=20=20 >> (consectetur adipiscing elit (sed do eiusmod tempor incididunt ut=20 >> labore et dolore magna aliqua)) (ut enim ad minim veniam=20=20=20=20=20= =20 >> (quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea=20 >> commodo consequat (duis aute irure dolor in reprehenderit=20 >> in voluptate velit esse cillum dolore eu fugiat nulla=20 >> pariatur) excepteur sint occaecat cupidatat non proident=20=09=20= =20=20=20 >> (sunt in culpa qui officia deserunt mollit anim id est=20 >> laborumd)))) >> into this: >> (defun lorem (ipsum) (dolor sit=20 >> amet) (consectetur adipiscing elit (sed do eiusmod tempor=20 >> incididunt ut labore et dolore magna aliqua)) (ut enim ad minim=20 >> veniam (quis nostrud exercitation ullamco laboris nisi ut=20 >> aliquip ex ea commodo consequat (duis aute irure dolor in=20 >> reprehenderit in voluptate velit esse cillum dolore eu=20 >> fugiat nulla pariatur) excepteur sint occaecat cupidatat non=20 >> proident (sunt in culpa qui officia deserunt mollit anim id=20 >> est laborumd)))) >> It was breaking lines awkwardly so when=20 >> they're reconnected they have extra whitespace in the mkddle of=20 >> lines. > > Could you please resend the above as patches formatted by > > git format-patch -1 > > ? > > It will make it easier for us to review and install the proposed=20 > changes. Thanks in advance.