Hi Philip,

>>>>> Philip Kaludercic <phil...@posteo.net> writes:

> an annoyance I have with auctex is it's interaction with
> electric-pair-mode. If both LaTeX-electric-left-right-brace and
> electric-pair-mode are enabled, typing '(' inserts "())", because both
> AucTeX and the electric function insert a closing parentheses. I still
> want to keep LaTeX-electric-left-right-brace enabled, because it handles
> TeX-specific parentheses (\{, \left <something>, ...) better.

AUCTeX already has the following code in `LaTeX-common-initialization'
to turn off `electric-pair-mode' explicitly.  So I guess you customize
`LaTeX-mode-hook' to re-enable `electric-pair-mode'.

  ;; AUCTeX's brace pairing feature (`LaTeX-electric-left-right-brace') doesn't
  ;; play nice with `electric-pair-mode' which is a global minor mode as of
  ;; emacs 24.4.
  (when (and LaTeX-electric-left-right-brace
             (boundp 'electric-pair-mode))
    (set (make-local-variable 'electric-pair-mode) nil))

> The attached patch would propose a solution that respects
> electric-pair-mode and doesn't insert an extra closing pair if
> enabled. It seems to work on my system, and if there are no issues it
> would be great if something along these lines could be done to avoid
> this behaviour.

Thanks. Maybe the attached patch might be better so that
`LaTeX-insert-left-brace' can get rid of all unexpected interactions
with `self-insert-command'. Tassilo, what do you think about it?

Regards,
Ikumi Keita

diff --git a/latex.el b/latex.el
index 83d50caf..7e14de75 100644
--- a/latex.el
+++ b/latex.el
@@ -2899,7 +2899,7 @@ Normally bound to keys \(, { and [."
              (TeX-active-mark)
              (> (point) (mark)))
         (exchange-point-and-mark))
-    (self-insert-command (prefix-numeric-value arg))
+    (insert (make-string (prefix-numeric-value arg) last-command-event))
     (if auto-p
         (let ((lbrace (char-to-string last-command-event)) lmacro skip-p)
           (save-excursion
@@ -6810,13 +6810,6 @@ function would return non-nil and `(match-string 1)' would return
 
   (define-key LaTeX-mode-map "\C-xne" #'LaTeX-narrow-to-environment)
 
-  ;; AUCTeX's brace pairing feature (`LaTeX-electric-left-right-brace') doesn't
-  ;; play nice with `electric-pair-mode' which is a global minor mode as of
-  ;; emacs 24.4.
-  (when (and LaTeX-electric-left-right-brace
-             (boundp 'electric-pair-mode))
-    (set (make-local-variable 'electric-pair-mode) nil))
-
   ;; Initialization of `add-log-current-defun-function':
   (set (make-local-variable 'add-log-current-defun-function)
        #'TeX-current-defun-name))
_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to