emacs-devel
[Top][All Lists]
Advanced

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

Re: electric-pair-mode


From: Tassilo Horn
Subject: Re: electric-pair-mode
Date: Fri, 29 Nov 2013 08:01:49 +0100
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> For example, in all kinds of lisp modes I'm using paredit which
>> provides both features, too, in a slightly different form.  So there
>> I wouldn't want to activate these modes (although it seems having
>> them activated doesn't do any harm).
>
> Looks like there's no problem, then.

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.

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))))

Is that the way it's supposed to be done?

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'.  For modes that bind ({[ to special commands
(like paredit and auctex), chances are high that you get some
interference with whatever special logic the mode does.  On the other
hand, there doesn't seem to be a problem with paredit, so maybe we're
just doing something wrong in auctex...
         
Bye,
Tassilo



reply via email to

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