Hi Gustavo, Gustavo Barros <[email protected]> writes:
> On Thu, 17 Jun 2021 at 19:39, Arash Esbati <[email protected]> wrote: >> >> This is not the general approach in AUCTeX. If you want to have >> braces >> after (certain) macros, please use the variables `TeX-insert-braces' >> or >> `TeX-insert-braces-alist': > > Sorry to pester you again with this. No worries :-) > I'm probably missing something, but I can't seem to find a way to make > this work as expected based on `TeX-insert-braces-alist'. No, you're not missing anything, this is by design. > As far as I understood, this variable only takes `t' or `nil' for any > given macro, the later does not add the braces, and the former adds > them and places point between the braces. I don't see a way to > emulate the effect `nil' has in `TeX-add-symbols' which is to add the > braces and leave point after the closing brace. Is this indeed the > case, or am I really missing something? Consider this example: \documentclass{article} \usepackage[brazil]{babel} \begin{document} \begin{verbatim} (setq TeX-insert-braces t) (setq TeX-insert-braces-alist '(("orda" . nil))) \end{verbatim} \ord{} \orda \end{document} If you eval the forms inside the verbatim environment, you'd expect the results shown above. You don't get them though because brazilian.el has these lines: (TeX-add-symbols '("ord" 0) '("ro" 0) '("orda" 0) '("ra" 0)) `TeX-parse-macro' in return has code for this comment: ;; Do not add braces if the argument is 0 or -1. I admit that I discovered this behaviour also after your message. I think we have to adjust our style file accordingly. 0 should only be used for LaTeX preamble only macros where an empty pair of braces after a macros looks odd. You can try to apply this patch and play with it: diff --git a/style/brazilian.el b/style/brazilian.el index 5124e660..c1ae8022 100644 --- a/style/brazilian.el +++ b/style/brazilian.el @@ -61,10 +61,10 @@ (setq TeX-quote-language nil)) (setq LaTeX-babel-hyphen-language "brazilian") (TeX-add-symbols - '("ord" 0) - '("ro" 0) - '("orda" 0) - '("ra" 0)) + "ord" + "ro" + "orda" + "ra") ;; Fontification (when (and (eq TeX-install-font-lock 'font-latex-setup) (featurep 'font-latex)) or use the updated file attached. Best, Arash
brazilian.el
Description: application/emacs-lisp
