From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: Re: Adding git-commit highlight mode? Date: Sun, 5 Jan 2025 10:47:32 -0800 Message-ID: References: <37733be4476e1c2b6e873c967c79cb0035959a9e.camel@yandex.ru> <083310b3-a288-5c75-c835-84595e134682@gmail.com> <56c9eadd95367cd3fd7c8414dc3e86b243a4b3d7.camel@yandex.ru> <87sepyeo9t.fsf@bernoul.li> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23965"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Jonas Bernoulli , =?UTF-8?Q?Bj=c3=b6rn_Bidar?= , Konstantin Kharlamov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 05 19:48:30 2025 Return-path: Envelope-to: ged-emacs-devel@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 1tUVfp-00067b-S9 for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Jan 2025 19:48:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUVf1-0008WT-Gp; Sun, 05 Jan 2025 13:47:39 -0500 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 1tUVez-0008WD-TL for emacs-devel@gnu.org; Sun, 05 Jan 2025 13:47:38 -0500 Original-Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tUVey-00022M-0T for emacs-devel@gnu.org; Sun, 05 Jan 2025 13:47:37 -0500 Original-Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-21636268e43so7652205ad.2 for ; Sun, 05 Jan 2025 10:47:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736102854; x=1736707654; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=yh/9gRaohwp2ByItFRNM+jebRMRdjNDXsP5068uTzTU=; b=WAkRzpnNGTNu9JnrYaFS+nBXO9PdLdaLOH42+67k3Rb8PV+Imq3GvDdjRM5uR4YRYJ JtOSS82B1yh0XEdafStMCcjSXMF7WPGGOwhosaggcLjzy/TVttsFNWNaRPHCySdcAqOH VOzUUNcnMY39tWNJ+FFc/vC4TlgSoguFeW9nWMzvBN9iMXluElxMRMaGfhaP7KZ+26G3 8gaTcPHk+OLuvbUu5gUVQ3Pya58htBZJcIse6gjyEUmXPcUmb2CybymduPaCRtvvT9cC a1kirctpueq3ZxPN7ELXaEpJoIkkazCmZlKfQyD/CznkSqoAQnKtDM2CMiYPrJpe/Fgu iFnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736102854; x=1736707654; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yh/9gRaohwp2ByItFRNM+jebRMRdjNDXsP5068uTzTU=; b=iNAqFPE4SwRfBco9D5TZ8LmS0y9noBICXfDrGotGu/CbAmdOZgDoQYNHKI/K0M6GKI o3Zhy2/+GBmDkVMVmQxFX7kcWTXYDcDJ9xk/jhZ+bZacFUTAj+waac6Oli1utpzw7qUG K9HAJIj4aA6XUkVO5dql3lU0tyGWj8Shb/5Cq9NiBPJrQUlZroHDGWD2jAEu3IRJsc7J Dyjh3qhT/UnDZ9bBQNgfEP/McNxg3jOhlidBjDCybhzB+BMuSgN2kg9lKQ1ctTs0eT+u hOKpareW+QmsVhHXrSZOqSBTHldpDrIr5KI4UdOoARhXhjgoJftv4NY6nRQE1Q4rMKqz EubQ== X-Gm-Message-State: AOJu0YwBApm6VYp4F8FFLerE0qplH3ZV7ai9iZB+NsVeeQHbGsoAvppI Prltuk5igENgwxKXUFRmRy5mUngncULdf2iwgI1mvvkXQ9c5HP0v X-Gm-Gg: ASbGncvh/Q0MqIqYseuOEAz+x5RE3z9t3cluSlPtEpLVLDpqo72f18H5LCu2aMyYXk9 wlx/7uwDclIVbSO8h4fKjGrAErs3Mg479BJausg7VLWob8w+9zwJnxTki2D3AVc8Yu0kUg1ppKl gXnTlKSzIzRe2dtrhYLtmeugpgp7z/bFodZLYrZT9GtqMSEGWqiC28j0AuSY02SZ3eQK1LWHW19 CX61VzKxfUBD97nHxSV6YfYUAcYDrHiZEQSAcXX6CIWFyN4IxIDzKiSo8ER2BAyQwVephdN2JpZ l6PPvide/vNBNcDK/5FJy6+csd9FrlRRIw== X-Google-Smtp-Source: AGHT+IHCgD3BIcx9gqJfnhPI7dsRbJacTV/HLZnqqBRG8JHp/WcBr62WM39uXCSGK/Eo0j1t4+f91Q== X-Received: by 2002:a05:6a21:e8d:b0:1e1:adcd:eae5 with SMTP id adf61e73a8af0-1e5e0846948mr82274588637.42.1736102854061; Sun, 05 Jan 2025 10:47:34 -0800 (PST) Original-Received: from [192.168.1.2] (syn-023-240-098-037.res.spectrum.com. [23.240.98.37]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-869bba80047sm24638161a12.44.2025.01.05.10.47.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Jan 2025 10:47:33 -0800 (PST) Content-Language: en-US In-Reply-To: <87sepyeo9t.fsf@bernoul.li> Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:327727 Archived-At: On 1/4/2025 4:50 AM, Jonas Bernoulli wrote: > 1. Font-locking, including for "violations of the conventions" like > non-empty second line and overly long lines. My code has font-locking, but it's very basic. It mostly just font-locks comments and a few syntactic bits in the default Git comment (like the rebase verbs). I wouldn't mind more font-locking for my mode though. > 2. Support for inserting "Git trailers" (here still called > "pseudo-headers"). E.g., "Signed-off-by: Name " That makes sense and would probably be pretty easy to add to my mode. > 3. Support for nagging the user about violations of the conventions > when trying to finish the commit. Maybe this could just be a hook in my mode? Then if it becomes built-in, Emacs just provides the basics, but Magit (or some other package) can enhance the experience however it likes. > 4. Options to control whether certain optional functionality, such as > flyspell, is turned on. I imagine the usual mode hooks would suffice for this, at least for a "minimal" commit msg mode. > 5. Support for cycling through past messages. This is based on similar > functionality in log-edit.el. It might be best to just port the > improvements to that built-in library. I don't know anything about log-edit, but if we're upstreaming something, I think it makes sense to improve log-edit to handle this so we're not reinventing the wheel. > 6. Allow for an arbitrary major-mode to be used. git-commit-mode is > just minor-mode which enables additional font-locking, adds to some > hooks, and adds some key bindings. However we briefly pretend that > git-commit-mode is a major-mode, so that .dir-locals[-2].el settings > can be taken into account. This is a good idea and would hopefully resolve the question elsewhere in the thread about whether to inherit from change-log-mode or not. > 7. Setup commands for finishing and aborting the commit process in > co-operation with magit and with-editor. For what it's worth, my package works fine with 'with-editor' without needing to do anything special. That's probably because it's meant to be used when you call "git commit" from a shell, so the 'with-editor' tricks just work. It even works via Eshell over Tramp (all due to 'with-editor' I'm sure). If Magit needs some extra setup, maybe we could just provide some hooks as needed. > - I imagine that one likely way of doing it is to ripping out the Magit- > and With-Editor specific bits, and instead adding hooks and such, to > allow Magit to bring them back. Maybe that would work well for > me/Magit, put it could also turn out to be very painful. It would > certainly complicate the code. Despite what I wrote above, I don't think there's any *need* for Magit to use my package, even if it gets upstreamed. I think all the symbol names in my code are different from Magit, though to be fair I haven't looked closely at Magit's code so that I could do a clean implementation. > - Many users are going to stick to Emacs releases that don't have a > bundled git-commit.el for many years to come (beyond the end of the > decade, I am afraid). It will become increasingly hard for me to > continue to support Emacs releases from before the addition. If we do want to pursue Magit using this code, then I agree with your comment elsewhere that we should distribute it on ELPA as well so that you don't need to worry about the Emacs version. I'm happy to work on the basics for this so long as there's a clear direction. I don't know if we need to provide everything Magit would need immediately, so long as we don't paint ourselves into a corner. It seems the first big decision would be whether my code should be a major or minor mode. Once we resolve that, I think we could probably upstream parts of my code into Emacs and then keep adding features gradually. So long as this initial mode doesn't conflict with Magit, then I think we can just continue independently for a while, with the eventual goal of making it *possible* for Magit to use the mode.