GNU bug report logs - #75355
[PATCH 0/1] Improve comment cycling in log-edit

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Jonas Bernoulli <jonas@HIDDEN>; Keywords: patch; dated Sat, 4 Jan 2025 16:30:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 75355 <at> debbugs.gnu.org:


Received: (at 75355) by debbugs.gnu.org; 13 Feb 2025 09:48:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 13 04:48:18 2025
Received: from localhost ([127.0.0.1]:40542 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tiVpS-0006fs-1R
	for submit <at> debbugs.gnu.org; Thu, 13 Feb 2025 04:48:18 -0500
Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]:52726)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tiVpP-0006fP-Bb
 for 75355 <at> debbugs.gnu.org; Thu, 13 Feb 2025 04:48:15 -0500
Received: by mail-ej1-x630.google.com with SMTP id
 a640c23a62f3a-aaedd529ba1so98644666b.1
 for <75355 <at> debbugs.gnu.org>; Thu, 13 Feb 2025 01:48:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1739440089; x=1740044889; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=RCF6fGEIHJeP8p+BbYA8lsrgKwVAeQSeSNYSMGN0iQI=;
 b=cEB/P5WbxNydJ7a4sWEWj9QtOo5YVCsFCfrie25+euovYqqaJQsNXLjRQvJuShkLJC
 IJo+LVX6EZ3WQX6bTjfJ5iLf2aEd9/vWgGBdXGJFBflAtdCZA2myMnSjfmmd9ZpIgxR8
 m2x45drKC5OMa6N3IJB8TdDV1B4QSXdzBF1LvghX7WA3B+v9q3LfW9nRtv/to5M1r32d
 b3yW1Z1WI/jWbczNqFhmOClK3pHNMz/WBeyD4c6otdnsbjNlnONS6mRyUIrEHf5OIryV
 x3b5LYyDmekG1NEkGZkc1GDEgNYlkO0NZk5CN6k7WDpzjKy1smw5rE4gj0cIZtauJmHE
 pe0g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1739440089; x=1740044889;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=RCF6fGEIHJeP8p+BbYA8lsrgKwVAeQSeSNYSMGN0iQI=;
 b=P7zw/yI/BpWGyEcM3wfqdS9HYiMsCDTE/xBnF66/jAFlPEm3OKb283g2MDFDJwUkf0
 QcfAj/+5OTeVkzVULXg5fvjPvl8A21S6kU4ekuT+e5Dq0zzACSpYcKxy/sixIzwinb1P
 dn/hNuZ+ixz6/J4piGxVUnmadMjq6WqYAS3+0hxU7S0vkuZQJDz37XmMUnIxK++EQWyO
 x3HIRmxNJPV4JbienIve2UCyq5McMZHNcp/coE1juWmQ0XTccy2tXBnoNKqBZWYMQH2W
 bU4EGaKQa39pFLnyKhDvJl9MMGBWPGKovmtkQ4t0yQwU5c5MQ0TTPq07n7EfOOdCau36
 N3pw==
X-Forwarded-Encrypted: i=1;
 AJvYcCVacWwYayQBwXK5aiQ3yccRTxXIg3E0B2FagqTqsmhGF2gctg8sViXaCtKHIFtFQ+6aU6fw1g==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxXQVvb7VWr1rQ3i9/AWiog9V+T7Yr+1HU6GW7zzBSZ11jfqHQj
 XZHIMlA1gF+0PSahMJ5HJID40xCi6tmU7fZUwX3QUoF6EtJuRFH687hopStXssYvu4RQbKE/Hti
 cDrSqTGG8TFhBrPqarXe5mum9YyfTFEdQkJkeow==
X-Gm-Gg: ASbGncuLxym53sY+MSU4p9KGKx8GWtPkJNN/C8C3Sj7jorDV98R7xUCdUWHxI1Sd3Xj
 ILwuRZt4ADlfUmN9oP11+xQPKDYUy1cE3IVo1g3cKdOyzcuwVJ4TGVTLpqHl49z2mdbjzOzKK0K
 w=
X-Google-Smtp-Source: AGHT+IHpwhKZj66McnAnvEFu1OBzOZVyv/27jMLe7U2gbhjAcHQmF2xM660leCxwbfBsbaMQDwsSqJ/4SaphSfur2Rs=
X-Received: by 2002:a05:6402:34d2:b0:5de:aa54:dc22 with SMTP id
 4fb4d7f45d1cf-5dec9e99a2bmr5235311a12.20.1739440088782; Thu, 13 Feb 2025
 01:48:08 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 13 Feb 2025 01:48:08 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <87h65ouju4.fsf@HIDDEN>
References: <20250104162859.13378-1-jonas@HIDDEN>
 <20250104171108.18590-1-jonas@HIDDEN>
 <86pll2bezh.fsf@HIDDEN> <8734hy1acx.fsf@HIDDEN> <86a5c5afdu.fsf@HIDDEN>
 <87cyh17app.fsf@HIDDEN> <87h65ouju4.fsf@HIDDEN>
MIME-Version: 1.0
Date: Thu, 13 Feb 2025 01:48:08 -0800
X-Gm-Features: AWEUYZkTrlhQ4y5nLB0J0u_9fhiWvdorpDBqUii4Z-Ie3z3OsiilG5OcpC2XJvk
Message-ID: <CADwFkmnf+DC3Z36tNKynUMuQXVKG=haH437=4JPGVq829VEk_A@HIDDEN>
Subject: Re: bug#75355: [PATCH 1/1] Improve comment cycling in log-edit
To: Sean Whitton <spwhitton@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75355
Cc: Eli Zaretskii <eliz@HIDDEN>, Jonas Bernoulli <jonas@HIDDEN>,
 75355 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Sean Whitton <spwhitton@HIDDEN> writes:

> - I think some people might prefer not to have their half-written
>   comment saved.  What do you think about doing everything in entries in
>   log-edit-save-comment-hook, so that someone could customise that to
>   remove the default behaviour, if they wanted?  Or perhaps a simple
>   boolean defcustom to turn this new behaviour on and off.

What would be the use case for not saving it?  IIUC, this is anyways
just saved in memory, so is there any real drawback to just keeping it
there?  If you don't care, you don't care, so to speak.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75355; Package emacs. Full text available.

Message received at 75355 <at> debbugs.gnu.org:


Received: (at 75355) by debbugs.gnu.org; 24 Jan 2025 18:51:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 24 13:51:18 2025
Received: from localhost ([127.0.0.1]:47049 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tbOly-0002Fp-8q
	for submit <at> debbugs.gnu.org; Fri, 24 Jan 2025 13:51:18 -0500
Received: from sendmail.purelymail.com ([34.202.193.197]:37594)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>)
 id 1tbOlv-0002FU-Fc
 for 75355 <at> debbugs.gnu.org; Fri, 24 Jan 2025 13:51:16 -0500
DKIM-Signature: a=rsa-sha256;
 b=nyra45iACkW+VIcsWlHGy6d5JO+4iCsbTYS8Nx4aTeruGwpg+sMiMnOxa3JJCUY2ISjyxn4KPdYOLEQffTAiPKgZwxxvNJOLWS2Y1egT2lkoHqNohC6TyUqkcCaD7fb69uxJl856UBA3Hkyvmk/t+/8H5MGOOPAZ7Rdixmm2Kd7gPutvy18lbUANfp/UR/codLSzzBesTciUGDkbrj0stFnpfoUW8k1lSnZ2GBmB++zedJSr8sK8ucujBRfY63WoCZJAPOqQTh5KqpO2I98g9lLk5qfQ0ef+caL3hR0I8f0iqVgB+VZyDHMp7Y0KQ9wtsCSOTWNyITz3oW67Wl/nKQ==;
 s=purelymail3; d=spwhitton.name; v=1;
 bh=hstNDXv8higCV7SNFFLdtg0zAmhGEHn2SiJ88FC5Xkk=;
 h=Received:Received:From:To:Subject:Date; 
DKIM-Signature: a=rsa-sha256;
 b=psFvZhLhH28VhPlhFRVvUbMBnmEoC25Zi1iVQGk10JPTgpe/Nc7B0a/8B39lPdFREcd2pPdEQLIlKay6H1D45smq/buyjuhBYUHpp1nNQ/M/wrqwZEIggxiJbDN75HVlYmVumutxL50xcApJ6D4gbk7+cuBjxRFS6U4ft74sUk2tWARJbDrI2xKMzrDQGkd8UYzrSTPMmPCTcb5m0sNnCK6JSdc/n+vwQKUJEjpOaaZ36KDWlD86yaLRnQAKktfgz60ZqkXcPNZGoVR4+0hyX5ybMUE4g8u4iNddxAFXWSsolq2jBTMw+W8YWjN3U7TMNopilb7qaPS0iKq6Y2vbaA==;
 s=purelymail3; d=purelymail.com; v=1;
 bh=hstNDXv8higCV7SNFFLdtg0zAmhGEHn2SiJ88FC5Xkk=;
 h=Feedback-ID:Received:Received:From:To:Subject:Date; 
Feedback-ID: 20115:3760:null:purelymail
X-Pm-Original-To: 75355 <at> debbugs.gnu.org
Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -201058736; 
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Fri, 24 Jan 2025 18:51:00 +0000 (UTC)
Received: by zephyr.silentflame.com (Postfix, from userid 1000)
 id 3C7929417E2; Fri, 24 Jan 2025 18:50:59 +0000 (GMT)
From: Sean Whitton <spwhitton@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>, Jonas Bernoulli <jonas@HIDDEN>,
 75355 <at> debbugs.gnu.org
Subject: Re: bug#75355: [PATCH 1/1] Improve comment cycling in log-edit
In-Reply-To: <87cyh17app.fsf@HIDDEN> (Jonas Bernoulli via's message of
 "Sun, 05 Jan 2025 12:37:38 +0100")
References: <20250104162859.13378-1-jonas@HIDDEN>
 <20250104171108.18590-1-jonas@HIDDEN> <86pll2bezh.fsf@HIDDEN>
 <8734hy1acx.fsf@HIDDEN> <86a5c5afdu.fsf@HIDDEN>
 <87cyh17app.fsf@HIDDEN>
Date: Fri, 24 Jan 2025 18:50:59 +0000
Message-ID: <87h65ouju4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75355
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

On Sun 05 Jan 2025 at 12:37pm +01, Jonas Bernoulli via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> Note that the command log-edit-save-comment is also used in code twice,
> so the cost of making it a command is just the line " (interactive)".
> If you feel this command is not useful enough to receive a default key
> bindings, we can drop that, but the interactive form should remain.

I would like to drop the default binding for now, but keep the command.

I have a couple of questions about the rest of the patch:

- I don't think Log Edit buffers ever contain commented lines or
  scissors lines at present.  So I'm not sure why you included that
  functionality.  Is it because you want to reuse this function in the
  hypothetical simplified git-commit-mode?

- I think some people might prefer not to have their half-written
  comment saved.  What do you think about doing everything in entries in
  log-edit-save-comment-hook, so that someone could customise that to
  remove the default behaviour, if they wanted?  Or perhaps a simple
  boolean defcustom to turn this new behaviour on and off.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75355; Package emacs. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 75355 <at> debbugs.gnu.org:


Received: (at 75355) by debbugs.gnu.org; 5 Jan 2025 11:37:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 05 06:37:46 2025
Received: from localhost ([127.0.0.1]:60174 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tUOwz-0005Rl-Ip
	for submit <at> debbugs.gnu.org; Sun, 05 Jan 2025 06:37:46 -0500
Received: from mail.hostpark.net ([212.243.197.30]:37836)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <jonas@HIDDEN>) id 1tUOwx-0005RY-Ae
 for 75355 <at> debbugs.gnu.org; Sun, 05 Jan 2025 06:37:44 -0500
Received: from localhost (localhost [127.0.0.1])
 by mail.hostpark.net (Postfix) with ESMTP id F3F131660B;
 Sun,  5 Jan 2025 12:37:40 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h=
 content-type:content-type:mime-version:message-id:date:date
 :references:in-reply-to:subject:subject:from:from; s=sel2011a;
 t=1736077060; bh=IdjSpnDaXxot4j5D5V/acUCIrjui4GIl71H2lG5wGQ8=; b=
 KbMMfFb+UMwfIppyejSIcaBHbHoocqtk4cphodxfXRvWwxSOp5GCXVQrED68aU59
 M3HK88Vd6iXM8MfHcjNwH15L4Bo43TZ6KwEoVIZjee+hUXZhwnPLQEdR8Wev5WOm
 aAcpi4uF2H4BW8GtUOkgRawXVcK7ywcXNZu9ofYrnLI=
X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net
Received: from mail.hostpark.net ([127.0.0.1])
 by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224)
 with ESMTP id YSzrSDyF2Lrn; Sun,  5 Jan 2025 12:37:40 +0100 (CET)
Received: from customer (localhost [127.0.0.1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits)
 server-digest SHA256) (No client certificate requested)
 by mail.hostpark.net (Postfix) with ESMTPSA id 63AA2161E1;
 Sun,  5 Jan 2025 12:37:40 +0100 (CET)
From: Jonas Bernoulli <jonas@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75355: [PATCH 1/1] Improve comment cycling in log-edit
In-Reply-To: <86a5c5afdu.fsf@HIDDEN>
References: <20250104162859.13378-1-jonas@HIDDEN>
 <20250104171108.18590-1-jonas@HIDDEN> <86pll2bezh.fsf@HIDDEN>
 <8734hy1acx.fsf@HIDDEN> <86a5c5afdu.fsf@HIDDEN>
Date: Sun, 05 Jan 2025 12:37:38 +0100
Message-ID: <87cyh17app.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75355
Cc: 75355 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Jonas Bernoulli <jonas@HIDDEN>
>> Cc: 75355 <at> debbugs.gnu.org
>> Date: Sat, 04 Jan 2025 23:29:34 +0100
>> 
>> Eli Zaretskii <eliz@HIDDEN> writes:
>> 
>> >> Date: Sat,  4 Jan 2025 18:11:08 +0100
>> >> From:  Jonas Bernoulli via "Bug reports for GNU Emacs,
>> >>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>> >> 
>> >> Save the current message before cycling to older messages, making it
>> >> possible to cycle back to that initial message.
>> >
>> > Thanks, but can you provide some rationale for this?  Is the
>> > assumption that users need to make several commits that all share the
>> > same comment or something?
>> 
>> That is one use-case for the feature as it exists now, yes.  Messages
>> are already automatically saved once the user either finished or aborts
>> the commit.
>> 
>> These changes don't really affect that.  I consider this additional
>> automatic saving a bugfix.  Without it, a user may start typing a new
>> message, decide to use a recent message instead, navigate to it but then
>> change their mind about that, and then they would not be able to go back
>> to the new message they had already started typing, because it was
>> discarded when they moved a way from it.  By saving the new message when
>> we move away from it, we make it possible to navigate back to it.
>
> What do you mean by "move away" and "navigate", in the context of
> log-edit?

The buffer contains a draft to be used as the message for the commit
you are about to create.  "Moving away" from the message means using
the commands log-edit-previous/next-comment to "navigate" to another
message.  Doing so erased the contents of the buffer, and another
recently used message is inserted in its place.

>> By additionally defining log-edit-save-comment as a command we gain the
>> ability to save the message at random point.  This could, for example,
>> be useful if we have to use very similar messages in different commits,
>> potentially across multiple repositories.
>
> Is this a frequent use case?  Why would the same log message be used
> for different commits?

Using the same or very similar commit messages across different
repositories is a very frequent occurrence for me.  The last such
message was "Bump copyright years", but through out the year I also use
messages such as "Fix spelling errors", after running a spell-checker on
all my packages.

Granted, those two examples didn't need a "template".  I also frequently
fix some class of error across many third-party packages, as part of my
work on Melpa and the Emacsmirror.  In such cases I often write a long,
message explaining why something should be done a certain way.  The
message is almost the same for every repository/package but I try to use
the names of the files in each particular repository, to make things more
engaging and actionable for each individual package maintainer.

Note that the command log-edit-save-comment is also used in code twice,
so the cost of making it a command is just the line " (interactive)".
If you feel this command is not useful enough to receive a default key
bindings, we can drop that, but the interactive form should remain.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75355; Package emacs. Full text available.

Message received at 75355 <at> debbugs.gnu.org:


Received: (at 75355) by debbugs.gnu.org; 5 Jan 2025 07:28:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 05 02:28:41 2025
Received: from localhost ([127.0.0.1]:59581 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tUL3x-000133-3y
	for submit <at> debbugs.gnu.org; Sun, 05 Jan 2025 02:28:41 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57160)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tUL3u-00012l-R8
 for 75355 <at> debbugs.gnu.org; Sun, 05 Jan 2025 02:28:39 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tUL3o-0004Ax-5y; Sun, 05 Jan 2025 02:28:32 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=0mPwm9XyG5zozpBGzCumdCyFN0Ue3biOGu2p1UX7R/k=; b=R4Je5gxRnVfZ
 h5j7F+w3hRfBAndY9BcVYvCOKgv5Vj1bw1YtH/fdGLTHFUuVdiYsVjUGFxag2GtmBVHL2YbBvTVch
 /4i9n1EZFeJF000+vgvmXbEu/OGnnBCduQ1XfO35aBMu1f1NT6t87lwYQHzHTLqP0nzRoLJxEHl0I
 Beryr1V33p7/w/+8yXWcHZw5xNLOm1bSy9aU8ZrQfxY28tgLSDphNFhN3GZsGd1+KCuAnOTSaQWQb
 kPs+WqIUTBqUa6SqvLuI1qTvTm5hreqOeRbqOuCn+gtikTpF0TPdN3ALqiaXM4H1yYL9H7VC2ao5P
 1j1hJOqYjR2zCyUMkzInkw==;
Date: Sun, 05 Jan 2025 09:28:29 +0200
Message-Id: <86a5c5afdu.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jonas Bernoulli <jonas@HIDDEN>
In-Reply-To: <8734hy1acx.fsf@HIDDEN> (message from Jonas Bernoulli on Sat, 
 04 Jan 2025 23:29:34 +0100)
Subject: Re: bug#75355: [PATCH 1/1] Improve comment cycling in log-edit
References: <20250104162859.13378-1-jonas@HIDDEN>
 <20250104171108.18590-1-jonas@HIDDEN> <86pll2bezh.fsf@HIDDEN>
 <8734hy1acx.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75355
Cc: 75355 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Jonas Bernoulli <jonas@HIDDEN>
> Cc: 75355 <at> debbugs.gnu.org
> Date: Sat, 04 Jan 2025 23:29:34 +0100
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> Date: Sat,  4 Jan 2025 18:11:08 +0100
> >> From:  Jonas Bernoulli via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> >> 
> >> Save the current message before cycling to older messages, making it
> >> possible to cycle back to that initial message.
> >
> > Thanks, but can you provide some rationale for this?  Is the
> > assumption that users need to make several commits that all share the
> > same comment or something?
> 
> That is one use-case for the feature as it exists now, yes.  Messages
> are already automatically saved once the user either finished or aborts
> the commit.
> 
> These changes don't really affect that.  I consider this additional
> automatic saving a bugfix.  Without it, a user may start typing a new
> message, decide to use a recent message instead, navigate to it but then
> change their mind about that, and then they would not be able to go back
> to the new message they had already started typing, because it was
> discarded when they moved a way from it.  By saving the new message when
> we move away from it, we make it possible to navigate back to it.

What do you mean by "move away" and "navigate", in the context of
log-edit?

> By additionally defining log-edit-save-comment as a command we gain the
> ability to save the message at random point.  This could, for example,
> be useful if we have to use very similar messages in different commits,
> potentially across multiple repositories.

Is this a frequent use case?  Why would the same log message be used
for different commits?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75355; Package emacs. Full text available.

Message received at 75355 <at> debbugs.gnu.org:


Received: (at 75355) by debbugs.gnu.org; 4 Jan 2025 22:29:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 04 17:29:43 2025
Received: from localhost ([127.0.0.1]:57840 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tUCeM-0000Dr-NQ
	for submit <at> debbugs.gnu.org; Sat, 04 Jan 2025 17:29:43 -0500
Received: from mail.hostpark.net ([212.243.197.30]:39008)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <jonas@HIDDEN>) id 1tUCeK-0000Dg-0i
 for 75355 <at> debbugs.gnu.org; Sat, 04 Jan 2025 17:29:41 -0500
Received: from localhost (localhost [127.0.0.1])
 by mail.hostpark.net (Postfix) with ESMTP id 25CFD164B1;
 Sat,  4 Jan 2025 23:29:37 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h=
 content-type:content-type:mime-version:message-id:date:date
 :references:in-reply-to:subject:subject:from:from; s=sel2011a;
 t=1736029776; bh=Oe7Ep9eVq5ZlWJ+g8Xs/Ln1rmeRGtiFAUoqsKjUeOIg=; b=
 0Hblm4zEQluQLv5dtEFIHH0NHqM/V8Khw9NadudXT/W9F2we2BerZn/r9x5BV1B4
 MRAO5SgMAOwnzCUXx4F376h6eXZ3MWXlJZ10gqkp74hMbZANl2rFTbjPbKHF/lvB
 8qlV8v2qyIISRSEZcckvU3wriEnvzB5dja6gnemYQes=
X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net
Received: from mail.hostpark.net ([127.0.0.1])
 by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224)
 with ESMTP id lyTs-0MFJB4D; Sat,  4 Jan 2025 23:29:36 +0100 (CET)
Received: from customer (localhost [127.0.0.1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits)
 server-digest SHA256) (No client certificate requested)
 by mail.hostpark.net (Postfix) with ESMTPSA id 8CD7816466;
 Sat,  4 Jan 2025 23:29:36 +0100 (CET)
From: Jonas Bernoulli <jonas@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75355: [PATCH 1/1] Improve comment cycling in log-edit
In-Reply-To: <86pll2bezh.fsf@HIDDEN>
References: <20250104162859.13378-1-jonas@HIDDEN>
 <20250104171108.18590-1-jonas@HIDDEN> <86pll2bezh.fsf@HIDDEN>
Date: Sat, 04 Jan 2025 23:29:34 +0100
Message-ID: <8734hy1acx.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75355
Cc: 75355 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Sat,  4 Jan 2025 18:11:08 +0100
>> From:  Jonas Bernoulli via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>> 
>> Save the current message before cycling to older messages, making it
>> possible to cycle back to that initial message.
>
> Thanks, but can you provide some rationale for this?  Is the
> assumption that users need to make several commits that all share the
> same comment or something?

