Function: reftex-notice-new
reftex-notice-new is an autoloaded and byte-compiled function defined
in reftex-parse.el.gz.
Signature
(reftex-notice-new &optional N FORCE)
Documentation
Hook to handshake with RefTeX after something new has been inserted.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/reftex-parse.el.gz
;;;###autoload
(defun reftex-notice-new (&optional n force)
"Hook to handshake with RefTeX after something new has been inserted."
;; Add a new entry to the docstruct list. If it is a section, renumber
;; the following sections.
;; FIXME: Put in a WHAT parameter and search backward until one is found.
;; When N is given, go back that many matches of reftex-everything-regexp
;; When FORCE is non-nil, also insert if `reftex-where-am-I' was uncertain.
(condition-case nil
(catch 'exit
(unless reftex-mode (throw 'exit nil))
(reftex-access-scan-info)
(let* ((docstruct (symbol-value reftex-docstruct-symbol))
here-I-am appendix tail entry star level
section-number context)
(save-excursion
(when (re-search-backward (reftex-everything-regexp) nil t (or n 1))
;; Find where we are
(setq here-I-am (reftex-where-am-I))
(or here-I-am (throw 'exit nil))
(unless (or force (cdr here-I-am)) (throw 'exit nil))
(setq tail (memq (car here-I-am) docstruct))
(or tail (throw 'exit nil))
(setq reftex-active-toc (reftex-last-assoc-before-elt
'toc (car here-I-am) docstruct)
appendix (reftex-last-assoc-before-elt
'appendix (car here-I-am) docstruct))
;; Initialize section numbers
(if (eq (car (car here-I-am)) 'appendix)
(reftex-init-section-numbers nil t)
(reftex-init-section-numbers reftex-active-toc appendix))
;; Match the section command
(when (re-search-forward (reftex-everything-regexp) nil t)
(cond
((match-end 1)
(push (reftex-label-info (reftex-match-string 1) buffer-file-name)
(cdr tail)))
((match-end 3)
(setq star (= ?* (char-after (match-end 3)))
entry (reftex-section-info (buffer-file-name))
level (nth 5 entry))
;; Insert the section info
(push entry (cdr tail))
;; We are done unless we use section numbers
(unless (nth 1 reftex-label-menu-flags) (throw 'exit nil))
;; Update the remaining toc items
(setq tail (cdr tail))
(while (and (setq tail (memq (assq 'toc (cdr tail)) tail))
(setq entry (car tail))
(>= (nth 5 entry) level))
(setq star (string-search "*" (nth 6 entry))
context (nth 2 entry)
section-number
(reftex-section-number (nth 5 entry) star))
(when (string-match "\\`\\([ \t]*\\)\\([.0-9A-Z]+\\)\\(.*\\)"
context)
(when (and (not appendix)
(>= (string-to-char (match-string 2)) ?A))
;; Just entered the appendix. Get out.
(throw 'exit nil))
;; Change the section number.
(setf (nth 2 entry)
(concat (match-string 1 context)
section-number
(match-string 3 context))))))
((match-end 10)
;; Index entry
(and reftex-support-index
(setq entry (reftex-index-info-safe buffer-file-name))
;; FIXME: (add-to-list 'reftex--index-tags (nth 1 index-entry))
(push entry (cdr tail))))))))))
(error nil))
)