From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#69920: Proposed fix - Toggling MIME inline attachment previews adds superfluous newlines Date: Sun, 21 Apr 2024 19:48:14 -0700 Message-ID: <87sezejeoh.fsf@ericabrahamsen.net> References: <87wmpuouay.fsf@tilde.club> <87y1a952gf.fsf@tilde.club> <86sf0hzb5c.fsf@gnu.org> <874jcxmfzh.fsf@tilde.club> <86bk75z1un.fsf@gnu.org> <864jce50ju.fsf@gnu.org> <86bk67f3kq.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35523"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 69920@debbugs.gnu.org, alcor@tilde.club To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 22 04:49:13 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 1ryjk1-00092Q-HI for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Apr 2024 04:49:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryjje-00071z-6Q; Sun, 21 Apr 2024 22:48:50 -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 1ryjjd-00071q-7q for bug-gnu-emacs@gnu.org; Sun, 21 Apr 2024 22:48:49 -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 1ryjjc-00085t-WD for bug-gnu-emacs@gnu.org; Sun, 21 Apr 2024 22:48:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ryjjs-0003vV-Fc for bug-gnu-emacs@gnu.org; Sun, 21 Apr 2024 22:49:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Apr 2024 02:49:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69920 X-GNU-PR-Package: emacs Original-Received: via spool by 69920-submit@debbugs.gnu.org id=B69920.171375412314872 (code B ref 69920); Mon, 22 Apr 2024 02:49:04 +0000 Original-Received: (at 69920) by debbugs.gnu.org; 22 Apr 2024 02:48:43 +0000 Original-Received: from localhost ([127.0.0.1]:45313 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryjjV-0003ra-Vd for submit@debbugs.gnu.org; Sun, 21 Apr 2024 22:48:42 -0400 Original-Received: from mail.ericabrahamsen.net ([52.70.2.18]:41790) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryjjS-0003qN-7Y for 69920@debbugs.gnu.org; Sun, 21 Apr 2024 22:48:40 -0400 Original-Received: from localhost (71-212-21-65.tukw.qwest.net [71.212.21.65]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id D26CEFA059; Mon, 22 Apr 2024 02:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1713754096; bh=VIu4XqGlNiwKkrXpCh3D3HkXNBbCEI02N31QKaR8SKA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=KPwTKRR2S4hOSOLm+K2NuHekniBUcwgJmhb13Jx2dsidOXfv73NE4EJraWj0MmLWW ARi5VXp3kGtGxw4n2HLp9e5ocaYWBqkXttp0mNDyyh92tEgV7wJasK08kBv5uHAyq5 3plzuNpAwgEWeXMddDPo81HMh6sgUqXcC6YCC89g= In-Reply-To: <86bk67f3kq.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 18 Apr 2024 12:00:21 +0300") 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:283788 Archived-At: On 04/18/24 12:00 PM, Eli Zaretskii wrote: > Ping! Ping! Eric, please chime in. Sorry this has taken so long! >> Cc: 69920@debbugs.gnu.org, alcor@tilde.club >> Date: Sat, 06 Apr 2024 11:59:33 +0300 >> From: Eli Zaretskii >>=20 >> Ping! Eric, can you please chime in? >>=20 >> > Cc: 69920@debbugs.gnu.org >> > Date: Sat, 23 Mar 2024 12:20:16 +0200 >> > From: Eli Zaretskii >> >=20 >> > > From: Alcor >> > > Cc: 69920@debbugs.gnu.org >> > > Date: Sat, 23 Mar 2024 10:53:22 +0100 >> > >=20 >> > > Eli Zaretskii writes: >> > >=20 >> > > > Are you saying that the problem is with the function that >> > > > "un-displays" the inline image, in that it fails to remove the >> > > > inserted newline? (AFAIU, the code before the above commit also h= ad >> > > > the same issue.) That wasn't clear from the description of the >> > > > problem, and the Subject is ambiguous wrt what newlines are deemed >> > > > "superfluous". So please clarify what is the problem you are flag= ging >> > > > here. >> > >=20 >> > > The problem is that the undisplayer does not correctly undo what the >> > > displayer does. >> > >=20 >> > > The undisplayer (as it is right now) just removes the image. That ca= n be >> > > confirmed by stepping through the code with edebug or by inspecting = the >> > > "b" variable. >> > >=20 >> > > I think we can agree that (delete-region b (1+ b)) will always delete >> > > _exactly one_ character, and in that case that would be the properti= zed >> > > "x" with the image. That would leave a dangling newline. >> > >=20 >> > > There are two ways to solve this: >> > >=20 >> > > 1. Do not add the extra newline (this is what the patch does). >> > > 2. Remove the extra newline via (delete-region b (+ b 2)) =E2=80=93 = note that I >> > > have not tried this, but it would make sense to me. >> > >=20 >> > > I happen to prefer option #1 as the extra newline does not seem to h= ave >> > > any meaningful function. But this is just my own preference (Emacs/g= nus >> > > maintainers may wish to retain the extra newline if it serves a vali= d purpose). >> >=20 >> > I prefer #2. Eric, WDYT? 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? Thanks, Eric