That is one use-case for the feature as it exists now, yes.  Messages
are already automatically saved once the user either finished or aborts
the commit.

These changes don't really affect that.  I consider this additional
automatic saving a bugfix.  Without it, a user may start typing a new
message, decide to use a recent message instead, navigate to it but then
change their mind about that, and then they would not be able to go back
to the new message they had already started typing, because it was
discarded when they moved a way from it.  By saving the new message when
we move away from it, we make it possible to navigate back to it.

By additionally defining log-edit-save-comment as a command we gain the
ability to save the message at random point.  This could, for example,
be useful if we have to use very similar messages in different commits,
potentially across multiple repositories.  We could then write the
common part, save it as a "template", edit it some more, and finally
create a first commit.  Without the save command we could rely on the
automatic saving at the very end of that process, which would mean that
when creating the second commit we could not use the template as such,
but only template with the modifications for the first commit already
filled in.  More editing could be required to go from that to what we
actually want to use in the second commit.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75355; Package emacs. Full text available.

Message received at 75355 <at> debbugs.gnu.org:


Received: (at 75355) by debbugs.gnu.org; 4 Jan 2025 18:39:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 04 13:39:56 2025
Received: from localhost ([127.0.0.1]:57336 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tU940-0006d4-6q
	for submit <at> debbugs.gnu.org; Sat, 04 Jan 2025 13:39:56 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:35716)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tU93w-0006cp-C0
 for 75355 <at> debbugs.gnu.org; Sat, 04 Jan 2025 13:39:54 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tU93p-0001pg-8m; Sat, 04 Jan 2025 13:39:45 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=v8T1ywRXkJIuD3Lz8VKY1lZwh49QYccDo1Sdxe76C88=; b=EfRldWK6c6OV
 ucfWbUHRnusRUnTsNph+qnON5ftGjZ97eBnLe6U0EkIvuFsTkZhZOXaX5EqjRrKqSaS40SoF8R5S+
 /Fy5lJ8zzrvLyGDM/wSQTU8UHFjmXzbnPsXYpxffFD1ryUoz4RgXoP3VFrYMwmvTcEeWkkZf7O45o
 1FOqOWLqY350LM/JwiKaNjjgNmG4C477fCO1pkOpbXYudqdDaExmvYr/6NZRUCcgIBWQttoC2w6L7
 FrijCeQHOTKdbESF8SUPM38Oizy9P8dUZzhqb+LU6O5DKOew47K/KBe5dwjSFNoSSmbIBwfANOq4i
 hy05E8vWLgJd8pjxAJQtEQ==;
Date: Sat, 04 Jan 2025 20:39:30 +0200
Message-Id: <86pll2bezh.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jonas Bernoulli <jonas@HIDDEN>
In-Reply-To: <20250104171108.18590-1-jonas@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#75355: [PATCH 1/1] Improve comment cycling in log-edit
References: <20250104162859.13378-1-jonas@HIDDEN>
 <20250104171108.18590-1-jonas@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75355
Cc: 75355 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sat,  4 Jan 2025 18:11:08 +0100
> From:  Jonas Bernoulli via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> Save the current message before cycling to older messages, making it
> possible to cycle back to that initial message.

Thanks, but can you provide some rationale for this?  Is the
assumption that users need to make several commits that all share the
same comment or something?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75355; Package emacs. Full text available.

Message received at 75355 <at> debbugs.gnu.org:


Received: (at 75355) by debbugs.gnu.org; 4 Jan 2025 17:11:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 04 12:11:18 2025
Received: from localhost ([127.0.0.1]:57018 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tU7gD-0002eF-MU
	for submit <at> debbugs.gnu.org; Sat, 04 Jan 2025 12:11:18 -0500
Received: from mail.hostpark.net ([212.243.197.30]:37824)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <jonas@HIDDEN>) id 1tU7gB-0002dx-6V
 for 75355 <at> debbugs.gnu.org; Sat, 04 Jan 2025 12:11:16 -0500
Received: from localhost (localhost [127.0.0.1])
 by mail.hostpark.net (Postfix) with ESMTP id 9A7E316609;
 Sat,  4 Jan 2025 18:11:12 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h=
 content-transfer-encoding:mime-version:references:in-reply-to
 :x-mailer:message-id:date:date:subject:subject:from:from; s=
 sel2011a; t=1736010672; bh=RNVO10dRtzWblyR4a/7foQok8J5PPrhjZFd/c
 0qGAYw=; b=JbgGP4VMCGMh7sywaizCW/fROyJQhZzm3IYNn+OrFWWYHEi4Bjq6N
 AwmdF3ROdRNVswvw7G07et2c0Mwj80skGArhiEzZT4Xgmb0WHxa5ossrsQWHWOiw
 rgTzngIBy5Mq3vxfbVTAeHvnvcd1A3TthtryKxJmDsRt02BbmhbH44=
