Changing text appearance in Emacs: overlays work, text properties don't

孤街浪徒 提交于 2019-12-05 04:04:38

When font-lock-mode is on, the face attribute will be overridden. Try font-lock-face instead:

(put-text-property
 (line-beginning-position)
 (line-end-position)
 'font-lock-face 'bold)

ansi-color.el -- "In Emacs, however, things are a bit different: When font-lock is active in a buffer, you cannot simply add face text-properties to the buffer. Font-lock will remove the face text-property using 'font-lock-unfontify-region-function'. If you want to insert the strings returned by 'ansi-color-apply' into such buffers, you must set 'font-lock-unfontify-region-function' to `ansi-color-unfontify-region'. This function will not remove all face text-properties unconditionally. It will keep the face text-properties if the property 'ansi-color' is set.

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