From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#57400: 29.0.50; Support sending patches from VC directly Date: Tue, 11 Oct 2022 19:30:50 +0000 Message-ID: <87edvecg45.fsf@posteo.net> References: <84v8qgn1z9.fsf@iki.fi> <87h71zo3p8.fsf@posteo.net> <87sfljmgwz.fsf@posteo.net> <87y1twvima.fsf@posteo.net> <84sfk2p846.fsf@iki.fi> <87h70i9ntt.fsf@posteo.net> <87edvl6vbj.fsf@gmail.com> <8735c1nn3y.fsf@posteo.net> <877d1d6rcy.fsf@gmail.com> <867d1cjc8w.fsf@mail.linkov.net> <87o7unkggk.fsf@posteo.net> <86edvids93.fsf@mail.linkov.net> <87zge52nx0.fsf@posteo.net> <86sfjvqz68.fsf@mail.linkov.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="13239"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Robert Pluim , 57400@debbugs.gnu.org, Antoine Kalmbach To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 11 21:42:51 2022 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 1oiL9O-0003H5-1C for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 Oct 2022 21:42:50 +0200 Original-Received: from localhost ([::1]:41366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiL9M-0003Ep-Q9 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 Oct 2022 15:42:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiKyw-00039C-Lu for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2022 15:32:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55822) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiKyw-0006aW-Cd for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2022 15:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oiKyw-0006bc-0c for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2022 15:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Oct 2022 19:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57400 X-GNU-PR-Package: emacs Original-Received: via spool by 57400-submit@debbugs.gnu.org id=B57400.166551666525326 (code B ref 57400); Tue, 11 Oct 2022 19:32:01 +0000 Original-Received: (at 57400) by debbugs.gnu.org; 11 Oct 2022 19:31:05 +0000 Original-Received: from localhost ([127.0.0.1]:54900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiKy1-0006aQ-1f for submit@debbugs.gnu.org; Tue, 11 Oct 2022 15:31:05 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:56571) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiKxx-0006Zu-HJ for 57400@debbugs.gnu.org; Tue, 11 Oct 2022 15:31:03 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 7C314240026 for <57400@debbugs.gnu.org>; Tue, 11 Oct 2022 21:30:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665516655; bh=s7LuoIG33seYaozKZWMbqfeBypX69Sq04sJ2452q4t0=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=ryjPMzuG/IRHDFiqoI91avbxFrTDPKqZ64vYRlwQdVoS4uS3KW4SpGg4ToPV69sJZ 1U56LbvIBI0GB7mJZcq2jIQvPqOGA5Fht1aqtpFsH5nOvO1zpWf0H++JORn7Mc/w/7 HdUmN+mV6M/VxbklDPpoA+rN7jFnKF63bQixz7RkKVCkz5F0IFtHhZYB2CTd06N372 stPbBHYxX0wwYjONEw2oLB8Bj1BrdZdJuh+mDLjwuftCVr3Z4NJMb3N2+Zr41yohZ/ RYiTQKcjB62TFRUWKWyybHdBGGbKkK1JD4zulgoKs7nAQS36HR+clb0bnf3f6JVzEC 4Y8/mB3m4nNHQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Mn5VM29jVz6tmX; Tue, 11 Oct 2022 21:30:51 +0200 (CEST) In-Reply-To: <86sfjvqz68.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 10 Oct 2022 22:03:11 +0300") Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB 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" Xref: news.gmane.io gmane.emacs.bugs:245135 Archived-At: --=-=-= Content-Type: text/plain Juri Linkov writes: >> Again, regarding `crm-separator' I don't know if this is a value that >> people change or not (perhaps it should be changed to a defconst). > > At least, it's not defcustom, so it's not intended for user customization. > >> I can also imagine that the initial input outside of a log buffer ought >> to just be the last commit. > > Depends on whether this is one of the most popular workflows. > >>> Additional question: shouldn't the behavior of >>> vc-prepare-patches-separately=nil be equivalent to >>> vc-prepare-patches-separately=t when only one revision is given? Both >>> cases create just one mail. So when vc-prepare-patches-separately is >>> nil, could it extract the subject from the single revision? Or maybe >>> vc-prepare-patches-separately should support a new customization value >>> for this? >> >> Yes, but the formatting is different. In the one case you attach a >> patch to a regular message, while in the other case the message is >> prepared in such a way that (at least when using Git) the entire message >> is a valid patch, where we can use "git am". > > Hmm, I tried both variants, and still not sure which is better > for the 1-patch case. However, what I definitely suggest to do is > to get rid of recursive-edit, that also Robert noticed on emacs-devel. > recursive-edit is too fragile for modal editing, because such > commands as keyboard-escape-quit can easily break it. Without > recursive-edit you can just create all mail buffers at once. > Then after sending one mail, its buffer gets buried, and the > next mail buffer will be shown instead, etc. I have done all of the above and am prepared to push the changes, but before I do I was wondering if anyone would have any objections to the following changes to vc-git.el: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-vc-vc-git.el-vc-git-rev-parse-Abbreviate-commit.patch >From 7d3a07bc6fdfae579681d8e71685d94b7bfa9ad3 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 11 Oct 2022 21:11:20 +0200 Subject: [PATCH 1/2] * lisp/vc/vc-git.el (vc-git--rev-parse): Abbreviate commits --- lisp/vc/vc-git.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ea06ccaf87..3822bb8574 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1677,8 +1677,10 @@ vc-git-previous-revision (defun vc-git--rev-parse (rev) (with-temp-buffer (and - (vc-git--out-ok "rev-parse" rev) - (buffer-substring-no-properties (point-min) (+ (point-min) 40))))) + (vc-git--out-ok "rev-parse" "--short" rev) + (string-trim-right + (buffer-substring-no-properties (point-min) (min (+ (point-min) 40) + (point-max))))))) (defun vc-git-next-revision (file rev) "Git-specific version of `vc-next-revision'." -- 2.37.3 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Return-symbolic-commit-for-the-working-revision-if-p.patch >From 8bb9fbfdb39d1fd17430f24e9572bf4dde830758 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 11 Oct 2022 21:14:48 +0200 Subject: [PATCH 2/2] Return symbolic commit for the working revision if possible * lisp/vc/vc-git.el (vc-git-working-revision): Attempt to use 'vc-git-symbolic-commit'. --- lisp/vc/vc-git.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 3822bb8574..d17c02852c 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -373,8 +373,9 @@ vc-git-state (defun vc-git-working-revision (_file) "Git-specific version of `vc-working-revision'." - (let (process-file-side-effects) - (vc-git--rev-parse "HEAD"))) + (let* ((process-file-side-effects nil) + (commit (vc-git--rev-parse "HEAD"))) + (or (vc-git-symbolic-commit commit) commit))) (defun vc-git--symbolic-ref (file) (or -- 2.37.3 --=-=-=--