emacs-devel
[Top][All Lists]
Advanced

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

Re: electric-pair-mode


From: Stefan Monnier
Subject: Re: electric-pair-mode
Date: Fri, 29 Nov 2013 08:44:57 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> Ok, now I've found a mode where it's a problem.  AUCTeX has its own
> TeX-ified brace pairing feature which for example knows that \left( has
> to be closed by \right(, \{ by \}, etc.  With `electric-pair-mode'
> enabled, when typing a { I get two closing braces.

Yes, that is a problem.  AUCTeX's pairing should be made aware of
electric-pair-mode (including being enabled/disabled by
calling/setting electric-pair-mode as well).

> Right now, I have "disabled" `electric-pair-mode' for auctex using:

>   ;; AUCTeX brace pairing feature doesn't play nice with `electric-pair-mode'
>   ;; which is a global minor mode as of emacs 24.4.
>   (when (and (boundp 'electric-pair-mode)
>              (boundp 'electric-pair-inhibit-predicate))
>     (set (make-local-variable 'electric-pair-inhibit-predicate)
>          (lambda (char) t))))

A simpler way to disable it is to set electric-pair-mode to nil
(buffer-locally).  No need to check boundp of anything.

> I somehow have the feeling that `electric-pair-mode' should only do its
> magic if the opening paren/brace/bracket is inserted with
> `self-insert-command'.

What happens is that AUCTeX's pairing commands call self-insert-command.


        Stefan



reply via email to

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