X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net
Received: from mail.hostpark.net ([127.0.0.1])
 by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224)
 with ESMTP id KWt0AlL1fQgZ; Sat,  4 Jan 2025 18:11:12 +0100 (CET)
Received: from customer (localhost [127.0.0.1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mail.hostpark.net (Postfix) with ESMTPSA id 093F616275;
 Sat,  4 Jan 2025 18:11:11 +0100 (CET)
From: Jonas Bernoulli <jonas@HIDDEN>
To: 75355 <at> debbugs.gnu.org
Subject: [PATCH 1/1] Improve comment cycling in log-edit
Date: Sat,  4 Jan 2025 18:11:08 +0100
Message-ID: <20250104171108.18590-1-jonas@HIDDEN>
X-Mailer: git-send-email 2.47.1
In-Reply-To: <20250104162859.13378-1-jonas@HIDDEN>
References: <20250104162859.13378-1-jonas@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75355
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Save the current message before cycling to older messages, making it
possible to cycle back to that initial message.

* lisp/vc/log-edit.el (log-edit-buffer-comment): New function.
(log-edit-save-comment): New command, using new function.
(log-edit-mode-map, log-edit-menu): Bind new command.
(log-edit-previous-comment): Use new function.

Port log-edit-comment-ring improvements from git-commit.el
---
 lisp/vc/log-edit.el | 62 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 59 insertions(+), 3 deletions(-)

diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index e23e7414a18..79ea89bc728 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -61,6 +61,7 @@ log-edit-mode-map
   "C-c C-d" #'log-edit-show-diff
   "C-c C-f" #'log-edit-show-files
   "C-c C-k" #'log-edit-kill-buffer
+  "C-c C-s" #'log-edit-save-comment
   "M-n"     #'log-edit-next-comment
   "M-p"     #'log-edit-previous-comment
   "M-r"     #'log-edit-comment-search-backward
@@ -86,6 +87,8 @@ log-edit-menu
     ["List files" log-edit-show-files
      :help "Show the list of relevant files."]
     "--"
+    ["Save comment"		log-edit-save-comment
+     :help "Save the current comment to comment history"]
     ["Previous comment"		log-edit-previous-comment
      :help "Cycle backwards through comment history"]
     ["Next comment"		log-edit-next-comment
@@ -280,15 +283,68 @@ log-edit-new-comment-index
 	(t stride))
        len))
 
