我如何告诉 flyspell 忽略 git-commit-mode 上的注释行?
How do I tell to flyspell to ignore comment lines on git-commit-mode?
我通常在编写 git 提交时更改字典,但是因为我有一个映射到更改字典和 运行 (flyspell-buffer)
在我看到 flyspell 超出提交之后还要检查以 #
.
开头的注释行的消息
我怎么知道"flyspell, please ignore lines starting with #
symbol"?
我读到过我可以使用 flyspell-generic-check-word-predicate
,但是我的 elisp 远非如此 :(,我想到了这个:
(defun flyspell-ignore-comments ()
"Used for 'flyspell-generic-check-word-predicate' to ignore comments."
(not (string-match "^ *#" (thing-at-point 'line t))))
(put 'git-commit-mode 'flyspell-mode-predicate 'flyspell-ignore-comments)
然而它不起作用。我做错了什么?
好的,感谢@KyleMeyer 让我怀疑我的配置,问题是我在 text-mode-hook
中启用了 flyspell,这干扰了 git-commit-mode
的配置。删除 flyspell
以在 text-mode-hook
中加载解决了问题。
谢谢。
我通常在编写 git 提交时更改字典,但是因为我有一个映射到更改字典和 运行 (flyspell-buffer)
在我看到 flyspell 超出提交之后还要检查以 #
.
我怎么知道"flyspell, please ignore lines starting with #
symbol"?
我读到过我可以使用 flyspell-generic-check-word-predicate
,但是我的 elisp 远非如此 :(,我想到了这个:
(defun flyspell-ignore-comments ()
"Used for 'flyspell-generic-check-word-predicate' to ignore comments."
(not (string-match "^ *#" (thing-at-point 'line t))))
(put 'git-commit-mode 'flyspell-mode-predicate 'flyspell-ignore-comments)
然而它不起作用。我做错了什么?
好的,感谢@KyleMeyer 让我怀疑我的配置,问题是我在 text-mode-hook
中启用了 flyspell,这干扰了 git-commit-mode
的配置。删除 flyspell
以在 text-mode-hook
中加载解决了问题。
谢谢。