bug-auctex
[Top][All Lists]
Advanced

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

[Bug-AUCTeX] 11.84; Font replacing doesn't work for unbalanced parenthes


From: Ikumi Keita
Subject: [Bug-AUCTeX] 11.84; Font replacing doesn't work for unbalanced parentheses.
Date: Tue, 06 Mar 2007 01:22:02 +0900

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.

Be sure to consult the FAQ section in the manual before submitting
a bug report.  If the bug (or problem) is triggered by a specific
(La)TeX file, you should try to produce a minimal sample file
showing the problem and include it in your report.

Your bug report will be posted to the AUCTeX bug reporting list.
------------------------------------------------------------------------

In a LaTeX document buffer, placing the cursor on font specifying macros
like \emph and typing font replacing key stroke (e.g. C-u C-c C-f C-r)
causes an error if the text to be decolated contains unbalaned
parentheses.

How to reproduce:
1. Place the cursor over the macro \emph in the following document:
======================================================================
\documentclass{article}

\begin{document}
\emph{(}
\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
======================================================================
2. C-u C-c C-f C-r
3. Scan error: "Unbalanced parentheses", 48, 134

Analysis:
The definition of TeX-font-replace-macro in tex.el of AUCTeX 11.84
contains the following piece of code:
----------------------------------------------------------------------
      ;; Use stripped syntax table in order to get stuff like "\emph{(}" right.
      (with-syntax-table (TeX-search-syntax-table ?\{ ?\})
        (forward-sexp 2))
----------------------------------------------------------------------
However, (TeX-search-syntax-table ?\{ ?\}) does not return sufficiently
stripped syntax table, at least for Emacs 21.  So the comment on the
first line in the above piece is not right for now. 

By evaluating
(with-syntax-table (TeX-search-syntax-table ?{ ?}) (describe-syntax))
one can see that the standard syntax table is used as parent syntax
table, so the round parentheses `(' and `)' have their normal syntaxes,
leading to the above error.  Actually, the normal syntax is in use for
all the chars except the ones explicitly catered for in tex.el. 
TeX-search-syntax-table should be made to mask all the chars in the
table.  (Note that the chars with paren syntaxes is not only `()', '{}'
and `[]', but also many multibyte chars count as matching parentheses.
They must be masked altogether)

In addition, the way the function TeX-search-syntax-table treats the
variable TeX-search-syntax-table does not seem good to me.  The function
directly modifies the syntax table stored in the variable, so the
modified table is shared between all the buffers.  For examle, the char
`@' is given escape syntax in texinfo-mode buffer, which should be
avoided in latex-mode buffer.

Emacs  : GNU Emacs 21.4.1 (i386-unknown-freebsd4.11, X toolkit, Xaw3d scroll 
bars, emcws)
 of 2005-03-02 on myname.my.domain
Package: 11.84

current state:
==============
(setq
 AUCTeX-date "2007-01-12"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("style" "auto" "/home/keita/tex/style"
                  "/home/keita/tex/auto"
                  "/usr/local/share/emacs/site-lisp/auctex/style"
                  "/usr/local/var/auctex")
 TeX-auto-save nil
 TeX-parse-self t
 TeX-master t
 TeX-command-list '(("TeX" "%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t"
                     TeX-run-TeX nil
                     (plain-tex-mode ams-tex-mode texinfo-mode) :help
                     "Run plain TeX")
                    ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil
                     (latex-mode doctex-mode) :help "Run LaTeX")
                    ("Makeinfo" "makeinfo %t" TeX-run-compile nil
                     (texinfo-mode) :help "Run Makeinfo with Info output")
                    ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil
                     (texinfo-mode) :help "Run Makeinfo with HTML output")
                    ("AmSTeX" "%(PDF)amstex %`%S%(PDFout)%(mode)%' %t"
                     TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
                    ("ConTeXt" "texexec --once --texutil %(execopts)%t"
                     TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
                    ("ConTeXt Full" "texexec %(execopts)%t" TeX-run-TeX nil
                     (context-mode) :help "Run ConTeXt until completion")
                    ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help
                     "Run BibTeX")
                    ("View" "%V" TeX-run-discard t t :help "Run Viewer")
                    ("Print" "%p" TeX-run-command t t :help "Print the file")
                    ("Queue" "%q" TeX-run-background nil t :help
                     "View the printer queue" :visible TeX-queue-command)
                    ("File" "%(o?)dvips %d -o %f " TeX-run-command t t :help
                     "Generate PostScript file")
                    ("Index" "makeindex %s" TeX-run-command nil t :help
                     "Create index file")
                    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode)
                     :help "Check LaTeX file for correctness")
                    ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil
                     t :help "Spell-check the document")
                    ("Clean" "TeX-clean" TeX-run-function nil t :help
                     "Delete generated intermediate files")
                    ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help
                     "Delete generated intermediate and output files")
                    ("Other" "" TeX-run-command t t :help
                     "Run an arbitrary command")
                    )
 )




reply via email to

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