[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding git-commit highlight mode?
From: |
Eli Zaretskii |
Subject: |
Re: Adding git-commit highlight mode? |
Date: |
Thu, 02 Jan 2025 21:01:12 +0200 |
> 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?