- (progn
- (widen)
- (goto-char (point-min))
- (if (search-forward "\^_\nIndirect:\n" nil t)
- (message "Cannot tagify split info file")
- (let ((regexp "Node:[ \t]*\\([^,\n\t]\\)*[,\t\n]")
- (case-fold-search t)
- list)
- (while (search-forward "\n\^_" nil t)
- (forward-line 1)
- (let ((beg (point)))
- (forward-line 1)
- (if (re-search-backward regexp beg t)
- (setq list
- (cons (list (buffer-substring
- (match-beginning 1)
- (match-end 1))
- beg)
- list)))))
+ (progn
+ (widen)
+ (goto-char (point-min))
+ (if (search-forward "\^_\nIndirect:\n" nil t)
+ (message
+ "Cannot tagify split info file. Run this before splitting.")
+ (let (tag-list
+ refillp
+ (case-fold-search t)
+ (regexp
+ (concat
+ "\\("
+
+
+ "\\("
+ "@anchor" ; match-string 2 matches @anchor
+ "\\)"
+ "\\(-no\\|-yes\\)" ; match-string 3 matches -no or -yes
+ "\\("
+ "-refill"
+ "\\)"
+
+ "\\("
+ "{"
+ "\\)"
+ "\\("
+ "[^}]+" ; match-string 6 matches arg to anchor
+ "\\)"
+ "\\("
+ "}"
+ "\\)"
+
+ "\\|"
+
+ "\\("
+ "\n\^_\\(\^L\\)?"
+ "\\)"
+
+ "\\("
+ "\n\\(File:[ \t]*\\([^,\n\t]*\\)[,\t\n]+[ \t\n]*\\)?"
+ "Node:[ \t]*"
+ "\\("
+ "[^,\n\t]*" ; match-string 13 matches arg to node name
+ "\\)"
+ "[,\t\n]"
+ "\\)"
+
+ "\\)"
+ )))
+ (while (re-search-forward regexp nil t)
+ (if (string-equal "@anchor" (match-string 2))
+ (progn
+ ;; kludge lest lose match-data
+ (if (string-equal "-yes" (match-string 3))
+ (setq refillp t))
+ (setq tag-list
+ (cons (list
+ (concat "Ref: " (match-string 6))
+ (match-beginning 0))
+ tag-list))
+ (if (eq refillp t)
+ ;; set start and end so texinfo-format-refill works
+ (let ((texinfo-command-start (match-beginning 0))
+ (texinfo-command-end (match-end 0)))
+ (texinfo-format-refill))
+ (delete-region (match-beginning 0) (match-end 0))))
+ ;; else this is a Node
+ (setq tag-list
+ (cons (list
+ (concat "Node: " (match-string-no-properties 13))
+ (1+ (match-beginning 10)))
+ tag-list))))
+