怎样使得在c++-mode下不使用flyspell检查引用?

我在写c++代码时发现 flyspell 对于头文件引用中的 iostream报错了。我在github上找到了如下的一串代码(有改写),

(defun dugu-c/post-init-flyspell ()
  (defun dugu-buffers-current-line ()
      (buffer-substring (line-beginning-position) (line-end-position)))
  (defun dugu-c/flyspell-verify ()
      "Do not spellcheck imports."
      (and (flyspell-generic-progmode-verify)
           (not (s-matches? (rx bol (* space) "#") (dugu-buffers-current-line)))))

  (defun dugu-c/configure-flyspell ()
    (setq-local flyspell-generic-check-word-predicate 'dugu-c/flyspell-verify))

  (add-hook 'c++-mode-hook 'dugu-c/configure-flyspell))

) 然而添加以后并没有用。有什么解决办法吗?

看不明白你想解决什么问题。flyspell 默认并没有开启,不想用的话,自己不打开不就完了。另外,根据 Emacs manual ((emacs) Spelling)中的说法,编程环境下一般用flyspell-prog-mode,它只会在注释和字符串之中作拼写检查。

`M-x flyspell-prog-mode'
     Enable Flyspell mode for comments and strings only.

...

   Flyspell Prog mode works just like ordinary Flyspell mode, except
that it only checks words in comments and string constants.  This
feature is useful for editing programs.

P.S 我没有在用 flyspell

抱歉,最开始描述的有些疏漏,其实是头文件的引用报错了。就是

#include <iostream>

中对iostream报错了。我默认启用的应该就是 flyspell-prog-mode , 然而看起来他似乎把引用看为了注释的样子

额,我知道了,某一个括号加错位置了,我修改了下代码,现在最开始贴的那串代码已经可以用了。实在是抱歉。