Function: reftex-section-info
reftex-section-info is an autoloaded and byte-compiled function
defined in reftex-parse.el.gz.
Signature
(reftex-section-info FILE)
Documentation
Return a section entry for the current match.
Careful: This function expects the match-data to still be in
place!
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/reftex-parse.el.gz
;;;###autoload
(defun reftex-section-info (file)
"Return a section entry for the current match.
Careful: This function expects the `match-data' to still be in
place!"
(let* ((marker (set-marker (make-marker) (1- (match-beginning 3))))
(macro (reftex-match-string 3))
(prefix (save-match-data
(if (string-match "begin{\\([^}]+\\)}" macro)
(match-string 1 macro))))
(level-exp (cdr (assoc macro reftex-section-levels-all)))
(level (if (symbolp level-exp)
(save-match-data (funcall level-exp))
level-exp))
(star (= ?* (char-after (match-end 3))))
(unnumbered (or star (< level 0)))
(level (abs level))
(section-number (reftex-section-number level unnumbered))
(text1 (save-match-data
(save-excursion
(reftex-context-substring prefix))))
(literal (buffer-substring-no-properties
(1- (match-beginning 3))
(min (point-max) (+ (match-end 0) (length text1) 1))))
;; Literal can be too short since text1 too short. No big problem.
(text (reftex-nicify-text text1)))
;; Add section number and indentation
(setq text
(concat
(make-string (* reftex-level-indent level) ?\ )
(if (nth 1 reftex-label-menu-flags) ; section number flag
(concat section-number " "))
(if prefix (concat (capitalize prefix) ": ") "")
text))
(list 'toc "toc" text file marker level section-number
literal (marker-position marker))))