Subject: bug#69920: Proposed fix - Toggling MIME inline attachment previews adds superfluous newlines

From: Alcor <[email-masked]>
Date: Mon, 22 Apr 2024 14:42:09 +0200

Eric Abrahamsen <[email-masked]> writes:

> I also prefer #2, mostly because the other `mm-inline-*' functions here
> all ensure that inlined content ends with a newline, and even if there's
> no immediate consequence to not having it, I'd prefer the consistency.
> Alcor, would you be willing to update your patch?

Hello Eric, Eli –

Attached is an updated patch adjusting the `delete-region' call in the
undisplayer to account for the additional newline, as discussed earlier.

I have tested this change on Emacs 29.3 (Linux/GTK) with multiple
image/png attachments and can confirm it works.

Cheers,
-A.

>From 31578f2c8d538eb4b944c073d4804f355f88f035 Mon Sep 17 00:00:00 2001
From: "F. Moukayed" <[email-masked]>
Date: Mon, 22 Apr 2024 12:33:08 +0000
Subject: [PATCH] Ensure that inline preview undisplayer removes added newline

* lisp/gnus/mm-view.el (mm-inline-image): Remove the regioninterval b..b+2 (aka "x\n") instead of removing b..b+1 ("x") and leaving behind a superfluous newline (bug#69920).
---
 lisp/gnus/mm-view.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 109b6c17c2..223da19a16 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -105,7 +105,7 @@ This is only used if `mm-inline-large-images' is set to
      (lambda ()
        (let ((inhibit-read-only t))
 	 (remove-images b b)
-	 (delete-region b (1+ b)))))))
+	 (delete-region b (+ b 2)))))))
 
 (defvar mm-w3m-setup nil
   "Whether gnus-article-mode has been setup to use emacs-w3m.")
-- 
2.34.1