emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser


From: Kévin Le Gouguec
Subject: Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324)
Date: Mon, 23 Sep 2024 19:24:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Kévin Le Gouguec <kevin.legouguec@gmail.com>
>> Cc: Po Lu <luangruo@yahoo.com>,  Stefan Kangas <stefankangas@gmail.com>,
>>  emacs-devel@gnu.org
>> Date: Sun, 22 Sep 2024 23:23:06 +0200
>> 
>> Yuan Fu <casouri@gmail.com> writes:
>> 
>> > I took a look and it’s set for log-edit-mode only. It would be nice if 
>> > magit can pick it up. I’m sure a lot of people (me included) use magit for 
>> > developing Emacs. The only problem is magit’s commit message editing 
>> > buffer doesn’t have a special major mode. It does git-commit-mode which is 
>> > a minor mode, and runs git-commit-setup-hook. But I’m not sure how to edit 
>> > dir-locals to set fill-column using a hook or minor mode.
>> 
>> Kludge from my personal config reproduced below¹, if it can help.  It
>> adds a function to git-commit-setup-hook that sets fill-column when it
>> detects that one of the remotes is Emacs's Savannah repo.
>> 
>> Thinking more about it, and considering the existence of the
>> git-commit-major-mode variable, I guess one could also
>> 
>> 1) define a major mode derived from text-mode in their personal config;
>> 2) add a .dir-locals-2.el file to their Emacs checkout that sets
>> git-commit-major-mode to that-new-mode, and fill-column to
>>   *checks config*
>> 63
>>   *checks discussion*
>> ^W64
>>   *ponders git-blaming to see what Past Self has to say for himself*
>>   *looks at the time*
>>   *you're off the hook, Past Self*
>> for that-new-mode.
>
> Isn't it a bug in magit that it doesn't do something like that
> already?  Fill column is just the tip of an iceberg, because a log
> message is generally human-readable text, and so should benefit from
> other features of Text mode and its descendants, like spell-checking
> etc.

It does try to do "something like that"; AFAIU the two main knobs are:

* git-commit-major-mode lets users pick their preferred text-adjacent
major mode (or it lets maintainers choose it, e.g. setting that variable
in a checked-in .dir-locals.el; the default is text-mode),

* git-commit-setup-hook lets users turn on useful log-editing features;
the defcustom includes various opt-in functions.  Robert mentioned
magit-generate-changelog; there's also git-commit-turn-on-flyspell and
bug-reference-mode.

(There's also a mysterious git-commit-setup-changelog-support that
checks for

  (fboundp 'log-indent-fill-entry) ; New in Emacs 27

but I can't find any trace of log-indent-fill-entry in the tree so not
sure what that's about)

So what's "missing" from Magit's git-commit.el is a knob dedicated to
the fill-column for commit messages.  Quotes around "missing" because a
dedicated git-commit-fill-column defcustom used to exist, but was
eventually removed:

    <https://github.com/magit/magit/issues/2848>

(My takeaway skimming that thread: fill-column ought be enough)

> Perhaps magit should simply use log-edit-mode?
>
> Should we perhaps submit a feature request to the magit developers?

Maybe, though if core contributors are already using Magit and the only
"clue" is the occasional mis-filled changelog, perhaps the status quo is
not so bad, if we have a reliable answer to that problem.

(I realize my previous message might have made it look inordinately hard
to make git-commit do TRT for Emacs changelogs, but TBH a good chunk of
that message was theory-crafting, and another chunk was my convoluted
personal config; I think Robert's answer shows things can be simpler)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]