From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Displaying a string as another one Date: Mon, 16 Mar 2020 11:05:25 +0100 Message-ID: <8736a88viy.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="117027"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.1.0; emacs 27.0.50 To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 16 11:09:16 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jDmgO-000UHk-B4 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 16 Mar 2020 11:09:16 +0100 Original-Received: from localhost ([::1]:36498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDmgM-0004ie-T3 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 16 Mar 2020 06:09:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59190) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDmd8-0004gW-Tp for help-gnu-emacs@gnu.org; Mon, 16 Mar 2020 06:05:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDmd2-0002o9-Qt for help-gnu-emacs@gnu.org; Mon, 16 Mar 2020 06:05:50 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:60740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jDmd2-0002Kc-IG for help-gnu-emacs@gnu.org; Mon, 16 Mar 2020 06:05:48 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id C8378E67F6 for ; Mon, 16 Mar 2020 11:05:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SF0eOaptkj4a for ; Mon, 16 Mar 2020 11:05:29 +0100 (CET) Original-Received: from localhost (jeden09-dwa27.echostar.pl [213.156.109.227]) by mail.mojserwer.eu (Postfix) with ESMTPSA id C5F3DE64F0 for ; Mon, 16 Mar 2020 11:05:28 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.110.48.8 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122593 Archived-At: 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