Hongyi Zhao <hongyi.z...@gmail.com> writes:

> On Thu, Jul 27, 2023 at 10:05 PM Arash Esbati <ar...@gnu.org> wrote:
>>
>> Hongyi Zhao <hongyi.z...@gmail.com> writes:
>>
>> > In AUCTeX mode, I noticed that `{', and `[' can be completed
>> > automatically, while `(' doesn't. Any tips for this behavior?
>>
>> AUCTeX provides a variable called `LaTeX-electric-left-right-brace' for
>> this purpose which is initally disabled:
>>
>> ,----[ C-h v LaTeX-electric-left-right-brace RET ]
>> | LaTeX-electric-left-right-brace is a variable defined in ‘latex.el’.
>> |
>> | Its value is t
>> | Original value was nil
>> |
>> | If non-nil, insert right brace with suitable macro after typing left brace.
>> |
>> |   You can customize this variable.
>> |
>> `----
>>
>> See also here[1] for more information.
>
> Very strange. I've enabled this option, as shown below:
>
> [ C-h v LaTeX-electric-left-right-brace RET ]
> LaTeX-electric-left-right-brace is a variable defined in ‘latex.el’.
>
> Its value is t
> Original value was nil
>
> If non-nil, insert right brace with suitable macro after typing left brace.
>
>   You can customize this variable.
>
> [back]
>
> But I still cannot observe the corresponding completion of the
> innermost `(' as shown in the attached screenshot.

This is a terminology misunderstanding.

() parentheses
[] brackets
{} braces

You want completion for parentheses, not braces.  Parentheses are not
syntactic entities in LaTeX (pstricks notwithstanding).  You may want to
look at the generic key sequence:

M-( runs the command insert-parentheses (found in global-map), which
is an interactive byte-compiled Lisp function in ‘lisp.el’.

It is bound to M-(.

(insert-parentheses &optional ARG)

Enclose following ARG sexps in parentheses.
Leave point after open-paren.
A negative ARG encloses the preceding ARG sexps instead.
No argument is equivalent to zero: just insert ‘()’ and leave point between.
If ‘parens-require-spaces’ is non-nil, this command also inserts a space
before and after, depending on the surrounding characters.
If region is active, insert enclosing characters at region boundaries.

This command assumes point is not in a string or comment.

-- 
David Kastrup

Reply via email to