[Top][All Lists]

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

Re: [Bug-AUCTeX] 11.84; Font replacing doesn't work for unbalanced paren

From: David Kastrup
Subject: Re: [Bug-AUCTeX] 11.84; Font replacing doesn't work for unbalanced parentheses.
Date: Mon, 05 Mar 2007 22:00:14 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux)

Ralf Angeli <address@hidden> writes:

> * Ikumi Keita (2007-03-05) writes:
>> 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.
> [...]
>>       ;; 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. 
> That's a bug in Emacs 21 which is fixed in CVS Emacs.  (See the
> comment in the defvar of `TeX-syntax-table'.)  As a workaround we
> could set the syntax entries for parens to nil.
>> (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)
> Could we iterate (in a reasonable amount of time) through all entries
> in the syntax table and set them to nil?  If not, we likely will have
> to live with the workaround and hope for Emacs 22 to be released in
> this millenium.

Couldn't we just start with

(setq TeX-search-syntax-table (make-char-table 'syntax-table nil))


>> 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.
> The variable is not supposed to be used directly.  If a syntax table
> for searching is required, the function `TeX-search-syntax-table'
> should be used.  Working with only a single syntax was a deliberate
> decision because syntax tables are quite large data structures and I
> didn't want to waste memory by making that variable buffer-local or
> do something similar.

Somewhere between 200 and 400 vector slots for an empty table,
apparently, judging from the output of (garbage-collect).

David Kastrup, Kriemhildstr. 15, 44793 Bochum

reply via email to

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