[英]Emacs regexp and syntax highlighting
I want to highlight some words (ex. "true", "false"), but only when they are between the tags <?=
and ?>
.我想突出显示一些单词(例如“true”、“false”),但前提是它们位于标签
<?=
和?>
之间。
In the example below I only want to highlight the second "true" keyword:在下面的示例中,我只想突出显示第二个“true”关键字:
<input checked="true"><?=($i === true ? $foo : $bar)?>
Is there any special font-locking mode for this kind of situation?这种情况有什么特殊的字体锁定模式吗?
Font lock can call functions too in addition to matching regexps:除了匹配正则表达式之外,字体锁也可以调用函数:
Find text by calling function, and highlight the matches it finds using font-lock-keyword-face.
通过调用 function 查找文本,并使用 font-lock-keyword-face 突出显示它找到的匹配项。
http://www.gnu.org/s/emacs/manual/html_node/elisp/Search_002dbased-Fontification.html http://www.gnu.org/s/emacs/manual/html_node/elisp/Search_002dbased-Fontification.html
Only you need to know Elisp.只有你需要知道 Elisp。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.