auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] [yes and no]


From: Tassilo Horn
Subject: Re: [AUCTeX-devel] [yes and no]
Date: Wed, 02 Sep 2015 16:50:26 +0200
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

Uwe Brauer <address@hidden> writes:

Hi!

> I will attach two files. File ne2.tex contains an integral and there
> indeed the integral is presented as a symbol, the second one new.tex
> however contains an integral as well however the integral and all the
> other symbols are still not presented by its symbols.

Indeed, it still doesn't work reliably.  Right now, I don't get pretty
symbols for both files unless I enable the mode manually.  With the hook
activation, still something nukes the prettification font-lock rule from
`font-lock-keywords'...

I've seen that there are some font-latex functions which re-initialize
the font-lock rules, i.e., many of the font-latex-add-* functions.  And
those are called by style files.  So basically, when you open a tex file
using some package and that package's style file is run, that might
cause a re-initialization and nukes the pretty-symbols font-lock rule.
Argh, so we need to utilize `TeX-update-style-hook', too.

Hm, this seems to work:

  (add-hook 'LaTeX-mode-hook #'prettify-symbols-mode t)
  (add-hook 'TeX-update-style-hook #'prettify-symbols-mode t)

The difference between `prettify-symbols-mode' and
`turn-on-prettify-symbols-mode' is that the latter doesn nothing if the
mode is already on.  Thus, it cannot repair a nuked font-lock entry.
And above I appended the function to the hooks which also seems to be
important, because in `TeX-update-style-hook' there's also a font-latex
function.

So long story short, if you wanna set that up in your .emacs, then this
will do the trick:

--8<---------------cut here---------------start------------->8---
(with-eval-after-load 'font-latex
  (add-hook 'LaTeX-mode-hook #'prettify-symbols-mode t)
  (add-hook 'TeX-update-style-hook #'prettify-symbols-mode t))
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo



reply via email to

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