matlab高亮部分注释,高亮注释中的关键字

写代码时,经常会在注释中注明一些有待未来完成的事项.例如

┌────

│ # REFACTOR: Decouple and clean up this crap.

│ # crappy code omitted

└────

正常情况下,除非使用了类似[fic-mode]这样的mode,否则Emacs不会去高亮注释中

的REFACTOR这类关键字.

有一个简单的办法可以做到这一点:

┌────

│ (defun font-lock-comment-annotations ()

│   "Highlight a bunch of well known comment annotations.

│ This functions should be added to the hooks of major modes for programming."

│   (font-lock-add-keywords

│    nil '(("\\

│  1 font-lock-warning-face t))))

│ (add-hook 'prog-mode-hook 'font-lock-comment-annotations)

└────

当然,这种方法并不完美,它会高亮这个代码中的关键字,而不仅仅是注释中的.

[fic-mode] https://github.com/lewang/fic-mode/blob/master/fic-mode.el

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值