branch: externals/auctex
commit f319b9f1189d21927c0577a3280db4c2c99928be
Author: Ikumi Keita <[email protected]>
Commit: Ikumi Keita <[email protected]>

    Override some bindings in `TeX-mode-map' in Texinfo mode
    
    * tex-info.el (Texinfo-mode-map): Bind `self-insert-command' to
    "$", "^", "_" and "\" because they are normal characters in Texinfo
    documents.
    Bind `TeX-insert-backslash' to "@" so that users benefit from
    `TeX-electric-macro' even in Texinfo mode.
    * tex.el (TeX-electric-escape): Update doc string.
    * doc/auctex.texi (Completion): Update description.
    * doc/changes.texi (News in 12.2): Mention the above changes.
---
 doc/auctex.texi  | 11 ++++++-----
 doc/changes.texi | 10 ++++++++++
 tex-info.el      | 12 ++++++++++++
 tex.el           |  4 +++-
 4 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/doc/auctex.texi b/doc/auctex.texi
index 0e0b6a4..8843fa9 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -1332,13 +1332,14 @@ Note that for some macros, there are special 
mechanisms, e.g.
 Default macro to insert when invoking @code{TeX-insert-macro} first time.
 @end defopt
 
-A faster alternative is to bind the function @code{TeX-electric-macro}
-to @samp{\}.  This can be done by setting the variable
-@code{TeX-electric-escape}
+A faster alternative is to enable the option
+@code{TeX-electric-escape}.
 
 @defopt TeX-electric-escape
-If this is non-nil when @AUCTeX{} is loaded, the @TeX{} escape
-character @samp{\} will be bound to @code{TeX-electric-macro}
+If this is non-nil, typing the @TeX{} escape character @kbd{\} will
+invoke the command @code{TeX-electric-macro}.
+
+In Texinfo mode, the command is invoked by @kbd{@@} instead.
 @end defopt
 
 The difference between @code{TeX-insert-macro} and
diff --git a/doc/changes.texi b/doc/changes.texi
index 3e3f417..ba38bf4 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -40,6 +40,16 @@ no longer works with @previewlatex{}.  We consider this 
incompatibility
 is permissible because e-@TeX{} extension is enabled for standard
 @LaTeX{} by default long ago.  @LaTeX{} variants such as Xe@LaTeX{} and
 Lua@LaTeX{} are not affected.
+
+@item
+Key binds in Texinfo mode are improved.  Typing @kbd{$}, @kbd{^},
+@kbd{_} and @kbd{\} now just self-inserts without pointless side effects
+in Texinfo mode.
+
+In addition, the option @code{TeX-electric-escape} is now effective in
+Texinfo mode.  When it is enabled, typing @kbd{@@} will invoke
+@code{TeX-electric-macro} offering completion in similar style with
+other TeX modes of @AUCTeX{}.
 @end itemize
 
 @heading News in 12.1
diff --git a/tex-info.el b/tex-info.el
index 3fc868f..71e97c2 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -524,6 +524,18 @@ is assumed by default."
        (define-key map "\e\r" 'texinfo-insert-@item)) ;*** Alias
     (define-key map "\C-c\C-s" 'Texinfo-insert-node)
     (define-key map "\C-c]" 'texinfo-insert-@end)
+
+    ;; Override some bindings in `TeX-mode-map'
+    ;; FIXME: Inside @math{}, you can use all plain TeX math commands
+    ;; even in Texinfo documents.  Thus it might be nice to develop
+    ;; context sensitive command so that the following four keys
+    ;; inherit the command in `TeX-mode-map' inside @math{}.
+    (define-key map "$"  #'self-insert-command)
+    (define-key map "^"  #'self-insert-command)
+    (define-key map "_"  #'self-insert-command)
+    (define-key map "\\" #'self-insert-command)
+    ;; Users benefit from `TeX-electric-macro' even in Texinfo mode
+    (define-key map "@" #'TeX-insert-backslash)
     map)
   "Keymap for Texinfo mode.")
 
diff --git a/tex.el b/tex.el
index 1367d4f..625dd60 100644
--- a/tex.el
+++ b/tex.el
@@ -4798,7 +4798,9 @@ element to ALIST-VAR."
 ;;; Keymap
 
 (defcustom TeX-electric-escape nil
-  "If non-nil, ``\\'' will be bound to `TeX-electric-macro'."
+  "If non-nil, ``\\'' will offer on-the-fly completion.
+In Texinfo-mode, ``@'' will do that job instead and ``\\'' is not
+affected.  See `TeX-electric-macro' for detail."
   :group 'TeX-macro
   :type 'boolean)
 

Reply via email to