+(defun log-edit-buffer-comment ()
+  "Return the comment in the current buffer.
+Remove lines after the scissors line (\"------- >8 ------\") and
+commented lines from the returned string.  Also remove leading and
+trailing whitespace.  If the comment consists solely of whitespace,
+return nil."
+  (let ((flush (concat "^" comment-start))
+        (str (buffer-substring-no-properties (point-min) (point-max))))
+    (with-temp-buffer
+      (insert str)
+      (goto-char (point-min))
+      (when (re-search-forward (concat flush " -+ >8 -+$") nil t)
+        (delete-region (line-beginning-position) (point-max)))
+      (goto-char (point-min))
+      (flush-lines flush)
+      (goto-char (point-max))
+      (unless (eq (char-before) ?\n)
+        (insert ?\n))
+      (setq str (buffer-string)))
+    (and (not (string-match "\\`[ \t\n\r]*\\'" str))
+         (progn
+           (when (string-match "\\`\n\\{2,\\}" str)
+             (setq str (replace-match "\n" t t str)))
+           (when (string-match "\n\\{2,\\}\\'" str)
+             (setq str (replace-match "\n" t t str)))
+           str))))
+
+(defun log-edit-save-comment ()
+  "Save current comment to `log-edit-comment-ring'."
+  (interactive)
+  (if-let* ((comment (log-edit-buffer-comment)))
+      (progn
+        (when-let* ((index (ring-member log-edit-comment-ring comment)))
+          (ring-remove log-edit-comment-ring index))
+        (ring-insert log-edit-comment-ring comment)
+        ;; This hook can be used, e.g., to store this in an alternative,
+        ;; repository-local ring.
+        (run-hooks 'log-edit-save-comment-hook)
+        (message "Comment saved"))
+    (message "Only whitespace and/or comments; message not saved")))
+
 (defun log-edit-previous-comment (arg)
   "Cycle backwards through VC commit comment history.
 With a numeric prefix ARG, go back ARG comments."
   (interactive "*p")
   (let ((len (ring-length log-edit-comment-ring)))
     (if (<= len 0)
-	(progn (message "Empty comment ring") (ding))
-      ;; Don't use `erase-buffer' because we don't want to `widen'.
-      (delete-region (point-min) (point-max))
+        (progn (message "Empty comment ring") (ding))
+      (when-let* ((comment (log-edit-buffer-comment))
+                  ((not (ring-member log-edit-comment-ring comment))))
+        (ring-insert log-edit-comment-ring comment)
+        (cl-incf arg)
+        (setq len (ring-length log-edit-comment-ring)))
+      ;; Delete the message but not the instructions at the end.
+      (save-restriction
+        (goto-char (point-min))
+        (narrow-to-region
+         (point)
+         (if (re-search-forward (concat "^" comment-start) nil t)
+             (max 1 (- (point) 2))
+           (point-max)))
+        (delete-region (point-min) (point)))
       (setq log-edit-comment-ring-index (log-edit-new-comment-index arg len))
       (message "Comment %d" (1+ log-edit-comment-ring-index))
       (insert (ring-ref log-edit-comment-ring log-edit-comment-ring-index)))))
-- 
2.47.1





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75355; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Jan 2025 16:29:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 04 11:29:25 2025
Received: from localhost ([127.0.0.1]:56853 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tU71h-0000cI-2B
	for submit <at> debbugs.gnu.org; Sat, 04 Jan 2025 11:29:25 -0500
Received: from lists.gnu.org ([2001:470:142::17]:37870)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <jonas@HIDDEN>) id 1tU71c-0000bw-E0
 for submit <at> debbugs.gnu.org; Sat, 04 Jan 2025 11:29:23 -0500
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 <jonas@HIDDEN>) id 1tU71V-00061u-Be
 for bug-gnu-emacs@HIDDEN; Sat, 04 Jan 2025 11:29:13 -0500
Received: from mail.hostpark.net ([212.243.197.30])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jonas@HIDDEN>) id 1tU71T-0002YV-0K
 for bug-gnu-emacs@HIDDEN; Sat, 04 Jan 2025 11:29:13 -0500
Received: from localhost (localhost [127.0.0.1])
 by mail.hostpark.net (Postfix) with ESMTP id C82EA164AE;
 Sat,  4 Jan 2025 17:29:03 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h=
 content-transfer-encoding:mime-version:x-mailer:message-id:date
 :date:subject:subject:from:from; s=sel2011a; t=1736008143; bh=ZJ
 W/gSAjqp6jL7Kl35Nx5KoYtp88SzmMAF8Lcn3BAT4=; b=aQwZBEsSzVPjlj/Aty
 G76bMLG+h5lI+oexa53zVghtutKWw7tO5K8OPHhgKkcNkf9MgrOMPlUsAzHea0Zz
 I1XDKBf8f5m6Kag4CRbnrQ749Vcz4r/55dozCXPfoCNd0priN+vrSU1NX1vy6WHU
 UpNiry/pwWJ1NfQOoSMBYPSI0=
X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net
Received: from mail.hostpark.net ([127.0.0.1])
 by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224)
 with ESMTP id mS5bcm0yehJQ; Sat,  4 Jan 2025 17:29:03 +0100 (CET)
Received: from customer (localhost [127.0.0.1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mail.hostpark.net (Postfix) with ESMTPSA id 45F0C1648A;
 Sat,  4 Jan 2025 17:29:02 +0100 (CET)
From: Jonas Bernoulli <jonas@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH 0/1] Improve comment cycling in log-edit
Date: Sat,  4 Jan 2025 17:28:59 +0100
Message-ID: <20250104162859.13378-1-jonas@HIDDEN>
X-Mailer: git-send-email 2.47.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=212.243.197.30; envelope-from=jonas@HIDDEN;
 helo=mail.hostpark.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

Hello,

In https://lists.gnu.org/archive/html/emacs-devel/2025-01/msg00041.html
we are discussing adding git-commit.el to Emacs.  This change is triggered
by that discussion but what I suggest here is to first move some code out
of git-commit.el and into log-edit.el.

Previously git-commit.el wrapped around some commands from log-edit.el
to provide better variants.  The following patch instead modifies the
existing commands.  It also adds a new command and a new helper function.

     Cheers,
     Jonas


Jonas Bernoulli (1):
  Improve comment cycling in log-edit

 lisp/vc/log-edit.el | 62 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 59 insertions(+), 3 deletions(-)

-- 
2.47.1





Acknowledgement sent to Jonas Bernoulli <jonas@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#75355; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 13 Feb 2025 10:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.