3

I'm editing a large (around 50k words) tex file in Emacs using AUCTeX and cursor movement is quite sluggish, especially when jumping by word. This isn't a problem in any other mode.

Edit: I did some (super-unscientific) profiling with elp.el, just moving around with

(defun movement-test ()
  (interactive)
  (setq i 0)
  (while (< i 10000)
    (forward-word)
    (next-line)
    (previous-line)
    (backward-word)
    (incf i)))

And the results are

  • 211 line .tex document: 36.1s
  • 5393 line .tex document: 47.7s
  • 1076 line .R file (for comparison): 32.2s

I think it might have something to do with preview-latex (which I don't use), is there any way to disable preview-latex?

Mac OS X 10.7.3, Emacs v24.0.94.1, AUCTeX/preview-latex v11.86

4
  • The preview mode is activated only on demand, as far as I know.
    – egreg
    Commented Mar 25, 2012 at 12:23
  • how about removing (load "preview-latex.el" nil t t) from your .emacs?
    – Rasmus
    Commented Mar 25, 2012 at 12:53
  • So you do not get this from small files? Is there something special about the big file, does it contain a large amount of some particular macros? Can you make a smaller test case?
    – N.N.
    Commented Mar 25, 2012 at 13:32
  • I don't have (load "preview-latex.el" nil t t) in my .emacs, preview-latex is loaded by default as far as I can tell because I installed AUCTeX through ELPA. I'll have a hack around and see if I can stop it loading by default.
    – Ben
    Commented Mar 26, 2012 at 0:19

2 Answers 2

0

preview-latex should not affect editing speed in a noticeable manner (it uses some hooks for moving in and out of previews, but those are not expensive). The most likely culprit is syntax highlighting or CEDET. Another possibility (if we are talking about the Emacs 24 development line which you apparently are using) is the setting of bidi-paragraph-direction which you might want to customize to left-to-right. Last time I checked, admittedly more than a year ago, it could seriously impact the redisplay speed of longer texts.

1
  • Thanks - setting bidi-paragraph-direction to nil seems to help.
    – Ben
    Commented Jul 9, 2012 at 23:40
1

Do you have a lot of equations in your document? I had a similar problem awhile back and the culprit was the rainbow-delimiters package. Emacs seemed to have trouble coloring the large number of braces I had in my LaTeX source. I switched to highlight-parenthesis, which only colors the braces that surround the cursor, and my lag went away.

1
  • No, I'm not using rainbow-delimiters.
    – Ben
    Commented Mar 26, 2012 at 0:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .