Commit 7c4d13cc authored by Carsten Dominik's avatar Carsten Dominik

* reftex.el (reftex-compile-variables): respect new structure of

`reftex-index-macro'
(reftex-compile-variables): Use the changed structure of
`reftex-label-alist'.

* reftex-vars.el (reftex-index-math-format,
(reftex-toc-max-level): New option.
reftex-index-phrases-search-whole-words,
reftex-index-phrases-case-fold-search,
reftex-index-phrases-skip-indexed-matches,
reftex-index-phrases-wrap-long-lines,
reftex-index-phrases-sort-prefers-entry,
reftex-index-phrases-sort-in-blocks): New options.
(reftex-index-macros): Option structure changed.
(reftex-index-macros-builtin): Added `repeat' item to each entry.
(reftex-label-alist): Additional item in each entry to specify if
the environment should be listed in the TOC.
(eval-when-compile (require 'cl)) added.

* reftex-index.el (reftex-index-selection-or-word): No longer
deals with "repeat".
(reftex-index): "repeat property in `reftex-index-macro-alist' is
now used.
(reftex-index-phrases-comment-regexp,
reftex-index-phrases-macrodef-regexp,
reftex-index-phrases-phrase-regexp1,
reftex-index-phrases-phrase-regexp2,
reftex-index-phrases-phrase-regexp12, reftex-index-phrases-help):
New constants.
(reftex-index-phrases-macro-data, reftex-index-phrases-files,
reftex-index-phrases-font-lock-keywords,
reftex-index-phrases-font-lock-defaults, reftex-index-phrases-map,
reftex-index-phrases-restrict-file): New variables.
(reftex-index-phrase-selection-or-word,
reftex-index-visit-phrases-buffer,
reftex-index-initialize-phrases-buffer,
reftex-index-phrases-save-and-return, reftex-index-phrases-mode,
reftex-index-next-phrase, reftex-index-this-phrase,
reftex-index-all-phrases, reftex-index-region-phrases,
reftex-index-phrases-parse-header,
reftex-index-phrases-toggle-restricted, reftex-index-new-phrase,
reftex-index-find-next-conflict-phrase, reftex-index-phrases-info,
reftex-index-phrases-set-macro-key, reftex-index-sort-phrases,
reftex-compare-phrase-lines, reftex-index-make-phrase-regexp,
reftex-index-simplify-phrase, reftex-index-phrases-find-dup-re,
reftex-index-make-replace-string,
reftex-query-index-phrase-globally, reftex-query-index-phrase,
reftex-index-phrase-match-is-indexed,
reftex-index-phrases-fixup-line,
reftex-index-phrases-replace-space,
reftex-index-select-phrases-macro): New functions.
(reftex-index-globalize, reftex-index-globally): functions removed
(eval-when-compile (require 'cl)) added.

* reftex-toc.el (reftex-toc-mode): Create new indicator for max
level.
(reftex-toc-max-level-indicator): New variable.
(reftex-toc-max-level): New command.
(reftex-toc-map): New keybinding `t'.
(reftex-toc-help): Constant updated.
(eval-when-compile (require 'cl)) added.

* reftex-ref.el (reftex-offer-label-menu): Prefix to `t' command key
can change `reftex-toc-max-level'
(eval-when-compile (require 'cl)) added.

* reftex-sel (reftex-insert-docstruct): Respect
`reftex-toc-max-level'
(eval-when-compile (require 'cl)) added.

* reftex-auc.el (eval-when-compile (require 'cl)) added.

* reftex-vcr.el (eval-when-compile (require 'cl)) added.

* reftex-cite.el (reftex-citep, reftex-citet): New commands.
(reftex-citation, reftex-do-citation,
reftex-figure-out-cite-format): Additional argument FORMAT-KEY to
preselect a citation format.
(eval-when-compile (require 'cl)) added.

* reftex-parse.el (reftex-context-substring): Optional parameter
to-end
(reftex-section-info): Deal with environment matches.
(eval-when-compile (require 'cl)) added.

* reftex-global.el (eval-when-compile (require 'cl)) added.
parent cfad01b4
;;; reftex-auc.el - RefTeX's interface to AUC TeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-auc)
(require 'reftex)
;;;
......
;;; reftex-cite.el - Creating citations with RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-cite)
(require 'reftex)
;;;
......@@ -501,7 +502,7 @@
;; Make a citation
;;;###autoload
(defun reftex-citation (&optional no-insert)
(defun reftex-citation (&optional no-insert format-key)
"Make a citation using BibTeX database files.
After prompting for a regular expression, scans the buffers with
bibtex entries (taken from the \\bibliography command) and offers the
......@@ -510,6 +511,8 @@ to `reftex-cite-format' and inserted into the buffer.
If NO-INSERT is non-nil, nothing is inserted, only the selected key returned.
FORAT-KEY can be used to pre-select a citation format.
When called with one or two `C-u' prefixes, first rescans the document.
When called with a numeric prefix, make that many citations. When
called with point inside the braces of a `\cite' command, it will
......@@ -533,13 +536,13 @@ While entering the regexp, completion on knows citation keys is possible.
;; Call reftex-do-citation, but protected
(unwind-protect
(reftex-do-citation current-prefix-arg no-insert)
(reftex-do-citation current-prefix-arg no-insert format-key)
(reftex-kill-temporary-buffers)))
(defun reftex-do-citation (&optional arg no-insert)
(defun reftex-do-citation (&optional arg no-insert format-key)
;; This really does the work of reftex-citation.
(let* ((format (reftex-figure-out-cite-format arg no-insert))
(let* ((format (reftex-figure-out-cite-format arg no-insert format-key))
(docstruct-symbol reftex-docstruct-symbol)
(selected-entries (reftex-offer-bib-menu))
(insert-entries selected-entries)
......@@ -610,7 +613,7 @@ While entering the regexp, completion on knows citation keys is possible.
;; Return the citation key
(car (car selected-entries))))
(defun reftex-figure-out-cite-format (arg no-insert)
(defun reftex-figure-out-cite-format (arg &optional no-insert format-key)
;; Check if there is already a cite command at point and change cite format
;; in order to only add another reference in the same cite command.
(let ((macro (car (reftex-what-macro 1)))
......@@ -640,19 +643,30 @@ While entering the regexp, completion on knows citation keys is possible.
cite-format-value))
(when (listp format)
(setq key
(reftex-select-with-char
"" (concat "SELECT A CITATION FORMAT\n\n"
(mapconcat
(lambda (x)
(format "[%c] %s %s" (car x)
(if (> (car x) 31) " " "")
(cdr x)))
format "\n"))))
(or format-key
(reftex-select-with-char
"" (concat "SELECT A CITATION FORMAT\n\n"
(mapconcat
(lambda (x)
(format "[%c] %s %s" (car x)
(if (> (car x) 31) " " "")
(cdr x)))
format "\n")))))
(if (assq key format)
(setq format (cdr (assq key format)))
(error "No citation format associated with key `%c'" key)))))
format))
(defun reftex-citep ()
"Call `reftex-citation' with a format selector `?p'."
(interactive)
(reftex-citation nil ?p))
(defun reftex-citet ()
"Call `reftex-citation' with a format selector `?t'."
(interactive)
(reftex-citation nil ?t))
(defvar reftex-select-bib-map)
(defun reftex-offer-bib-menu ()
;; Offer bib menu and return list of selected items
......
;;; reftex-global.el - Operations on entire documents with RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-global)
(require 'reftex)
;;;
......@@ -191,7 +192,7 @@ one with the `xr' package."
(if (assoc label translate-alist)
(error "Duplicate label %s" label))
(setq new-label (concat (match-string 1 (car entry))
(incf (cdr nr-cell))))
(int-to-string (incf (cdr nr-cell)))))
(push (cons label new-label) translate-alist)
(or (string= label new-label) (setq changed-sequence t))))
......
This diff is collapsed.
;;; reftex-parse.el - Parser Functions for RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-parse)
(require 'reftex)
......@@ -216,16 +217,18 @@ of master file."
;; Insert in List
(setq toc-entry (reftex-section-info file))
(setq level (nth 5 toc-entry))
(setq highest-level (min highest-level level))
(if (= level highest-level)
(message
"Scanning %s %s ..."
(car (rassoc level reftex-section-levels-all))
(nth 6 toc-entry)))
(push toc-entry docstruct)
(setq reftex-active-toc toc-entry))
(when toc-entry
;; It can happen that section info returns nil
(setq level (nth 5 toc-entry))
(setq highest-level (min highest-level level))
(if (= level highest-level)
(message
"Scanning %s %s ..."
(car (rassoc level reftex-section-levels-all))
(nth 6 toc-entry)))
(push toc-entry docstruct)
(setq reftex-active-toc toc-entry)))
((match-end 7)
;; It's an include or input
......@@ -355,6 +358,9 @@ of master file."
;; Carefull: This function expects the match-data to be still 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))
......@@ -363,7 +369,9 @@ of master file."
(unnumbered (or star (< level 0)))
(level (abs level))
(section-number (reftex-section-number level unnumbered))
(text1 (save-match-data (save-excursion (reftex-context-substring))))
(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))))
......@@ -376,6 +384,7 @@ of master file."
(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))))
......@@ -908,10 +917,20 @@ of master file."
(forward-list 1))
(error nil)))
(defun reftex-context-substring ()
(defun reftex-context-substring (&optional to-end)
;; Return up to 150 chars from point
;; When point is just after a { or [, limit string to matching parenthesis
(cond
(to-end
;; Environment - find next \end
(buffer-substring-no-properties
(point)
(min (+ (point) 150)
(save-match-data
;; FIXME: THis is not perfect
(if (re-search-forward "\\\\end{" nil t)
(match-beginning 0)
(point-max))))))
((or (= (preceding-char) ?\{)
(= (preceding-char) ?\[))
;; Inside a list - get only the list.
......
;;; reftex-ref.el - Code to create labels and references with RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-ref)
(require 'reftex)
;;;
......@@ -561,9 +562,12 @@ When called with 2 C-u prefix args, disable magic word recognition."
(setq here-I-am here-I-am1)
(setq typekey (reftex-query-label-type)))
((eq key ?t)
;; toggle table of contents display
;; toggle table of contents display, or change depth
(reftex-erase-buffer)
(setq toc (not toc)))
(if current-prefix-arg
(setq reftex-toc-max-level (prefix-numeric-value
current-prefix-arg))
(setq toc (not toc))))
((eq key ?F)
;; toggle display of included file borders
(reftex-erase-buffer)
......
;;; reftex-sel.el - The selection modes for RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-sel)
(require 'reftex)
;;;
......@@ -180,7 +181,8 @@ During a selection process, these are the local bindings.
((eq (car cell) 'toc)
;; a table of contents entry
(when toc
(when (and toc
(<= (nth 5 cell) reftex-toc-max-level))
(if (eq offset 'attention) (setq offset cell))
(setq reftex-active-toc cell)
(insert (concat toc-indent (nth 2 cell) "\n"))
......
;;; reftex-toc.el - RefTeX's table of contents mode
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-toc)
(require 'reftex)
;;;
......@@ -27,12 +28,16 @@ Here are all local bindings.
(use-local-map reftex-toc-map)
(set (make-local-variable 'revert-buffer-function) 'reftex-toc-revert)
(set (make-local-variable 'reftex-toc-include-labels-indicator) "")
(set (make-local-variable 'reftex-toc-include-index-indicator) "")
(set (make-local-variable 'reftex-toc-max-level-indicator)
(if (= reftex-toc-max-level 100)
"ALL"
(int-to-string reftex-toc-max-level)))
(setq mode-line-format
(list "---- " 'mode-line-buffer-identification
" " 'global-mode-string " (" mode-name ")"
" L<" 'reftex-toc-include-labels-indicator ">"
" I<" 'reftex-toc-include-index-indicator ">"
" T<" 'reftex-toc-max-level-indicator ">"
" -%-"))
(setq truncate-lines t)
(make-local-hook 'post-command-hook)
......@@ -49,6 +54,7 @@ Here are all local bindings.
(defvar reftex-last-window-height nil)
(defvar reftex-toc-include-labels-indicator nil)
(defvar reftex-toc-include-index-indicator nil)
(defvar reftex-toc-max-level-indicator nil)
(defvar reftex-toc-return-marker (make-marker)
"Marker which makes it possible to return from toc to old position.")
......@@ -63,6 +69,7 @@ RET Goto the location and hide the *toc* window (also on mouse-2).
C-c > Display Index. With prefix arg, restrict index to current section.
q / k Hide/Kill *toc* buffer, return to position of reftex-toc command.
l i c F Toggle display of [l]abels, [i]ndex, [c]ontext, [F]ile borders.
t Change maximum toc depth (e.g. `3 t' hides levels greater than 3).
f / g Toggle follow mode on and off / Refresh *toc* buffer.
r / C-u r Reparse the LaTeX document / Reparse entire LaTeX document.
. In other window, show position from where `reftex-toc' was called.
......@@ -281,6 +288,17 @@ Label context is only displayed when the labels are there as well."
(interactive)
(setq reftex-toc-include-context (not reftex-toc-include-context))
(reftex-toc-revert))
(defun reftex-toc-max-level (arg)
"Set the maximum level of toc lines in this buffer to value of prefix ARG.
When no prefix is given, set the max level to a large number, so that all
levels are shown. For eaxample, to set the level to 3, type `3 m'."
(interactive "P")
(setq reftex-toc-max-level (if arg
(prefix-numeric-value arg)
100))
(setq reftex-toc-max-level-indicator
(if arg (int-to-string reftex-toc-max-level) "ALL"))
(reftex-toc-revert))
(defun reftex-toc-view-line ()
"View document location in other window."
(interactive)
......@@ -473,7 +491,7 @@ With prefix arg 1, restrict index to the section at point."
(car
(rassq level
reftex-section-levels-all)))
"[[{]"))))
"[[{]?"))))
((or (not no-revisit)
(reftex-get-buffer-visiting file))
;; Marker is lost. Use the backup method.
......@@ -535,6 +553,7 @@ With prefix arg 1, restrict index to the section at point."
("F" . reftex-toc-toggle-file-boundary)
("i" . reftex-toc-toggle-index)
("l" . reftex-toc-toggle-labels)
("t" . reftex-toc-max-level)
("c" . reftex-toc-toggle-context)
("%" . reftex-toc-toggle-commented)
("x" . reftex-toc-external)
......
This diff is collapsed.
;;; reftex-vcr.el - Viewing cross references and citations with RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-vcr)
(require 'reftex)
;;;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment