Function: reftex-index-initialize-phrases-buffer
reftex-index-initialize-phrases-buffer is an interactive and
byte-compiled function defined in reftex-index.el.gz.
Signature
(reftex-index-initialize-phrases-buffer &optional MASTER)
Documentation
Initialize the phrases buffer by creating the header.
If the buffer is non-empty, delete the old header first.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/reftex-index.el.gz
(defun reftex-index-initialize-phrases-buffer (&optional master)
"Initialize the phrases buffer by creating the header.
If the buffer is non-empty, delete the old header first."
(interactive)
(let* ((case-fold-search t)
(default-key (car reftex-index-default-macro))
(default-macro (nth 1 (assoc default-key
reftex-key-to-index-macro-alist)))
(macro-alist
(sort (copy-sequence reftex-index-macro-alist)
(lambda (a _b) (equal (car a) default-macro))))
macro entry key repeat)
(when master (setq-local TeX-master (file-name-nondirectory master)))
(when (> (buffer-size) 0)
(goto-char 1)
(set-mark (point))
(while (re-search-forward reftex-index-phrases-macrodef-regexp nil t)
(end-of-line))
(beginning-of-line 2)
(if (looking-at reftex-index-phrases-comment-regexp)
(beginning-of-line 2))
(while (looking-at "^[ \t]*$")
(beginning-of-line 2))
(activate-mark)
(if (yes-or-no-p "Delete and rebuild header? ")
(delete-region (point-min) (point))))
;; Insert the mode line
(insert
(format "%% -*- mode: reftex-index-phrases; TeX-master: \"%s\" -*-\n"
(file-name-nondirectory (reftex-index-phrase-tex-master))))
;; Insert the macro definitions
(insert "% Key Macro Format Repeat\n")
(insert "%---------------------------------------------------------------------\n")
(while (setq entry (pop macro-alist))
(setq macro (car entry)
repeat (nth 7 entry)
key (car (delq nil (mapcar (lambda (x) (if (equal (nth 1 x) macro)
(car x)
nil))
reftex-key-to-index-macro-alist))))
(insert (format ">>>INDEX_MACRO_DEFINITION:\t%s\t%-20s\t%s\n"
(char-to-string key) (concat macro "{%s}")
(if repeat "t" "nil"))))
(insert "%---------------------------------------------------------------------\n\n\n")))