问题描述
此问题与另一个相关,。它支持自动突出显示 TODO 标记,并在它们之间导航。然而,我认为只有在评论中识别TODO字符串是更有意义的,而不是污染整个文件。可以吗?
This question is related to another one, Emacs :TODO indicator at left side. I recently came across a minor mode I like a lot called FixmeMode. It supports auto highlighting of TODO marks, and navigating between them. However, I think it makes more sense to recognize the "TODO" strings only in comments, rather than polluting the whole file. Is it possible?
推荐答案
查看图书馆,它已经在C ++和Emacs-Lisp中被验证。
Check out the library fic-mode.el, it has been verified in C++ and Emacs-Lisp.
它是专门用于回答这个问题的。
It was written specifically to answer this question.
安装就像任何标准包:
(require 'fic-mode)
(add-hook 'c++-mode-hook 'turn-on-fic-mode)
尽管确实要求一个简单的方式将其添加到多种模式,所以这里:
Though Wei Hu did ask for an easy way to add it to multiple modes, so here goes:
(defun add-something-to-mode-hooks (mode-list something)
"helper function to add a callback to multiple hooks"
(dolist (mode mode-list)
(add-hook (intern (concat (symbol-name mode) "-mode-hook")) something)))
(add-something-to-mode-hooks '(c++ tcl emacs-lisp) 'turn-on-fic-mode)
这篇关于Emacs:在评论中突出显示TODO * * *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!