]> git.eshelyaron.com Git - emacs.git/commitdiff
Require texinfo.
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 6 Nov 2000 15:53:05 +0000 (15:53 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 6 Nov 2000 15:53:05 +0000 (15:53 +0000)
(defmacro, defgroup): Remove.
(texinfo-section-to-generic-alist): Remove.
Use texinfo-section-list instead (i.e. level is changed string->int).
(texinfo-filter): New function.
(texinfo-chapter-level-regexp, texinfo-subsubsection-level-regexp)
(texinfo-subsection-level-regexp, texinfo-section-level-regexp):
Use it.  And use regexp-opt.
(texinfo-find-higher-level-node, texinfo-hierarchic-level)
(texinfo-update-menu-region-beginning)
(texinfo-update-menu-same-level-regexps)
(texinfo-update-menu-higher-regexps, texinfo-update-menu-lower-regexps)
(texinfo-update-the-node, texinfo-sequentially-update-the-node): Update.
(texinfo-update-node, texinfo-every-node-update)
(texinfo-sequential-node-update): Remove autoload cookie.

lisp/ChangeLog
lisp/textmodes/texnfo-upd.el

index 9a324524bdc086e9932546b223bb060513cfe6a2..c7f3d0cf1756ad9f1f33ca2d4936b8db9962f919 100644 (file)
@@ -1,10 +1,32 @@
+2000-11-06  Stefan Monnier  <monnier@cs.yale.edu>
+
+       * textmodes/texnfo-upd.el: Require texinfo.
+       (defmacro, defgroup): Remove.
+       (texinfo-section-to-generic-alist): Remove.
+       Use texinfo-section-list instead (i.e. level is changed string->int).
+       (texinfo-filter): New function.
+       (texinfo-chapter-level-regexp, texinfo-subsubsection-level-regexp)
+       (texinfo-subsection-level-regexp, texinfo-section-level-regexp):
+       Use it.  And use regexp-opt.
+       (texinfo-find-higher-level-node, texinfo-hierarchic-level)
+       (texinfo-update-menu-region-beginning)
+       (texinfo-update-menu-higher-regexps, texinfo-update-menu-lower-regexps)
+       (texinfo-update-the-node, texinfo-sequentially-update-the-node)
+       (texinfo-update-menu-same-level-regexps): Update.
+       (texinfo-update-node, texinfo-every-node-update) 
+       (texinfo-sequential-node-update): Remove autoload cookie.
+
+       * textmodes/texinfo.el (texinfo-section-list): Change majorheading.
+       (texinfo-font-lock-syntactic-keywords): Use syntax-strings.
+       (texinfo-chapter-level-regexp): Remove.
+       (texinfo-mode): Hard code texinfo-chapter-level-regexp.
+
 2000-11-06  Dave Love  <fx@gnu.org>
 
-       * autoinsert.el (auto-insert-alist) <latex-mode>: Use
-       \documentclass.
+       * autoinsert.el (auto-insert-alist) <latex-mode>: Use \documentclass.
 
-       * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Match
-       defun*.
+       * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression):
+       Match defun*.
 
 2000-11-06  Kenichi Handa  <handa@etl.go.jp>
 
index 81cadf107f2eba8220fe4452941aaf97bfdcb1cf..0c59eadfcc75c9f7216523fa236befe771a112c7 100644 (file)
 \f
 ;;; Code:
 
