bug-auctex
[Top][All Lists]
Advanced

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

Re: [Bug-AUCTeX] 11.86; LaTeX-current-environment related bug


From: Mosè Giordano
Subject: Re: [Bug-AUCTeX] 11.86; LaTeX-current-environment related bug
Date: Fri, 24 May 2013 16:24:09 +0200

Hi David,

2013/5/24 David Kastrup <address@hidden>:
> Mosè Giordano <address@hidden> writes:
>
>> It seems `LaTeX-verbatim-p' is the bottleneck when executing
>> `TeX-in-comment' in latex mode.  The attached patch should speedup
>> `LaTeX-verbatim-p' (and so `LaTeX-current-environment' with
>> `TeX-in-comment')  when `font-latex-faces-present-p' is available,
>> otherwise it is still really slow.  Is there any objection?
>
> Doesn't this only work on fontified regions of the buffer?
Now, the body of `LaTeX-verbatim-p' is
--8<---------------cut here---------------start------------->8---
    (or (when (fboundp 'font-latex-faces-present-p)
      (font-latex-faces-present-p 'font-latex-verbatim-face))
    (member (LaTeX-current-verbatim-macro)
        (LaTeX-verbatim-macros-with-delims))
    (member (TeX-current-macro) (LaTeX-verbatim-macros-with-braces))
    (member (LaTeX-current-environment) (LaTeX-verbatim-environments)))
--8<---------------cut here---------------end--------------->8---
If `font-latex-faces-present-p' is not available or
`(font-latex-faces-present-p 'font-latex-verbatim-face)' returns nil
the next tests are performed and they are slow, above all the
`LaTeX-current-environment' one.

With my patch it becomes
--8<---------------cut here---------------start------------->8---
    (if (fboundp 'font-latex-faces-present-p)
    (font-latex-faces-present-p 'font-latex-verbatim-face)
      (or (member (LaTeX-current-verbatim-macro)
          (LaTeX-verbatim-macros-with-delims))
      (member (TeX-current-macro) (LaTeX-verbatim-macros-with-braces))
      (member (LaTeX-current-environment) (LaTeX-verbatim-environments))))
--8<---------------cut here---------------end--------------->8---
If `font-latex-faces-present-p' is available
`(font-latex-faces-present-p 'font-latex-verbatim-face)' will be the
only test performed whatever the result, otherwise the member tests
are performed and I have no idea about how to speedup them.  So yes,
the difference is apparent only in fontified regions, but
fontification is on by default, so I assume many people use it.

Bye,
Mosè



reply via email to

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