aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2000-11-06 15:53:05 +0000
committerStefan Monnier2000-11-06 15:53:05 +0000
commit6f602bd0634a209c112d7e5e872384e0a7187e71 (patch)
tree52e015c90fcaae497a899776ccab4b16f02bfaa8
parent17ff7a277a9add4a3f3eae371caedddb5173977c (diff)
downloademacs-6f602bd0634a209c112d7e5e872384e0a7187e71.tar.gz
emacs-6f602bd0634a209c112d7e5e872384e0a7187e71.zip
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-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.
-rw-r--r--lisp/ChangeLog30
-rw-r--r--lisp/textmodes/texnfo-upd.el141
2 files changed, 78 insertions, 93 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9a324524bdc..c7f3d0cf175 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,10 +1,32 @@
12000-11-06 Stefan Monnier <monnier@cs.yale.edu>
2
3 * textmodes/texnfo-upd.el: Require texinfo.
4 (defmacro, defgroup): Remove.
5 (texinfo-section-to-generic-alist): Remove.
6 Use texinfo-section-list instead (i.e. level is changed string->int).
7 (texinfo-filter): New function.
8 (texinfo-chapter-level-regexp, texinfo-subsubsection-level-regexp)
9 (texinfo-subsection-level-regexp, texinfo-section-level-regexp):
10 Use it. And use regexp-opt.
11 (texinfo-find-higher-level-node, texinfo-hierarchic-level)
12 (texinfo-update-menu-region-beginning)
13 (texinfo-update-menu-higher-regexps, texinfo-update-menu-lower-regexps)
14 (texinfo-update-the-node, texinfo-sequentially-update-the-node)
15 (texinfo-update-menu-same-level-regexps): Update.
16 (texinfo-update-node, texinfo-every-node-update)
17 (texinfo-sequential-node-update): Remove autoload cookie.
18
19 * textmodes/texinfo.el (texinfo-section-list): Change majorheading.
20 (texinfo-font-lock-syntactic-keywords): Use syntax-strings.
21 (texinfo-chapter-level-regexp): Remove.
22 (texinfo-mode): Hard code texinfo-chapter-level-regexp.
23
12000-11-06 Dave Love <fx@gnu.org> 242000-11-06 Dave Love <fx@gnu.org>
2 25
3 * autoinsert.el (auto-insert-alist) <latex-mode>: Use 26 * autoinsert.el (auto-insert-alist) <latex-mode>: Use \documentclass.
4 \documentclass.
5 27
6 * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Match 28 * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression):
7 defun*. 29 Match defun*.
8 30
92000-11-06 Kenichi Handa <handa@etl.go.jp> 312000-11-06 Kenichi Handa <handa@etl.go.jp>
10 32
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index 81cadf107f2..0c59eadfcc7 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -149,12 +149,8 @@
149 149
150;;; Code: 150;;; Code:
151 151
152(or (fboundp 'defgroup) 152(require 'texinfo)
153 (defmacro defgroup (&rest ignore) nil))
154 153
155(or (fboundp 'defcustom)
156 (defmacro defcustom (var value doc &rest ignore)
157 `(defvar ,var ,value ,doc)))
158 154
159(defvar texinfo-master-menu-header 155(defvar texinfo-master-menu-header
160 " --- The Detailed Node Listing ---\n" 156 " --- The Detailed Node Listing ---\n"
@@ -315,7 +311,7 @@ if the match is found there, the value is t and point does not move."
315 311
316 (let ((case-fold-search t)) 312 (let ((case-fold-search t))
317 (cond 313 (cond
318 ((or (string-equal "top" level) (string-equal "chapter" level)) 314 ((< level 3)
319 (if (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" region-end t) 315 (if (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" region-end t)
320 (progn (beginning-of-line) t))) 316 (progn (beginning-of-line) t)))
321 (t 317 (t
@@ -1045,9 +1041,9 @@ error if the node is not the top node and a section is not found."
1045 "Return the general hierarchal level of the next node in a texinfo file. 1041 "Return the general hierarchal level of the next node in a texinfo file.
1046Thus, a subheading or appendixsubsec is of type subsection." 1042Thus, a subheading or appendixsubsec is of type subsection."
1047 (let ((case-fold-search t)) 1043 (let ((case-fold-search t))
1048 (cdr (assoc 1044 (cadr (assoc
1049 (texinfo-specific-section-type) 1045 (texinfo-specific-section-type)
1050 texinfo-section-to-generic-alist)))) 1046 texinfo-section-list))))
1051 1047
1052 1048
1053;;; Locating the major positions 1049;;; Locating the major positions
@@ -1062,8 +1058,7 @@ Only argument is a string of the general type of section."
1062 ;; returns the beginning of the buffer as the beginning of the 1058 ;; returns the beginning of the buffer as the beginning of the
1063 ;; higher level section. 1059 ;; higher level section.
1064 (cond 1060 (cond
1065 ((or (string-equal "top" level) 1061 ((< level 3)
1066 (string-equal "chapter" level))
1067 (save-excursion 1062 (save-excursion
1068 (goto-char (point-min)) 1063 (goto-char (point-min))
1069 (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t) 1064 (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t)
@@ -1122,86 +1117,58 @@ end of that region; it limits the search."
1122 (point))) 1117 (point)))
1123 1118
1124 1119
1125;;; Alists and regular expressions for defining hierarchical levels
1126
1127(defvar texinfo-section-to-generic-alist
1128 '(("top" . "top")
1129
1130 ("chapter" . "chapter")
1131 ("unnumbered" . "chapter")
1132 ("majorheading" . "chapter")
1133 ("chapheading" . "chapter")
1134 ("appendix" . "chapter")
1135
1136 ("section" . "section")
1137 ("unnumberedsec" . "section")
1138 ("heading" . "section")
1139 ("appendixsec" . "section")
1140
1141 ("subsection" . "subsection")
1142 ("unnumberedsubsec" . "subsection")
1143 ("subheading" . "subsection")
1144 ("appendixsubsec" . "subsection")
1145
1146 ("subsubsection" . "subsubsection")
1147 ("unnumberedsubsubsec" . "subsubsection")
1148 ("subsubheading" . "subsubsection")
1149 ("appendixsubsubsec" . "subsubsection"))
1150 "*An alist of specific and corresponding generic Texinfo section types.
1151The keys are strings specifying specific types of section; the values
1152are strings of their corresponding general types.")
1153
1154;; We used to look for just sub, but that found @subtitle. 1120;; We used to look for just sub, but that found @subtitle.
1155(defvar texinfo-section-types-regexp 1121(defvar texinfo-section-types-regexp
1156 "^@\\(chapter \\|sect\\|subs\\|subh\\|unnum\\|major\\|chapheading \\|heading \\|appendix\\)" 1122 "^@\\(chapter \\|sect\\|subs\\|subh\\|unnum\\|major\\|chapheading \\|heading \\|appendix\\)"
1157 "Regexp matching chapter, section, other headings (but not the top node).") 1123 "Regexp matching chapter, section, other headings (but not the top node).")
1158 1124
1125(defun texinfo-filter (section list)
1126 (let (res)
1127 (dolist (x list) (if (eq section (cadr x)) (push (car x) res)))
1128 res))
1129
1159(defvar texinfo-chapter-level-regexp 1130(defvar texinfo-chapter-level-regexp
1160 "chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading" 1131 (regexp-opt (texinfo-filter 2 texinfo-section-list))
1161 "Regular expression matching just the Texinfo chapter level headings.") 1132 "Regular expression matching just the Texinfo chapter level headings.")
1162 1133
1163(defvar texinfo-section-level-regexp 1134(defvar texinfo-section-level-regexp
1164 "section\\|unnumberedsec\\|heading \\|appendixsec" 1135 (regexp-opt (texinfo-filter 3 texinfo-section-list))
1165 "Regular expression matching just the Texinfo section level headings.") 1136 "Regular expression matching just the Texinfo section level headings.")
1166 1137
1167(defvar texinfo-subsection-level-regexp 1138(defvar texinfo-subsection-level-regexp
1168 "subsection\\|unnumberedsubsec\\|subheading\\|appendixsubsec" 1139 (regexp-opt (texinfo-filter 4 texinfo-section-list))
1169 "Regular expression matching just the Texinfo subsection level headings.") 1140 "Regular expression matching just the Texinfo subsection level headings.")
1170 1141
1171(defvar texinfo-subsubsection-level-regexp 1142(defvar texinfo-subsubsection-level-regexp
1172 "subsubsection\\|unnumberedsubsubsec\\|subsubheading\\|appendixsubsubsec" 1143 (regexp-opt (texinfo-filter 5 texinfo-section-list))
1173 "Regular expression matching just the Texinfo subsubsection level headings.") 1144 "Regular expression matching just the Texinfo subsubsection level headings.")
1174 1145
1175(defvar texinfo-update-menu-same-level-regexps 1146(defvar texinfo-update-menu-same-level-regexps
1176 '(("top" . "top[ \t]+") 1147 '((1 . "top[ \t]+")
1177 ("chapter" . 1148 (2 . (concat "\\(^@\\)\\(" texinfo-chapter-level-regexp "\\)\\>[ \t]*"))
1178 (concat "\\(^@\\)\\(" texinfo-chapter-level-regexp "\\)[ \t]*")) 1149 (3 . (concat "\\(^@\\)\\(" texinfo-section-level-regexp "\\)\\>[ \t]*"))
1179 ("section" . 1150 (4 . (concat "\\(^@\\)\\(" texinfo-subsection-level-regexp "\\)\\>[ \t]+"))
1180 (concat "\\(^@\\)\\(" texinfo-section-level-regexp "\\)[ \t]*")) 1151 (5 . (concat "\\(^@\\)\\(" texinfo-subsubsection-level-regexp "\\)\\>[ \t]+")))
1181 ("subsection" .
1182 (concat "\\(^@\\)\\(" texinfo-subsection-level-regexp "\\)[ \t]+"))
1183 ("subsubsection" .
1184 (concat "\\(^@\\)\\(" texinfo-subsubsection-level-regexp "\\)[ \t]+")))
1185 "*Regexps for searching for same level sections in a Texinfo file. 1152 "*Regexps for searching for same level sections in a Texinfo file.
1186The keys are strings specifying the general hierarchical level in the 1153The keys are strings specifying the general hierarchical level in the
1187document; the values are regular expressions.") 1154document; the values are regular expressions.")
1188 1155
1189(defvar texinfo-update-menu-higher-regexps 1156(defvar texinfo-update-menu-higher-regexps
1190 '(("top" . "^@node [ \t]*DIR") 1157 '((1 . "^@node [ \t]*DIR")
1191 ("chapter" . "^@node [ \t]*top[ \t]*\\(,\\|$\\)") 1158 (2 . "^@node [ \t]*top[ \t]*\\(,\\|$\\)")
1192 ("section" . 1159 (3 .
1193 (concat 1160 (concat
1194 "\\(^@\\(" 1161 "\\(^@\\("
1195 texinfo-chapter-level-regexp 1162 texinfo-chapter-level-regexp
1196 "\\)[ \t]*\\)")) 1163 "\\)\\>[ \t]*\\)"))
1197 ("subsection" . 1164 (4 .
1198 (concat 1165 (concat
1199 "\\(^@\\(" 1166 "\\(^@\\("
1200 texinfo-section-level-regexp 1167 texinfo-section-level-regexp
1201 "\\|" 1168 "\\|"
1202 texinfo-chapter-level-regexp 1169 texinfo-chapter-level-regexp
1203 "\\)[ \t]*\\)")) 1170 "\\)\\>[ \t]*\\)"))
1204 ("subsubsection" . 1171 (5 .
1205 (concat 1172 (concat
1206 "\\(^@\\(" 1173 "\\(^@\\("
1207 texinfo-subsection-level-regexp 1174 texinfo-subsection-level-regexp
@@ -1209,13 +1176,13 @@ document; the values are regular expressions.")
1209 texinfo-section-level-regexp 1176 texinfo-section-level-regexp
1210 "\\|" 1177 "\\|"
1211 texinfo-chapter-level-regexp 1178 texinfo-chapter-level-regexp
1212 "\\)[ \t]*\\)"))) 1179 "\\)\\>[ \t]*\\)")))
1213 "*Regexps for searching for higher level sections in a Texinfo file. 1180 "*Regexps for searching for higher level sections in a Texinfo file.
1214The keys are strings specifying the general hierarchical level in the 1181The keys are strings specifying the general hierarchical level in the
1215document; the values are regular expressions.") 1182document; the values are regular expressions.")
1216 1183
1217(defvar texinfo-update-menu-lower-regexps 1184(defvar texinfo-update-menu-lower-regexps
1218 '(("top" . 1185 '((1 .
1219 (concat 1186 (concat
1220 "\\(^@\\(" 1187 "\\(^@\\("
1221 texinfo-chapter-level-regexp 1188 texinfo-chapter-level-regexp
@@ -1225,8 +1192,8 @@ document; the values are regular expressions.")
1225 texinfo-subsection-level-regexp 1192 texinfo-subsection-level-regexp
1226 "\\|" 1193 "\\|"
1227 texinfo-subsubsection-level-regexp 1194 texinfo-subsubsection-level-regexp
1228 "\\)[ \t]*\\)")) 1195 "\\)\\>[ \t]*\\)"))
1229 ("chapter" . 1196 (2 .
1230 (concat 1197 (concat
1231 "\\(^@\\(" 1198 "\\(^@\\("
1232 texinfo-section-level-regexp 1199 texinfo-section-level-regexp
@@ -1234,20 +1201,20 @@ document; the values are regular expressions.")
1234 texinfo-subsection-level-regexp 1201 texinfo-subsection-level-regexp
1235 "\\|" 1202 "\\|"
1236 texinfo-subsubsection-level-regexp 1203 texinfo-subsubsection-level-regexp
1237 "\\)[ \t]*\\)")) 1204 "\\)\\>[ \t]*\\)"))
1238 ("section" . 1205 (3 .
1239 (concat 1206 (concat
1240 "\\(^@\\(" 1207 "\\(^@\\("
1241 texinfo-subsection-level-regexp 1208 texinfo-subsection-level-regexp
1242 "\\|" 1209 "\\|"
1243 texinfo-subsubsection-level-regexp 1210 texinfo-subsubsection-level-regexp
1244 "\\)[ \t]+\\)")) 1211 "\\)\\>[ \t]+\\)"))
1245 ("subsection" . 1212 (4 .
1246 (concat 1213 (concat
1247 "\\(^@\\(" 1214 "\\(^@\\("
1248 texinfo-subsubsection-level-regexp 1215 texinfo-subsubsection-level-regexp
1249 "\\)[ \t]+\\)")) 1216 "\\)\\>[ \t]+\\)"))
1250 ("subsubsection" . "nothing lower")) 1217 (subsubsection . "nothing lower"))
1251 "*Regexps for searching for lower level sections in a Texinfo file. 1218 "*Regexps for searching for lower level sections in a Texinfo file.
1252The keys are strings specifying the general hierarchical level in the 1219The keys are strings specifying the general hierarchical level in the
1253document; the values are regular expressions.") 1220document; the values are regular expressions.")
@@ -1255,7 +1222,6 @@ document; the values are regular expressions.")
1255 1222
1256;;; Updating a node 1223;;; Updating a node
1257 1224
1258;;;###autoload
1259(defun texinfo-update-node (&optional beginning end) 1225(defun texinfo-update-node (&optional beginning end)
1260 "Without any prefix argument, update the node in which point is located. 1226 "Without any prefix argument, update the node in which point is located.
1261Interactively, a prefix argument means to operate on the region. 1227Interactively, a prefix argument means to operate on the region.
@@ -1299,7 +1265,6 @@ which menu descriptions are indented. Its default value is 32."
1299 (goto-char (point-max)) 1265 (goto-char (point-max))
1300 (message "Done...nodes updated in region. You may save the buffer.")))))) 1266 (message "Done...nodes updated in region. You may save the buffer."))))))
1301 1267
1302;;;###autoload
1303(defun texinfo-every-node-update () 1268(defun texinfo-every-node-update ()
1304 "Update every node in a Texinfo file." 1269 "Update every node in a Texinfo file."
1305 (interactive) 1270 (interactive)
@@ -1320,7 +1285,7 @@ Leave point at the end of the node line."
1320 (level (texinfo-hierarchic-level)) 1285 (level (texinfo-hierarchic-level))
1321 (beginning (texinfo-update-menu-region-beginning level)) 1286 (beginning (texinfo-update-menu-region-beginning level))
1322 (end (texinfo-update-menu-region-end level))) 1287 (end (texinfo-update-menu-region-end level)))
1323 (if (string-equal level "top") 1288 (if (eq level 1)
1324 (texinfo-top-pointer-case) 1289 (texinfo-top-pointer-case)
1325 ;; else 1290 ;; else
1326 (texinfo-insert-pointer beginning end level 'next) 1291 (texinfo-insert-pointer beginning end level 'next)
@@ -1508,7 +1473,6 @@ towards which the pointer is directed, one of `next', `previous', or `up'."
1508;; (The subsection to which `Next' points will most likely be the first 1473;; (The subsection to which `Next' points will most likely be the first
1509;; item on the section's menu.) 1474;; item on the section's menu.)
1510 1475
1511;;;###autoload
1512(defun texinfo-sequential-node-update (&optional region-p) 1476(defun texinfo-sequential-node-update (&optional region-p)
1513 "Update one node (or many) in a Texinfo file with sequential pointers. 1477 "Update one node (or many) in a Texinfo file with sequential pointers.
1514 1478
@@ -1557,22 +1521,21 @@ Info `g*' command is inadequate."
1557A `Next' or `Previous' pointer points to any preceding or following node, 1521A `Next' or `Previous' pointer points to any preceding or following node,
1558regardless of its hierarchical level." 1522regardless of its hierarchical level."
1559 1523
1560 (texinfo-check-for-node-name) 1524 (texinfo-check-for-node-name)
1561 (texinfo-delete-existing-pointers) 1525 (texinfo-delete-existing-pointers)
1562 (message 1526 (message
1563 "Sequentially updating node: %s ... " (texinfo-copy-node-name)) 1527 "Sequentially updating node: %s ... " (texinfo-copy-node-name))
1564 (save-restriction 1528 (save-restriction
1565 (widen) 1529 (widen)
1566 (let* 1530 (let* ((case-fold-search t)
1567 ((case-fold-search t) 1531 (level (texinfo-hierarchic-level)))
1568 (level (texinfo-hierarchic-level))) 1532 (if (eq level 1)
1569 (if (string-equal level "top") 1533 (texinfo-top-pointer-case)
1570 (texinfo-top-pointer-case) 1534 ;; else
1571 ;; else 1535 (texinfo-sequentially-insert-pointer level 'next)
1572 (texinfo-sequentially-insert-pointer level 'next) 1536 (texinfo-sequentially-insert-pointer level 'previous)
1573 (texinfo-sequentially-insert-pointer level 'previous) 1537 (texinfo-sequentially-insert-pointer level 'up)
1574 (texinfo-sequentially-insert-pointer level 'up) 1538 (texinfo-clean-up-node-line)))))
1575 (texinfo-clean-up-node-line)))))
1576 1539
1577(defun texinfo-sequentially-find-pointer (level direction) 1540(defun texinfo-sequentially-find-pointer (level direction)
1578 "Find next or previous pointer sequentially in Texinfo file, or up pointer. 1541 "Find next or previous pointer sequentially in Texinfo file, or up pointer.