From: Jim Porter <jporterbugs@gmail.com>
To: "Jonas Bernoulli" <jonas@bernoul.li>,
"Björn Bidar" <bjorn.bidar@thaodan.de>,
"Konstantin Kharlamov" <Hi-Angel@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: Adding git-commit highlight mode?
Date: Sun, 5 Jan 2025 10:47:32 -0800 [thread overview]
Message-ID: <e8ac6319-323c-cafe-ba38-3b803fca4f0d@gmail.com> (raw)
In-Reply-To: <87sepyeo9t.fsf@bernoul.li>
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 <email>"
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.
next prev parent reply other threads:[~2025-01-05 18:47 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-02 18:30 Adding git-commit highlight mode? Konstantin Kharlamov
2025-01-02 19:01 ` Eli Zaretskii
2025-01-02 19:07 ` Konstantin Kharlamov
2025-01-02 20:10 ` Stefan Kangas
2025-01-02 21:01 ` Eli Zaretskii
2025-01-02 21:38 ` Stefan Kangas
2025-01-03 5:26 ` Jim Porter
2025-01-02 21:40 ` Konstantin Kharlamov
2025-01-03 5:29 ` Jim Porter
2025-01-03 13:08 ` Jonas Bernoulli
2025-01-02 20:11 ` Eli Zaretskii
2025-01-02 21:19 ` Arsen Arsenović
2025-01-02 21:53 ` Stefan Kangas
2025-01-02 22:27 ` Arsen Arsenović
2025-01-03 21:02 ` Sean Whitton
2025-01-04 7:17 ` Eli Zaretskii
2025-01-04 9:52 ` Sean Whitton
2025-01-15 15:59 ` Konstantin Kharlamov
2025-01-18 18:06 ` Jim Porter
2025-01-03 6:45 ` Eli Zaretskii
2025-01-02 19:17 ` Jim Porter
2025-01-02 19:19 ` Konstantin Kharlamov
2025-01-02 20:17 ` Eli Zaretskii
2025-01-03 21:14 ` Björn Bidar
2025-01-05 14:39 ` Philip Kaludercic
2025-01-05 22:48 ` Konstantin Kharlamov
[not found] ` <87r05jbnw2.fsf@>
2025-01-03 22:52 ` Konstantin Kharlamov
2025-01-04 1:22 ` Björn Bidar
[not found] ` <87v7uv9xub.fsf@>
2025-01-04 1:45 ` Konstantin Kharlamov
2025-01-05 0:46 ` Björn Bidar
[not found] ` <871pxiulxz.fsf@>
2025-01-05 3:55 ` Konstantin Kharlamov
2025-01-04 12:50 ` Jonas Bernoulli
2025-01-04 17:20 ` Jonas Bernoulli
2025-01-05 0:32 ` Björn Bidar
2025-01-05 18:47 ` Jim Porter [this message]
2025-01-05 0:42 ` Björn Bidar
[not found] ` <875xmuum48.fsf@>
2025-01-05 3:49 ` Konstantin Kharlamov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e8ac6319-323c-cafe-ba38-3b803fca4f0d@gmail.com \
--to=jporterbugs@gmail.com \
--cc=Hi-Angel@yandex.ru \
--cc=bjorn.bidar@thaodan.de \
--cc=emacs-devel@gnu.org \
--cc=jonas@bernoul.li \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).