I'm trying to turn $...$
into an electric pair, just as say (...)
.
So I tried this solution, and it works fine on my older machine, running Emacs 24.3.1 and AUCTeX 11.87.
However, on a newer installation (Emacs 24.5.1, AUCTeX 12.1.1), it doesn't quite behave like it should.
When I type $x+y$
, it should be giving me
$x+y$^
,
where ^
denotes point. But instead I get
$x+y$^$$
.
Obviously, Emacs fails to move over the automatically-inserted closing $
and instead inserts a new pair.
Here is the relevant part of my .emacs
:
(electric-pair-mode 1)
(define-key LaTeX-mode-map (kbd "$") 'self-insert-command)
(push '(?\$ . ?\$) electric-pair-pairs)
The push
line may be included or not, it doesn't make a difference.
I also tried the following .emacs
, as suggested by the AUCTeX manual:
(electric-pair-mode 1)
(set (make-variable-buffer-local 'TeX-electric-math) (cons "$" "$"))
This gives me $x+y$^$
, which is not much better.
How do I get the behavior I want?
M-x report-emacs-bug
?