[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: |
Sun, 22 Sep 2024 23:23:06 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Yuan Fu <casouri@gmail.com> writes:
>> On Sep 21, 2024, at 10:43 PM, Po Lu <luangruo@yahoo.com> wrote:
>>
>> Stefan Kangas <stefankangas@gmail.com> writes:
>>
>>>> Please fill ChangeLog entries in commit messages to a width of 64
>>>> columns, not 71 or 72, as here.
>>>
>>> I don't want to get into another argument about this, but I don't see
>>> any problem with the above formatting, FWIW.
>>>
>>> In any case, I really don't think it is a good use of our time to police
>>
>> It is a good (and a exceedingly slight) use of my time.
>>
>>> the recently introduced default of 64 columns here. We never did that
>>> before, when the default in `vc-git-log-edit-mode' was 70 characters,
>>> and there is no reason to start doing it now.
>>
>> That point is moot when most of us were self-consciously observing this
>> standard before it was formalized in .dir-locals.el.
>
> 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.
Thinking *more* about it, setting git-commit-major-mode to log-edit-mode
in .dir-locals-2.el sounds like TRT in theory; in practice though I bet
it would lead to "interesting" fireworks².
¹
```
(defun my/git-upstreams ()
;; TODO: memoize, perhaps?
(seq-uniq
(seq-keep
(lambda (remote-desc)
(and (string-match "\\`.*\t\\(.*\\) (fetch)\\'" remote-desc)
(match-string 1 remote-desc)))
(process-lines "git" "remote" "-v"))))
(defun my/emacs-repo-p (upstreams)
"Guess whether we are working in the Emacs repository.
UPSTREAMS is a list of fetch URLs."
(member "https://git.savannah.gnu.org/git/emacs.git" upstreams))
(defvar my/git-commit-fill-columns
'((my/emacs-repo-p . 63)))
(cl-defun my/git-commit-maybe-set-fill-column ()
(let ((remotes (my/git-upstreams)))
(pcase-dolist (`(,pred . ,column) my/git-commit-fill-columns)
(when (funcall pred remotes)
(cl-return-from my/git-commit-maybe-set-fill-column
(setq fill-column column))))))
(add-hook
'git-commit-setup-hook
'my/git-commit-maybe-set-fill-column)
```
² Off the top of my head:
* bindings conflicting, e.g. log-edit-done vs with-editor-finish:
guessing the minor mode wins in that case… 🫣
* log-edit-generate-changelog-from-diff being ineffectual because
log-edit-diff-function is not set up: something to kludge around, though
Magit does also provide magit-commit-add-log from the diff buffer 🤷
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Po Lu, 2024/09/18
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Stefan Kangas, 2024/09/21
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Eli Zaretskii, 2024/09/22
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Po Lu, 2024/09/22
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Yuan Fu, 2024/09/22
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324),
Kévin Le Gouguec <=
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Robert Pluim, 2024/09/23
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Eli Zaretskii, 2024/09/23
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Kévin Le Gouguec, 2024/09/23
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Eli Zaretskii, 2024/09/23
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Kévin Le Gouguec, 2024/09/24
- Re: emacs-30 f0daa2f2153: Conservative heuristic for tree-sitter parser ranges (bug#73324), Yuan Fu, 2024/09/26