tags:

views:

26

answers:

1

I'm writing a mode which is actually a glorified markdown reader. It's a read-only mode however, and though I'd like 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?

+2  A: 

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.

R. P. Dillon
Perfect! I was considering going through all the characters and narrowing around them, but I figured there *had* to be something in emacs to do this more easily. Hopefully I'll get a chance to try this out today.
Andrew Gwozdziewycz