-(or (fboundp 'defgroup)
-    (defmacro defgroup (&rest ignore) nil))
+(require 'texinfo)
 
-(or (fboundp 'defcustom)
-    (defmacro defcustom (var value doc &rest ignore)
-      `(defvar ,var ,value ,doc)))
 
 (defvar texinfo-master-menu-header
   " --- The Detailed Node Listing ---\n"
@@ -315,7 +311,7 @@ if the match is found there, the value is t and point does not move."
 
   (let ((case-fold-search t))
     (cond
-     ((or (string-equal "top" level) (string-equal "chapter" level))
+     ((< level 3)
       (if (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" region-end t)
          (progn (beginning-of-line) t)))
      (t
@@ -1045,9 +1041,9 @@ error if the node is not the top node and a section is not found."
   "Return the general hierarchal level of the next node in a texinfo file.
 Thus, a subheading or appendixsubsec is of type subsection."
   (let ((case-fold-search t))
-    (cdr (assoc
+    (cadr (assoc
          (texinfo-specific-section-type)
-         texinfo-section-to-generic-alist))))
+         texinfo-section-list))))
 
 \f
 ;;; Locating the major positions
@@ -1062,8 +1058,7 @@ Only argument is a string of the general type of section."
     ;; returns the beginning of the buffer as the beginning of the
     ;; higher level section.
     (cond
-     ((or (string-equal "top" level)
-         (string-equal "chapter" level))
+     ((< level 3)
       (save-excursion
        (goto-char (point-min))
        (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t)
@@ -1122,86 +1117,58 @@ end of that region; it limits the search."
     (point)))
 
 \f
-;;; Alists and regular expressions for defining hierarchical levels
-
-(defvar texinfo-section-to-generic-alist
-  '(("top" . "top")
-
-    ("chapter" . "chapter")
-    ("unnumbered" . "chapter")
-    ("majorheading" . "chapter")
-    ("chapheading" . "chapter")
-    ("appendix" . "chapter")
-
-    ("section" . "section")
-    ("unnumberedsec" . "section")
-    ("heading" . "section")
-    ("appendixsec" . "section")
-
-    ("subsection" . "subsection")
-    ("unnumberedsubsec" . "subsection")
-    ("subheading" . "subsection")
-    ("appendixsubsec" . "subsection")
-
-    ("subsubsection" . "subsubsection")
-    ("unnumberedsubsubsec" . "subsubsection")
-    ("subsubheading" . "subsubsection")
-    ("appendixsubsubsec" . "subsubsection"))
-  "*An alist of specific and corresponding generic Texinfo section types.
-The keys are strings specifying specific types of section; the values
-are strings of their corresponding general types.")
-
 ;; We used to look for just sub, but that found @subtitle.
 (defvar texinfo-section-types-regexp
   "^@\\(chapter \\|sect\\|subs\\|subh\\|unnum\\|major\\|chapheading \\|heading \\|appendix\\)"
   "Regexp matching chapter, section, other headings (but not the top node).")
 
+(defun texinfo-filter (section list)
+  (let (res)
+    (dolist (x list) (if (eq section (cadr x)) (push (car x) res)))
+    res))
+
 (defvar texinfo-chapter-level-regexp
-  "chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading"
+  (regexp-opt (texinfo-filter 2 texinfo-section-list))
   "Regular expression matching just the Texinfo chapter level headings.")
 
 (defvar texinfo-section-level-regexp
-  "section\\|unnumberedsec\\|heading \\|appendixsec"
+  (regexp-opt (texinfo-filter 3 texinfo-section-list))
   "Regular expression matching just the Texinfo section level headings.")
 
 (defvar texinfo-subsection-level-regexp
-  "subsection\\|unnumberedsubsec\\|subheading\\|appendixsubsec"
+  (regexp-opt (texinfo-filter 4 texinfo-section-list))
   "Regular expression matching just the Texinfo subsection level headings.")
 
 (defvar texinfo-subsubsection-level-regexp
-  "subsubsection\\|unnumberedsubsubsec\\|subsubheading\\|appendixsubsubsec"
+  (regexp-opt (texinfo-filter 5 texinfo-section-list))
   "Regular expression matching just the Texinfo subsubsection level headings.")
 
 (defvar texinfo-update-menu-same-level-regexps
-  '(("top" . "top[ \t]+")
-    ("chapter" .
-     (concat "\\(^@\\)\\(" texinfo-chapter-level-regexp "\\)[ \t]*"))
-    ("section" .
-     (concat "\\(^@\\)\\(" texinfo-section-level-regexp "\\)[ \t]*"))
-    ("subsection" .
-     (concat "\\(^@\\)\\(" texinfo-subsection-level-regexp "\\)[ \t]+"))
-    ("subsubsection" .
-     (concat "\\(^@\\)\\(" texinfo-subsubsection-level-regexp "\\)[ \t]+")))
+  '((1 . "top[ \t]+")
+    (2 . (concat "\\(^@\\)\\(" texinfo-chapter-level-regexp "\\)\\>[ \t]*"))
+    (3 . (concat "\\(^@\\)\\(" texinfo-section-level-regexp "\\)\\>[ \t]*"))
+    (4 . (concat "\\(^@\\)\\(" texinfo-subsection-level-regexp "\\)\\>[ \t]+"))
+    (5 . (concat "\\(^@\\)\\(" texinfo-subsubsection-level-regexp "\\)\\>[ \t]+")))
   "*Regexps for searching for same level sections in a Texinfo file.
 The keys are strings specifying the general hierarchical level in the
 document; the values are regular expressions.")
 
 (defvar texinfo-update-menu-higher-regexps
-  '(("top" . "^@node [ \t]*DIR")
-    ("chapter" . "^@node [ \t]*top[ \t]*\\(,\\|$\\)")
-    ("section" .
+  '((1 . "^@node [ \t]*DIR")
+    (2 . "^@node [ \t]*top[ \t]*\\(,\\|$\\)")
+    (3 .
      (concat
       "\\(^@\\("
       texinfo-chapter-level-regexp
-      "\\)[ \t]*\\)"))
-    ("subsection" .
+      "\\)\\>[ \t]*\\)"))
+    (4 .
      (concat
       "\\(^@\\("
       texinfo-section-level-regexp
       "\\|"
       texinfo-chapter-level-regexp
-      "\\)[ \t]*\\)"))
-    ("subsubsection" .
+      "\\)\\>[ \t]*\\)"))
+    (5 .
      (concat
       "\\(^@\\("
       texinfo-subsection-level-regexp
@@ -1209,13 +1176,13 @@ document; the values are regular expressions.")
       texinfo-section-level-regexp
       "\\|"
       texinfo-chapter-level-regexp
-      "\\)[ \t]*\\)")))
+      "\\)\\>[ \t]*\\)")))
   "*Regexps for searching for higher level sections in a Texinfo file.
 The keys are strings specifying the general hierarchical level in the
 document; the values are regular expressions.")
 
 (defvar texinfo-update-menu-lower-regexps
-  '(("top" .
+  '((1 .
      (concat
       "\\(^@\\("
       texinfo-chapter-level-regexp
@@ -1225,8 +1192,8 @@ document; the values are regular expressions.")
       texinfo-subsection-level-regexp
       "\\|"
       texinfo-subsubsection-level-regexp
-      "\\)[ \t]*\\)"))
-    ("chapter" .
+      "\\)\\>[ \t]*\\)"))
+    (2 .
      (concat
       "\\(^@\\("
       texinfo-section-level-regexp
@@ -1234,20 +1201,20 @@ document; the values are regular expressions.")
       texinfo-subsection-level-regexp
       "\\|"
       texinfo-subsubsection-level-regexp
-      "\\)[ \t]*\\)"))
-    ("section" .
+      "\\)\\>[ \t]*\\)"))
+    (3 .
      (concat
       "\\(^@\\("
       texinfo-subsection-level-regexp
       "\\|"
       texinfo-subsubsection-level-regexp
-      "\\)[ \t]+\\)"))
-    ("subsection" .
+      "\\)\\>[ \t]+\\)"))
+    (4 .
      (concat
       "\\(^@\\("
       texinfo-subsubsection-level-regexp
-      "\\)[ \t]+\\)"))
-    ("subsubsection" . "nothing lower"))
+      "\\)\\>[ \t]+\\)"))
+    (subsubsection . "nothing lower"))
   "*Regexps for searching for lower level sections in a Texinfo file.
 The keys are strings specifying the general hierarchical level in the
 document; the values are regular expressions.")
@@ -1255,7 +1222,6 @@ document; the values are regular expressions.")
 \f
 ;;; Updating a node
 
-;;;###autoload
 (defun texinfo-update-node (&optional beginning end)
   "Without any prefix argument, update the node in which point is located.
 Interactively, a prefix argument means to operate on the region.
@@ -1299,7 +1265,6 @@ which menu descriptions are indented. Its default value is 32."
          (goto-char (point-max))
          (message "Done...nodes updated in region.  You may save the buffer."))))))
 
-;;;###autoload
 (defun texinfo-every-node-update ()
   "Update every node in a Texinfo file."
   (interactive)
@@ -1320,7 +1285,7 @@ Leave point at the end of the node line."
         (level (texinfo-hierarchic-level))
         (beginning (texinfo-update-menu-region-beginning level))
         (end (texinfo-update-menu-region-end level)))
-      (if (string-equal level "top")
+      (if (eq level 1)
          (texinfo-top-pointer-case)
        ;; else
        (texinfo-insert-pointer beginning end level 'next)
@@ -1508,7 +1473,6 @@ towards which the pointer is directed, one of `next', `previous', or `up'."
 ;; (The subsection to which `Next' points will most likely be the first
 ;; item on the section's menu.)
 
-;;;###autoload
 (defun texinfo-sequential-node-update (&optional region-p)
   "Update one node (or many) in a Texinfo file with sequential pointers.
 
@@ -1557,22 +1521,21 @@ Info `g*' command is inadequate."
 A `Next' or `Previous' pointer points to any preceding or following node,
 regardless of its hierarchical level."
 
-       (texinfo-check-for-node-name)
-       (texinfo-delete-existing-pointers)
-       (message
-        "Sequentially updating node: %s ... " (texinfo-copy-node-name))
-       (save-restriction
-         (widen)
-         (let*
-             ((case-fold-search t)
-              (level (texinfo-hierarchic-level)))
-           (if (string-equal level "top")
-               (texinfo-top-pointer-case)
-             ;; else
-             (texinfo-sequentially-insert-pointer level 'next)
-             (texinfo-sequentially-insert-pointer level 'previous)
-             (texinfo-sequentially-insert-pointer level 'up)
-             (texinfo-clean-up-node-line)))))
+  (texinfo-check-for-node-name)
+  (texinfo-delete-existing-pointers)
+  (message
+   "Sequentially updating node: %s ... " (texinfo-copy-node-name))
+  (save-restriction
+    (widen)
+    (let* ((case-fold-search t)
+          (level (texinfo-hierarchic-level)))
+      (if (eq level 1)
+         (texinfo-top-pointer-case)
+       ;; else
+       (texinfo-sequentially-insert-pointer level 'next)
+       (texinfo-sequentially-insert-pointer level 'previous)
+       (texinfo-sequentially-insert-pointer level 'up)
+       (texinfo-clean-up-node-line)))))
 
 (defun texinfo-sequentially-find-pointer (level direction)
   "Find next or previous pointer sequentially in Texinfo file, or up pointer.