How to higlight tabs in Emacs

妖精的绣舞 提交于 2019-12-10 16:49:32

问题


I use spaces for indentation in source code, how can I higlight/mark tabs, that are in code?

It could be red, the same as when I use (setq-default show-trailing-whitespace t)


回答1:


Just use command toggle-highlight-tabs from library highlight-chars.el.

Or you can turn on tab highlighting by default by adding function hc-highlight-tabs to font-lock-mode-hook in your init file:

(add-hook 'font-lock-mode-hook 'hc-highlight-tabs)

You can turn on/off the highlighting provided by library Highlight Chars:

  • in the current buffer only (i.e., locally),
  • globally whenever Font Lock mode is enabled, or
  • automatically whenever a buffer is in a given major mode



回答2:


As a hint from @abo-abo I found that I can use whitespace-mode with this code:

(setq whitespace-style '(face tabs))
(whitespace-mode)


来源:https://stackoverflow.com/questions/22009725/how-to-higlight-tabs-in-emacs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!