auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] Changes to auctex/tex.el


From: Ralf Angeli
Subject: [AUCTeX-diffs] Changes to auctex/tex.el
Date: Sat, 05 Nov 2005 04:27:37 -0500

Index: auctex/tex.el
diff -u auctex/tex.el:5.541 auctex/tex.el:5.542
--- auctex/tex.el:5.541 Fri Oct 28 16:38:37 2005
+++ auctex/tex.el       Sat Nov  5 09:27:37 2005
@@ -3277,6 +3277,11 @@
   :group 'TeX-macro
   :type 'boolean)
 
+(defcustom TeX-electric-sub-and-superscript nil
+  "If non-nil, insert braces after typing `^' and `_' in math mode."
+  :group 'TeX-macro
+  :type 'boolean)
+
 (defcustom TeX-newline-function 'newline
   "Function to be called upon pressing `RET'."
   :group 'TeX-indentation
@@ -3285,6 +3290,16 @@
                 (const reindent-then-newline-and-indent)
                 (sexp :tag "Other")))
 
+(defun TeX-insert-sub-or-superscript (arg)
+  "Insert typed key ARG times and possibly a pair of braces.
+Brace insertion is only done if point is in a math construct and
+`TeX-electric-sub-and-superscript' has a non-nil value."
+  (interactive "*p")
+  (self-insert-command arg)
+  (when (and TeX-electric-sub-and-superscript (texmathp))
+    (insert (concat TeX-grop TeX-grcl))
+    (backward-char)))
+
 (defun TeX-newline ()
   "Call the function specified by the variable `TeX-newline-function'."
   (interactive) (funcall TeX-newline-function))
@@ -3311,6 +3326,8 @@
     (define-key map "\C-c\C-m" 'TeX-insert-macro)
     (if TeX-electric-escape
        (define-key map "\\" 'TeX-electric-macro))
+    (define-key map "^"      'TeX-insert-sub-or-superscript)
+    (define-key map "_"      'TeX-insert-sub-or-superscript)
     (define-key map "\e\t"   'TeX-complete-symbol) ;*** Emacs 19 way
     
     (define-key map "\C-c'"    'TeX-comment-or-uncomment-paragraph) ;*** Old 
way




reply via email to

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