On Jul 14, 9:35=A0am, Florian Kaufmann <sensor...@gmail.com> wrote:
> What I want to accomplish is that font-lock, besides putting a face on
> certain part of the buffer, also inserts text just for display, i.e.
> text which is not part of the underlying file.
> E.g. I want that every occurrence of the literal string "(C)" is
> displayed with the face adoc-replacement, followed by an inserted copy
> right sign "\u00A9".
> This is the font lock keyword I tried, but it doesn't work. It applies
> the face, but doesn't insert the text.
> (list "\\((C)\\)" =A0'(1 '(face adoc-replacement after-string
> The next question would then be how I could make that inserted text
> also intangible & read-only.
whitespace-mode does something very similar to what you want. It does
it with display-tables.
(setq buffer-display-table (make-display-table))
(aset buffer-display-table ?! [?! ??]) ; make all '!' display as '!?'