Al Haji-Ali <[email protected]> writes:
> On 11/01/2023, Arash Esbati wrote:
>
>> We can teach the code to accept one level of braces, but is there a real
>> use-case for it?
> Why only one level? Doesn't AUCTeX have code to balance braces somewhere?
This is all regexp-based, so brace balancing is not the way you would
expect it. Or am I missing your point? This is currently what
`font-latex-set-syntactic-keywords' does:
(let ((...)
(verb-macros-with-braces
(and (fboundp 'LaTeX-verbatim-macros-with-braces)
(LaTeX-verbatim-macros-with-braces))))
(...)
(unless (= (length verb-macros-with-braces) 0)
(add-to-list
'font-latex-syntactic-keywords
`(,(concat "\\\\\\(?:" verb-macros-with-braces "\\)"
;; Some macros take an optional argument. This is
;; the same line as above for environments.
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
"\\({\\).*?[^\\]\\(?:\\\\\\\\\\)*\\(}\\)")
(1 "|") (2 "|"))))
...)
> I noticed the issue when defining links for my biblio like this
>
> \newbibmacro{string+doi}[1]{%
> \iffieldundef{doi}{#1}{\href{http://dx.doi.org/\thefield{doi}}{#1}}}
Ok, this is indeed a valid use-case.
> Using `rainbow-delimiters-mode` meant that all subsequent braces are
> marked as mismatched. This is really a bigger issue with that package,
> but nonetheless it is caused by AUCTeX.
>
> I also use show-paren-mode to visually (and through a key binding) to
> jump between the closing/end braces, which doesn't work for href (even
> without nested braces).
True, AUCTeX breaks with your code.
Best, Arash