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

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

Re: Displaying a string as another one


From: Marcin Borkowski
Subject: Re: Displaying a string as another one
Date: Sat, 21 Mar 2020 15:11:25 +0100
User-agent: mu4e 1.1.0; emacs 27.0.50

On 2020-03-16, at 16:58, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

>> Does anyone have a ready-made solution?
>
> You could start with something like
>
>     (defun my-decode-\n-\t ()
>       (font-lock-add-keywords nil
>         '(("\\\\[nt]"
>            (0 (my-apply-decode (match-beginning 0) (match-end 0)))))))
>
>     (defun my-apply-decode (beg end)
>       (when (= 0 (mod (save-excursion (goto-char beg)
>                                       (skip-chars-backward "\\\\"))
>                       2))
>         `(face nil
>           display ,(string (if (eq (char-before end) ?n) ?\n ?\t)))))
>
>     (add-hook 'foo-mode-hook #'my-decode-\n-\t)

Thanks a lot.  This looks more complicated than I expected...  I'll
experiment with this and see how it works.

Best,

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

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