How to change the text while maintaining the original font?

I am writing a mode that is actually an illustrious pegging reader. This is a read-only mode, and although I would like to change the faces for bold, italic and links, I would like to remove the decorations around these faces. However, when I do this, I lose the font. Is there a way to change the font text to something that no longer matches any of the syntactic regular expressions and still retain the font?

+3
source share
1 answer

Org-mode does this to mark up links. I am not a mode writer (yet), but Org-mode will be the first place I would look for code that demonstrates how to do this. Oddly enough, he does not do this for any of his fonts: italics, bold and underline all retain their markup.

In particular, the code to hide the markup of the link is on line 4612 org.elin version 7.01 org-mode:

(if org-descriptive-links (add-to-invisibility-spec '(org-link)))

where it is add-to-invisibility-specactually provided by the built-in elisp file subr.eland allows you to hide certain types of markup. This would be the approach I would take, especially if the buffer is read-only.

+3
source

Source: https://habr.com/ru/post/1762269/


All Articles