Hi David,

2013/5/24 David Kastrup <d...@gnu.org>:
> Mosè Giordano <giordano.m...@libero.it> 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è

_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to