[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding git-commit highlight mode?
From: |
Konstantin Kharlamov |
Subject: |
Re: Adding git-commit highlight mode? |
Date: |
Thu, 02 Jan 2025 22:07:46 +0300 |
User-agent: |
Evolution 3.54.2 |
On Thu, 2025-01-02 at 21:01 +0200, Eli Zaretskii wrote:
> > From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
> > Date: Thu, 02 Jan 2025 21:30:53 +0300
> >
> > Hi, just wanted to ask this before potentially taking on the
> > initiative
> > to only find the code will get rejected.
> >
> > I think a ballpark estimate of 90% of Git usage among CVSes in the
> > modern world is fair to assume.
> >
> > But Emacs seems to be the only widely popular editor that still
> > doesn't
> > provide OOTB at least syntax highlight for git-commit format. So,
> > does
> > anyone have opposition to adding a major mode that would be bound
> > to
> > filenames like `COMMIT_EDITMSG` and others, and would provide the
> > aforementioned highlight?
>
> FWIW, I have this in my ~/.emacs since about forever:
>
> (define-derived-mode text-with-comments-mode text-mode "Text#"
> "Text mode with comment syntax."
> (setq-local comment-start "#")
> (setq-local comment-start-skip
> (concat (regexp-quote comment-start) "+\\s *"))
> (setq-local font-lock-defaults '(nil nil t nil))
> (set-syntax-table
> (let ((table (make-syntax-table)))
> (modify-syntax-entry ?\# "<" table)
> table)))
> (add-to-list 'auto-mode-alist '("COMMIT_EDITMSG\\'" . text-with-
> comments-mode))
>
> > If there's no opposition, I could write such mode (it seems to be a
> > simple one), but I don't promise anything because Idk how long this
> > discussion will go and what's gonna happen tomorrow, etc… I just
> > had
> > some spare time and motivation today, so decided to at least start
> > the
> > discussion.
> >
> > I don't have plans for adding complicated features besides just
> > syntax
> > highlight. I think if anyone wishes they could be added later. And
> > indentation support from text-mode I think should be fine.
>
> Do you plan to make this mode be descendant of change-log-mode?
> something else?
I thought of deriving from text-mode. I don't know much of change-log-
mode besides what it says in the mode title and now that I'm looking at
mode description it also sounds pretty vague. So… I could derive it
from change-log-mode if you think it's useful, but I'd rely on your
judgment here 😊
- Adding git-commit highlight mode?, Konstantin Kharlamov, 2025/01/02
- Re: Adding git-commit highlight mode?, Jonas Bernoulli, 2025/01/03
- Re: Adding git-commit highlight mode?, Eli Zaretskii, 2025/01/02
- Re: Adding git-commit highlight mode?, Arsen Arsenović, 2025/01/02
- Re: Adding git-commit highlight mode?, Stefan Kangas, 2025/01/02