[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit d46270cb65 3/4: git-commit-setup-font-lock: Set
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit d46270cb65 3/4: git-commit-setup-font-lock: Set comment-end to the empty string |
Date: |
Mon, 21 Aug 2023 12:59:47 -0400 (EDT) |
branch: elpa/git-commit
commit d46270cb65e24e131483ee5976d7c040bfcffd57
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
git-commit-setup-font-lock: Set comment-end to the empty string
Some major-modes used while editing commit messages, may set that
variable and other `comment-*' variables to values that are not
compatible with Git's understanding of comments, which always only
uses a comment character at the beginning, either the default "#" or
what is specified using `core.commentchar'. Git's understanding of
how comments are delimited takes precedence over the major-modes
style, because it is Git that strips the comments.
`markdown-mode', for example, sets `comment-start' to "<!--" and
`comment-end' to "-->"; and we failed to override the latter until
now.
Furthermore, `markdown-fill-paragraph' does not handle Git-style
comments, which is to be expected, but forces us neutralize it when
called on a comment. This is not necessary for any of the other
modes we suggest for `git-commit-major-mode'.
Closes #4990.
Replaces #4991.
---
lisp/git-commit.el | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lisp/git-commit.el b/lisp/git-commit.el
index 2b39bba00c..0524aad14e 100644
--- a/lisp/git-commit.el
+++ b/lisp/git-commit.el
@@ -1076,8 +1076,15 @@ Added to `font-lock-extend-region-functions'."
(buffer-substring (point) (line-end-position)))))
"#"))
(setq-local comment-start-skip (format "^%s+[\s\t]*" comment-start))
+ (setq-local comment-end "")
(setq-local comment-end-skip "\n")
(setq-local comment-use-syntax nil)
+ (when (derived-mode-p 'markdown-mode)
+ (setq-local fill-paragraph-function
+ (lambda (&optional justify)
+ (and (not (= (char-after (line-beginning-position))
+ (aref comment-start 0)))
+ (markdown-fill-paragraph justify)))))
(setq-local git-commit--branch-name-regexp
(if (and (featurep 'magit-git)
;; When using cygwin git, we may end up in a