[Top][All Lists]

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

Re: sub and superscripts: without «_» and «^»

From: Uwe Brauer
Subject: Re: sub and superscripts: without «_» and «^»
Date: Thu, 03 Sep 2015 09:41:32 +0000
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/25.0.50 (gnu/linux)

>>>>> "Tassilo" == Tassilo Horn <address@hidden> writes:

> Stefan Monnier <address@hidden> writes:
>>> I asked this on auctex-dev but it might be question concerning core
>>> functionality of GNU emacs:
>> The necessary core functionality has been present for a long time:
>> just add the proper `invisible' property to the chars you don't want
>> to see.

> I guess what Uwe wants is that `prettify-symbols-mode' in a (La)TeX
> buffer (with stock latex-mode or AUCTeX; doesn't really matter) could
> have the option to make the ^ and _ invisible, too.

> I already told him that this is not what p-s-m is meant for.  But it's
> easy enough to write a custom font-lock rule for that:

> (defun th/invisible-super-sub-scripts ()
>   (interactive)
>   (cl-pushnew 'invisible font-lock-extra-managed-props)
>   (font-lock-add-keywords
>    nil
>    '(("[^\\\\]\\([_^]\\)" (1 '(face nil invisible t) t))))
>   (font-lock-flush))

> Uwe, if you want you could do something like that:

> (add-hook 'prettify-symbols-mode-hook
>         (lambda ()
>           (when (eq major-mode 'latex-mode)
>             (th/invisible-super-sub-scripts))))

Cool!! Precisely what I wanted thanks very much!

reply via email to

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