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#66106: 28.2; Undo on yanked message fills message body with headers Date: Sat, 23 Sep 2023 15:40:27 -0700 Message-ID: <87msxcldic.fsf@ericabrahamsen.net> References: <87msxi19l2.fsf@makinata.eu> <875y455w6o.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22283"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66106-done@debbugs.gnu.org To: Bruno Victal Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 24 00:41:13 2023 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 1qkBJG-0005cs-W0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Sep 2023 00:41:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qkBIz-0001Ev-Sq; Sat, 23 Sep 2023 18:40:53 -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 1qkBIy-0001EP-Jy for bug-gnu-emacs@gnu.org; Sat, 23 Sep 2023 18:40:52 -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 1qkBIy-0000ZY-BT for bug-gnu-emacs@gnu.org; Sat, 23 Sep 2023 18:40:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qkBJ8-0008BO-NT for bug-gnu-emacs@gnu.org; Sat, 23 Sep 2023 18:41:02 -0400 Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Sep 2023 22:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 66106 X-GNU-PR-Package: emacs Mail-Followup-To: 66106@debbugs.gnu.org, eric@ericabrahamsen.net, mirai@makinata.eu Original-Received: via spool by 66106-done@debbugs.gnu.org id=D66106.169550885131398 (code D ref 66106); Sat, 23 Sep 2023 22:41:02 +0000 Original-Received: (at 66106-done) by debbugs.gnu.org; 23 Sep 2023 22:40:51 +0000 Original-Received: from localhost ([127.0.0.1]:40733 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkBIx-0008AL-4u for submit@debbugs.gnu.org; Sat, 23 Sep 2023 18:40:51 -0400 Original-Received: from mail.ericabrahamsen.net ([52.70.2.18]:54238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkBIt-0008A0-Hq for 66106-done@debbugs.gnu.org; Sat, 23 Sep 2023 18:40:50 -0400 Original-Received: from localhost (71-212-75-26.tukw.qwest.net [71.212.75.26]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 01436FA059; Sat, 23 Sep 2023 22:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1695508829; bh=GJNIfhjiscO01Ynkz1GIOiaSf9Du3JH/0zRlfmhFULc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=YG6FEz9WqZWKhmckQduVYmqtIoXIUKP029y6KoIN5dgn99z3tun/P+LlWkTtHpte2 A7yL7lRI3gR79w6LAqt/oaRLGe80tTc7lapaULMaQyxxs6AQxo/tB8aJNtJuhEQTtI suE9Efg+phxma0+Jyi3I+YQUbZp8tCC+vIJqSALo= In-Reply-To: <875y455w6o.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Tue, 19 Sep 2023 21:02:23 -0700") 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:271199 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eric Abrahamsen writes: > Bruno Victal writes: > >> 1. Using debbugs (elpa), go to issue #66057. >> 2. Open the 3rd reply. (from Jean Abou Samra) >> 3. In the Article buffer (the buffer with the message) do `S v' to >> start a wide reply. >> 4. Within the message body, do `C-c C-y' to copy the original >> message/yank. >> >> Issue #1: I get a =E2=80=9CJean Abou Samra writes:=E2=80=9D line followe= d by nothing, it >> didn't paste the contents of the message I'm replying to. >> >> 5. Press `Undo'. >> >> Issue #2: Instead of reverting to an empty message body, I get the >> headers of the message I'm replying to in its place. >> >> Notes that might be of interest: >> * I have set `message-generate-hashcash' to `t'. >> >> There's also another issue I've encountered when I reattempted to reply >> but using `S V' (wide reply with yank): The message doesn't seem to be >> properly quoted. I only see a single level of '>' whereas I'd expect to >> see part of the body with '>>' corresponding to the quoted parts of the >> original message that started the discussion. > > I don't see exactly what you're seeing -- I tried this out and always > got the message headers (no message body) with one level of quoting. > Hitting undo just removed the level of quoting. But the basic problem is = there. > > It looks like the issue is in `gnus-summary-reply'. The function that > prepares the original copy of the article for yanking is > `gnus-copy-article-buffer', which is called once per article being > replied to (note that "S V" is only wide; "S v" is very wide). > > Starting at line 1105 in `gnus-summary-reply', we go to the buffer > containing the article text to yank, and run: > > (save-restriction > (message-narrow-to-head) > (when very-wide > (erase-buffer) > (insert headers)) > (goto-char (point-max))) > > Perhaps the intention was that the narrowing would affect the behavior > of `erase-buffer', so that in effect this is supposed to replace > whatever headers were there with the contents of the "headers" variable. > But of course `erase-buffer' doesn't respect buffer narrowing, so > everything (including the actual text you wanted to reply to) gets > deleted. If I replace (erase-buffer) with (delete-region (point-min) > (point-max)), it appears to work correctly. > > Did `erase-buffer' used to respect narrowing, when this code was written > 20 years ago? Anyway, the more I look at it, the more I think that's > what's supposed to be happening here. I've experimented with this a bit more, and am pushing the attached patch. I believe it fixes this problem, but please re-open the bug if you're still seeing undesirable behavior. Thanks for the report, Eric --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Use-delete-region-in-Gnus-message-yanking.patch >From 450ca9951a87a055eb00bd161a372cc1de02736f Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Sat, 23 Sep 2023 15:33:53 -0700 Subject: [PATCH] Use delete-region in Gnus message yanking See Bug#66106 * lisp/gnus/gnus-msg.el (gnus-summary-reply): Not erase-buffer. The intention was to narrow the buffer to the headers, and then delete just those headers. But erase-buffer doesn't respect narrowing, so use (delete-region (point-min) (point-max)) instead. --- lisp/gnus/gnus-msg.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 0439bf0d59b..b065ae34851 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -1104,12 +1104,12 @@ gnus-summary-reply (setq headers (concat headers (buffer-string))))))) (set-buffer (gnus-copy-article-buffer)) (gnus-msg-treat-broken-reply-to gnus-msg-force-broken-reply-to) - (save-restriction - (message-narrow-to-head) - (when very-wide - (erase-buffer) - (insert headers)) - (goto-char (point-max))) + (when very-wide + (save-restriction + (message-narrow-to-head) + (delete-region (point-min) (point-max)) + (insert headers) + (goto-char (point-max)))) (mml-quote-region (point) (point-max)) (message-reply nil wide) (when yank -- 2.42.0 --=-=-=--