I'm writing a mode which is actually a glorified markdown reader. It's a read-only mode however, and though I'd lik开发者_如何学Pythone to change the faces for bold, italics, and links, I'd love to remove the decorations surrounding those faces. However, when I do so, I lose the fontification. Is there anyway to modify fontified-text to something that no longer matches any of the syntax regexes and still keep the fontification?
Org-mode does this for its link markup. I'm not a mode writer (yet), but Org-mode would be the first place I'd look for code that demonstrates how to do this. Oddly, it doesn't do it for any of its fontification: italic, bold, and underline all retain their markup.
Specifically, the code to hide the link markup is on line 4612 of org.el
in version 7.01 of org-mode:
(if org-descriptive-links (add-to-invisibility-spec '(org-link)))
where add-to-invisibility-spec
is actually supplied by a built in elisp file subr.el
, and allows specific types of markup to be hidden. That would be the approach I would take, especially if the buffer is read-only.
精彩评论