unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alcor via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: 69920@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#69920: Proposed fix - Toggling MIME inline attachment previews adds superfluous newlines
Date: Mon, 22 Apr 2024 14:42:09 +0200	[thread overview]
Message-ID: <875xw9y3fi.fsf@tilde.club> (raw)
In-Reply-To: <87sezejeoh.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 21 Apr 2024 19:48:14 -0700")

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

Eric Abrahamsen <eric@ericabrahamsen.net> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Ensure-that-inline-preview-undisplayer-removes-added.patch --]
[-- Type: text/x-diff, Size: 960 bytes --]

From 31578f2c8d538eb4b944c073d4804f355f88f035 Mon Sep 17 00:00:00 2001
From: "F. Moukayed" <smfadi+emacs@gmail.com>
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


  reply	other threads:[~2024-04-22 12:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 17:59 bug#69920: 29.2; gnus: article-mode: Toggling MIME inline attachment previews adds superfluous newlines Alcor via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-22 21:01 ` bug#69920: Proposed fix - " Alcor via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-22 22:25   ` Alcor via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-23  6:59     ` Eli Zaretskii
2024-03-23  9:53       ` Alcor via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-23 10:20         ` Eli Zaretskii
2024-04-06  8:59           ` Eli Zaretskii
2024-04-18  9:00             ` Eli Zaretskii
2024-04-22  2:48               ` Eric Abrahamsen
2024-04-22 12:42                 ` Alcor via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-04-22 14:58                   ` bug#69920: 29.2; gnus: article-mode: " Eric Abrahamsen
2024-03-23  6:52   ` bug#69920: Proposed fix - " Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875xw9y3fi.fsf@tilde.club \
    --to=bug-gnu-emacs@gnu.org \
    --cc=69920@debbugs.gnu.org \
    --cc=alcor@tilde.club \
    --cc=eliz@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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