]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/texinfo.el
Fix problems caused by new implementation of sub-word mode
[gnu-emacs] / lisp / textmodes / texinfo.el
index 895adbf892ea62262320c2dbbe8ca0a5afb43ed1..ed6022f9fbb40d98a21e401e031aa2a938000d3d 100644 (file)
@@ -1,6 +1,6 @@
-;;; texinfo.el --- major mode for editing Texinfo files -*- coding: utf-8 -*-
+;;; texinfo.el --- major mode for editing Texinfo files
 
-;; Copyright (C) 1985, 1988-1993, 1996-1997, 2000-2015 Free Software
+;; Copyright (C) 1985, 1988-1993, 1996-1997, 2000-2016 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Robert J. Chassell
@@ -86,7 +86,7 @@ command to gain use of `next-error'."
   "Make Info file from current buffer.
 
 Use the \\[next-error] command to move to the next error
-\(if there are errors\)."
+\(if there are errors)."
   t nil)
 
 (autoload 'kill-compilation
@@ -368,8 +368,10 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
     ;; their arguments frequently include a @@, and we don't want that
     ;; to overwrite the normal fontification of the argument.
     ("@\\(file\\|email\\){\\([^}]+\\)" 2 font-lock-string-face keep)
-    ("@\\(samp\\|code\\|var\\|math\\|env\\|command\\|option\\){\\([^}]+\\)"
+    ("@\\(samp\\|code\\|var\\|env\\|command\\|option\\){\\([^}]+\\)"
      2 font-lock-variable-name-face keep)
+    ;; @math allows nested braces like @math{2^{12}}
+    ("@math{\\([^{}]*{?[^{}]*}?[^{}]*\\)}" 1 font-lock-variable-name-face)
     ("@\\(cite\\|x?ref\\|pxref\\|dfn\\|inforef\\){\\([^}]+\\)"
      2 font-lock-constant-face)
     ("@\\(anchor\\){\\([^}]+\\)" 2 font-lock-type-face)
@@ -391,7 +393,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
        (unless (get-char-property start 'text-clones)
          (if endp
              (texinfo-last-unended-begin)
-           (forward-word 1)
+           (forward-word-strictly 1)
            (texinfo-next-unmatched-end))
          (skip-syntax-forward "^w")
          (when (looking-at
@@ -689,8 +691,8 @@ Puts point on a blank line between them."
   '("example\\>" "smallexample\\>" "lisp\\>"))
 (defun texinfo-insert-quote (&optional arg)
   "Insert the appropriate quote mark for Texinfo.
-Usually inserts the value of `texinfo-open-quote' (normally ``) or
-`texinfo-close-quote' (normally ''), depending on the context.
+Usually inserts the value of `texinfo-open-quote' (normally \\=`\\=`) or
+`texinfo-close-quote' (normally \\='\\='), depending on the context.
 With prefix argument or inside @code or @example, inserts a plain \"."
   (interactive "*P")
   (let ((top (or (save-excursion (re-search-backward "@node\\>" nil t))
@@ -736,7 +738,7 @@ With prefix argument or inside @code or @example, inserts a plain \"."
   "Insert the matching `@end' for the last Texinfo command that needs one."
         (ignore-errors
           (save-excursion
-      (backward-word 1)
+             (backward-word-strictly 1)
             (texinfo-last-unended-begin)
       (or (match-string 1) '-)))
   \n "@end " str \n \n)