bug-auctex
[Top][All Lists]
Advanced

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

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


From: Gerard Brunick
Subject: [Bug-AUCTeX] 11.86; LaTeX-current-environment related bug
Date: Thu, 23 May 2013 12:16:40 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

I believe I have found a bug in LaTeX-current-environment which reads:

(defun LaTeX-current-environment (&optional arg)
  (setq arg (if arg (if (< arg 1) 1 arg) 1))
  (let* ((in-comment (TeX-in-commented-line))
         (comment-prefix (and in-comment (TeX-comment-prefix))))
    (save-excursion
      (while (and (/= arg 0)
                  (re-search-backward
                   "\\\\\\(begin\\|end\\) *{ *\\([A-Za-z*]+\\) *}" nil t))
        (when (or [omitted]
                  (and (not LaTeX-syntactic-comments)
*here* ->              (not (TeX-in-commented-line))))
(setq arg (if (string= (match-string 1) "end") (1+ arg) (1- arg)))))
      (if (/= arg 0)
          "document"
        (match-string-no-properties 2)))))

The problem is that when LaTeX-syntactic-comments is nil (TeX-in-commented-line) only recognizes comment-only lines as comments. Its seems that one should really just check to see the point is inside a comment, even if there are noncomment code on the
same line.  For example, when the function encounters the LaTeX code

b %&= \begin{bmatrix}
  %     1 \\ 2
  %   \end{bmatrix}
  &= (1,2)

it ignores the "\end{bmatrix}" because the comment is on a line by itself but counts the "\begin{bmatrix}" and everything is screwed up from that point on.

Best regards,
Gerard




reply via email to

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