I was using following answer: https://emacs.stackexchange.com/a/57535/18414 to set markdown on the .git/COMMIT_EDITMSG
file.
(add-to-list 'auto-mode-alist
'("/\\.git/COMMIT_EDITMSG\\'" . markdown-mode))
My .gitconfig
file, to open commit message with emacs
:
[core]
editor = TERM=xterm-256color emacsclient -t -q
On my emacs-daemon magit-git
was enable.
Now during the commit (due to some squash operations in git), I see the commit messag along with the opened magit-diff:
window.
Example image:
When I check the major-mode
it became Local in buffer COMMIT_EDITMSG; global value is fundamental-mode
.
Afterwards, when I added into COMMIT_EDITMSG
file and do C-s C-x
, commit fails and I get following message:
fatal: could not read commit message: No such file or directory
But instead if I re-enable markdown-mode
, save and exit there would be no error.
[Q] Is it possible to force markdown-mode
during git commit?
markdown-mode
undermagit-mode-hook
, or is it even possible. If I can't accomplish it, my only option is seems likeType C-c C-c to finish, or C-c C-k to cancel
– alper Jul 01 '20 at 21:01customize
link fromC-h v git-commit-major-mode
, orsetq
it in your init file. – phils Jul 01 '20 at 21:020 = text-mode 1= No major mode
. I setted to no major mode but didn't help – alper Jul 01 '20 at 21:06(setq git-commit-major-mode 'markdown-mode)
– phils Jul 01 '20 at 21:08markdown-mode
is enables on the file but still it generates a errorfatal: could not read commit message: No such file or directory
. But even mark-down mode seems on when I doM-x mardown-mode
save and close error is seems gone – alper Jul 01 '20 at 21:11major-mode
still seems asfundamental-mode
:-( – alper Jul 01 '20 at 21:14major-mode
's global value will always befundamental-mode
-- but the global value of this variable is irrelevant. – phils Jul 01 '20 at 21:29markdown-mode
. But i have to domarkdown-mode
under M-x to handle the error. If I will able to solve it , i will update – alper Jul 01 '20 at 21:39customize
issue forgit-commit-major-mode
(and even includes markdown as a default option). That alone won't change anything else, but I felt it was worth noting. – phils Jul 01 '20 at 22:26emacs
started clean during commitwith-editor-finish
is not detected. I had to runmagit-status
but stillC-c C-c
won't bind towith-editor-finish
on the buffer forCOMMIT_EDITMSG
– alper Jul 05 '20 at 23:20