help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Displaying a string as another one


From: Marcin Borkowski
Subject: Displaying a string as another one
Date: Mon, 16 Mar 2020 11:05:25 +0100
User-agent: mu4e 1.1.0; emacs 27.0.50

Hi all,

I have a buffer with long lines, containing many instances of strings
"\\n" and "\\t" (i.e., a literal backslash followed by "n" or "t").  I'd
like Emacs to display them as a newline and a tab, respectively.  These
instances occur inside strings (i.e., between quotes, which delimit
strings in JavaScript).

I tried
(setq prettify-symbols-alist '(("\\n" . ?\n) ("\\t" . ?\t)))
but this does not seem to work inside strings.

I suspect font-lock could do it, but I'm not sure how (and frankly,
I don't have time now to do many experiments).

Does anyone have a ready-made solution?

TIA,

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]