Function: reftex-index-phrases-parse-header

reftex-index-phrases-parse-header is a byte-compiled function defined in reftex-index.el.gz.

Signature

(reftex-index-phrases-parse-header &optional GET-FILES)

Documentation

Parse the header of a phrases file to extract the macro definitions.

The definitions get stored in reftex-index-phrases-macro-data. Also switches to the LaTeX document to find out which files belong to the document and stores the list in reftex-index-phrases-files.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-index.el.gz
(defun reftex-index-phrases-parse-header (&optional get-files)
  "Parse the header of a phrases file to extract the macro definitions.
The definitions get stored in `reftex-index-phrases-macro-data'.
Also switches to the LaTeX document to find out which files belong to
the document and stores the list in `reftex-index-phrases-files'."
  (let* ((master (reftex-index-phrase-tex-master))
         buf)
    (if get-files
        ;; Get the file list
        (save-excursion
          (setq buf (reftex-get-file-buffer-force master))
          (unless buf (error "Master file %s not found" master))
          (set-buffer buf)
          (reftex-access-scan-info)
          (setq reftex-index-phrases-files
                (reftex-all-document-files))))
    ;; Parse the files header for macro definitions
    (setq reftex-index-phrases-macro-data nil)
    (save-excursion
      (goto-char (point-min))
      (while (re-search-forward reftex-index-phrases-macrodef-regexp nil t)
        (push (list
               (string-to-char (match-string 2))
               (match-string 4)
               (equal (match-string 6) "t"))
              reftex-index-phrases-macro-data))
      ;; Reverse the list, so that the first macro is first
      (if (null reftex-index-phrases-macro-data)
          (error "No valid MACRO DEFINITION line in %s file (make sure to use TAB separators)" reftex-index-phrase-file-extension))
      (setq reftex-index-phrases-macro-data
            (nreverse reftex-index-phrases-macro-data))
      (goto-char (point-min)))))