[Top][All Lists]

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

[AUCTeX-devel] bug in tex-buf.el?

From: Neal E. Young
Subject: [AUCTeX-devel] bug in tex-buf.el?
Date: Mon, 28 Apr 2008 22:02:11 -0700

Hi, I think there is a bug in tex-buf.el in the function TeX-format- filter,
in the following section of code:

          (when (and (= (current-column) 79)
                     ;; Heuristic: Don't delete the linebreak if there
                     ;; is an empty line after the current one or
                     ;; point is located after a period.
                     (not (eq (char-after (1+ (point))) ?\n))
                     (not (eq (char-before) ?.)))
            (delete-char 1)))

If a line happens to be 79 characters long, and the next line
starts with a left paren '(', then this code will delete the newline
and produce a line such as

(/usr/local/texlive/2007/texmf-dist/tex/latex/beamer/ beamerbaseauxtemplates.sty(/usr/local/texlive/2007/texmf-dist/tex/ latex/beamer/beamerbaseboxes.sty)))

The problem is dhe line has a filename immediately followed by '(',
with no space in between.

When this happens, and the text is later parsed by TeX-parse-error,
TeX-parse-error will fail to recognize the filename that is followed
immediately by '('.  It will fail to push it onto the TeX-error-file
stack. On the other hand, it will notice the closing ")", causing it
to pop an extra file off the stack.  Thus the stack of files will be
incorrect, causing problems locating errors in TeX-parse-error.

To fix it, I changed the line

       (not (eq (char-before) ?.)))

(which I also think is wrong, see below) to

       (not (eq (char-after (1+ (point))) ?\()))

which seemed to fix it.

(Note that not deleting the eol when the last char on the line is a '.',
as the current code does, can cause a filename that has been split by tex
after the 79th character, which happens to be a '.', to not be rejoined.
That's why I replaced the line instead of adding a new one.)


reply via email to

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