aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorCarsten Dominik2002-07-22 10:38:32 +0000
committerCarsten Dominik2002-07-22 10:38:32 +0000
commit6fbeb4293696fae4524135e41c23fd78d566eeb0 (patch)
treee8cb868ed38728598a1978e6f67b41042ed56b7e /lisp/textmodes
parentb0e057bc0a65607340557686ca78d4489977455c (diff)
downloademacs-6fbeb4293696fae4524135e41c23fd78d566eeb0.tar.gz
emacs-6fbeb4293696fae4524135e41c23fd78d566eeb0.zip
Updated to reftex 4.17
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/reftex-auc.el4
-rw-r--r--lisp/textmodes/reftex-cite.el128
-rw-r--r--lisp/textmodes/reftex-dcr.el4
-rw-r--r--lisp/textmodes/reftex-global.el4
-rw-r--r--lisp/textmodes/reftex-index.el7
-rw-r--r--lisp/textmodes/reftex-parse.el10
-rw-r--r--lisp/textmodes/reftex-ref.el4
-rw-r--r--lisp/textmodes/reftex-sel.el4
-rw-r--r--lisp/textmodes/reftex-toc.el27
-rw-r--r--lisp/textmodes/reftex-vars.el116
-rw-r--r--lisp/textmodes/reftex.el53
11 files changed, 219 insertions, 142 deletions
diff --git a/lisp/textmodes/reftex-auc.el b/lisp/textmodes/reftex-auc.el
index 840bb889781..4546651da91 100644
--- a/lisp/textmodes/reftex-auc.el
+++ b/lisp/textmodes/reftex-auc.el
@@ -1,8 +1,8 @@
1;;; reftex-auc.el --- RefTeX's interface to AUC TeX 1;;; reftex-auc.el --- RefTeX's interface to AUC TeX
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 37833be278c..ebcfd991829 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -1,8 +1,8 @@
1;;; reftex-cite.el --- creating citations with RefTeX 1;;; reftex-cite.el --- creating citations with RefTeX
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
@@ -53,6 +53,15 @@
53 53
54;; Find bibtex files 54;; Find bibtex files
55 55
56
57(defmacro reftex-with-special-syntax-for-bib (&rest body)
58 `(let ((saved-syntax (syntax-table)))
59 (unwind-protect
60 (progn
61 (set-syntax-table reftex-syntax-table-for-bib)
62 ,@body)
63 (set-syntax-table saved-syntax))))
64
56(defun reftex-default-bibliography () 65(defun reftex-default-bibliography ()
57 ;; Return the expanded value of `reftex-default-bibliography'. 66 ;; Return the expanded value of `reftex-default-bibliography'.
58 ;; The expanded value is cached. 67 ;; The expanded value is cached.
@@ -193,63 +202,64 @@
193 (message "Scanning bibliography database %s" buffer1)) 202 (message "Scanning bibliography database %s" buffer1))
194 203
195 (set-buffer buffer1) 204 (set-buffer buffer1)
196 (save-excursion 205 (reftex-with-special-syntax-for-bib
197 (goto-char (point-min)) 206 (save-excursion
198 (while (re-search-forward first-re nil t) 207 (goto-char (point-min))
199 (catch 'search-again 208 (while (re-search-forward first-re nil t)
200 (setq key-point (point)) 209 (catch 'search-again
201 (unless (re-search-backward 210 (setq key-point (point))
202 "\\(\\`\\|[\n\r]\\)[ \t]*@\\([a-zA-Z]+\\)[ \t\n\r]*[{(]" nil t) 211 (unless (re-search-backward
203 (throw 'search-again nil)) 212 "\\(\\`\\|[\n\r]\\)[ \t]*@\\([a-zA-Z]+\\)[ \t\n\r]*[{(]" nil t)
204 (setq start-point (point)) 213 (throw 'search-again nil))
205 (goto-char (match-end 0)) 214 (setq start-point (point))
206 (condition-case nil 215 (goto-char (match-end 0))
207 (up-list 1) 216 (condition-case nil
208 (error (goto-char key-point) 217 (up-list 1)
218 (error (goto-char key-point)
209 (throw 'search-again nil))) 219 (throw 'search-again nil)))
210 (setq end-point (point)) 220 (setq end-point (point))
211 221
212 ;; Ignore @string, @comment and @c entries or things 222 ;; Ignore @string, @comment and @c entries or things
213 ;; outside entries 223 ;; outside entries
214 (when (or (string= (downcase (match-string 2)) "string") 224 (when (or (string= (downcase (match-string 2)) "string")
215 (string= (downcase (match-string 2)) "comment") 225 (string= (downcase (match-string 2)) "comment")
216 (string= (downcase (match-string 2)) "c") 226 (string= (downcase (match-string 2)) "c")
217 (< (point) key-point)) ; this means match not in {} 227 (< (point) key-point)) ; this means match not in {}
218 (goto-char key-point) 228 (goto-char key-point)
219 (throw 'search-again nil)) 229 (throw 'search-again nil))
220 230
221 ;; Well, we have got a match 231 ;; Well, we have got a match
222 (setq entry (concat 232 (setq entry (concat
223 (buffer-substring start-point (point)) "\n")) 233 (buffer-substring start-point (point)) "\n"))
224 234
225 ;; Check if other regexp match as well 235 ;; Check if other regexp match as well
226 (setq re-list rest-re) 236 (setq re-list rest-re)
227 (while re-list 237 (while re-list
228 (unless (string-match (car re-list) entry) 238 (unless (string-match (car re-list) entry)
229 ;; nope - move on 239 ;; nope - move on
230 (throw 'search-again nil)) 240 (throw 'search-again nil))
231 (pop re-list)) 241 (pop re-list))
232 242
233 (setq alist (reftex-parse-bibtex-entry 243 (setq alist (reftex-parse-bibtex-entry
234 nil start-point end-point)) 244 nil start-point end-point))
235 (push (cons "&entry" entry) alist) 245 (push (cons "&entry" entry) alist)
236 246
237 ;; check for crossref entries 247 ;; check for crossref entries
238 (if (assoc "crossref" alist) 248 (if (assoc "crossref" alist)
239 (setq alist 249 (setq alist
240 (append 250 (append
241 alist (reftex-get-crossref-alist alist)))) 251 alist (reftex-get-crossref-alist alist))))
242 252
243 ;; format the entry 253 ;; format the entry
244 (push (cons "&formatted" (reftex-format-bib-entry alist)) 254 (push (cons "&formatted" (reftex-format-bib-entry alist))
245 alist) 255 alist)
246 256
247 ;; make key the first element 257 ;; make key the first element
248 (push (reftex-get-bib-field "&key" alist) alist) 258 (push (reftex-get-bib-field "&key" alist) alist)
249 259
250 ;; add it to the list 260 ;; add it to the list
251 (push alist found-list)))) 261 (push alist found-list)))))
252 (reftex-kill-temporary-buffers)))) 262 (reftex-kill-temporary-buffers))))
253 (setq found-list (nreverse found-list)) 263 (setq found-list (nreverse found-list))
254 264
255 ;; Sorting 265 ;; Sorting
@@ -390,6 +400,7 @@
390 (progn 400 (progn
391 (set-buffer (get-buffer-create " *RefTeX-scratch*")) 401 (set-buffer (get-buffer-create " *RefTeX-scratch*"))
392 (fundamental-mode) 402 (fundamental-mode)
403 (set-syntax-table reftex-syntax-table-for-bib)
393 (erase-buffer) 404 (erase-buffer)
394 (insert entry)) 405 (insert entry))
395 (widen) 406 (widen)
@@ -834,6 +845,7 @@ While entering the regexp, completion on knows citation keys is possible.
834 845
835(defun reftex-format-names (namelist n) 846(defun reftex-format-names (namelist n)
836 (let (last (len (length namelist))) 847 (let (last (len (length namelist)))
848 (if (= n 0) (setq n len))
837 (cond 849 (cond
838 ((< len 1) "") 850 ((< len 1) "")
839 ((= 1 len) (car namelist)) 851 ((= 1 len) (car namelist))
diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el
index 8c179ff32b1..c0af53a9bc6 100644
--- a/lisp/textmodes/reftex-dcr.el
+++ b/lisp/textmodes/reftex-dcr.el
@@ -1,8 +1,8 @@
1;;; reftex-dcr.el --- viewing cross references and citations with RefTeX 1;;; reftex-dcr.el --- viewing cross references and citations with RefTeX
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index 6810b80adfc..d19b45d76de 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -1,8 +1,8 @@
1;;; reftex-global.el --- operations on entire documents with RefTeX 1;;; reftex-global.el --- operations on entire documents with RefTeX
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index 660dcfaadc2..5db364c371f 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -1,8 +1,8 @@
1;;; reftex-index.el --- index support with RefTeX 1;;; reftex-index.el --- index support with RefTeX
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
@@ -1819,6 +1819,9 @@ both ends."
1819 (unwind-protect 1819 (unwind-protect
1820 (while (re-search-forward re nil t) 1820 (while (re-search-forward re nil t)
1821 (catch 'next-match 1821 (catch 'next-match
1822 (if (and (fboundp reftex-index-verify-function)
1823 (not (funcall reftex-index-verify-function)))
1824 (throw 'next-match nil))
1822 (setq match (match-string 0)) 1825 (setq match (match-string 0))
1823 (setq mathp 1826 (setq mathp
1824 (save-match-data 1827 (save-match-data
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index 1bb6a24bce5..3a42bc7d85b 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -1,8 +1,8 @@
1;;; reftex-parse.el --- parser functions for RefTeX 1;;; reftex-parse.el --- parser functions for RefTeX
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
@@ -198,6 +198,7 @@ of master file."
198 toc-entry index-entry next-buf buf) 198 toc-entry index-entry next-buf buf)
199 199
200 (catch 'exit 200 (catch 'exit
201 (debug)
201 (setq file-found (reftex-locate-file file "tex" master-dir)) 202 (setq file-found (reftex-locate-file file "tex" master-dir))
202 (if (and (not file-found) 203 (if (and (not file-found)
203 (setq buf (reftex-get-buffer-visiting file))) 204 (setq buf (reftex-get-buffer-visiting file)))
@@ -334,7 +335,10 @@ of master file."
334 (save-excursion 335 (save-excursion
335 (goto-char (point-min)) 336 (goto-char (point-min))
336 (if (re-search-forward 337 (if (re-search-forward
337 "\\(\\`\\|[\n\r]\\)[ \t]*\\\\\\(no\\)?bibliography{[ \t]*\\([^}]+\\)" nil t) 338 (concat
339 "\\(\\`\\|[\n\r]\\)[^%]*\\\\\\("
340 (mapconcat 'identity reftex-bibliography-commands "\\|")
341 "\\){[ \t]*\\([^}]+\\)") nil t)
338 (setq files 342 (setq files
339 (split-string (reftex-match-string 3) 343 (split-string (reftex-match-string 3)
340 "[ \t\n\r]*,[ \t\n\r]*"))))) 344 "[ \t\n\r]*,[ \t\n\r]*")))))
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index 4db17b238b7..982062e12f9 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -1,8 +1,8 @@
1;;; reftex-ref.el --- code to create labels and references with RefTeX 1;;; reftex-ref.el --- code to create labels and references with RefTeX
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index 05aadeeb03d..f59e2a1e03f 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -1,8 +1,8 @@
1;;; reftex-sel.el --- the selection modes for RefTeX 1;;; reftex-sel.el --- the selection modes for RefTeX
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index 2ec1040d190..15685939815 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -1,8 +1,8 @@
1;;; reftex-toc.el --- RefTeX's table of contents mode 1;;; reftex-toc.el --- RefTeX's table of contents mode
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
@@ -72,6 +72,7 @@ Here are all local bindings.
72 "Stores the file name from which `reftex-toc' was called. For redo command.") 72 "Stores the file name from which `reftex-toc' was called. For redo command.")
73 73
74(defvar reftex-last-window-height nil) 74(defvar reftex-last-window-height nil)
75(defvar reftex-last-window-width nil)
75(defvar reftex-toc-include-labels-indicator nil) 76(defvar reftex-toc-include-labels-indicator nil)
76(defvar reftex-toc-include-index-indicator nil) 77(defvar reftex-toc-include-index-indicator nil)
77(defvar reftex-toc-max-level-indicator nil) 78(defvar reftex-toc-max-level-indicator nil)
@@ -127,7 +128,7 @@ When called with a raw C-u prefix, rescan the document first."
127 (docstruct-symbol reftex-docstruct-symbol) 128 (docstruct-symbol reftex-docstruct-symbol)
128 (xr-data (assq 'xr (symbol-value reftex-docstruct-symbol))) 129 (xr-data (assq 'xr (symbol-value reftex-docstruct-symbol)))
129 (xr-alist (cons (cons "" (buffer-file-name)) (nth 1 xr-data))) 130 (xr-alist (cons (cons "" (buffer-file-name)) (nth 1 xr-data)))
130 (here-I-am (if rebuild 131 (here-I-am (if rebuild
131 (get 'reftex-toc :reftex-data) 132 (get 'reftex-toc :reftex-data)
132 (car (reftex-where-am-I)))) 133 (car (reftex-where-am-I))))
133 offset) 134 offset)
@@ -137,8 +138,14 @@ When called with a raw C-u prefix, rescan the document first."
137 (when (or (not reftex-toc-keep-other-windows) 138 (when (or (not reftex-toc-keep-other-windows)
138 (< (window-height) (* 2 window-min-height))) 139 (< (window-height) (* 2 window-min-height)))
139 (delete-other-windows)) 140 (delete-other-windows))
140 (setq reftex-last-window-height (window-height)) ; remember 141
141 (split-window) 142 (setq reftex-last-window-width (window-width)
143 reftex-last-window-height (window-height)) ; remember
144 (if reftex-toc-split-windows-horizontally
145 (split-window-horizontally
146 (floor (* (frame-width) reftex-toc-split-windows-horizontally-fraction)))
147 (split-window))
148
142 (let ((default-major-mode 'reftex-toc-mode)) 149 (let ((default-major-mode 'reftex-toc-mode))
143 (switch-to-buffer "*toc*"))) 150 (switch-to-buffer "*toc*")))
144 151
@@ -237,9 +244,13 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
237 244
238(defun reftex-re-enlarge () 245(defun reftex-re-enlarge ()
239 ;; Enlarge windiw to a remembered size 246 ;; Enlarge windiw to a remembered size
240 (enlarge-window 247 (if reftex-toc-split-windows-horizontally
241 (max 0 (- (or reftex-last-window-height (window-height)) 248 (enlarge-window-horizontally
242 (window-height))))) 249 (max 0 (- (or reftex-last-window-width (window-width))
250 (window-width))))
251 (enlarge-window
252 (max 0 (- (or reftex-last-window-height (window-height))
253 (window-height))))))
243 254
244(defun reftex-toc-show-help () 255(defun reftex-toc-show-help ()
245 "Show a summary of special key bindings." 256 "Show a summary of special key bindings."
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index eac9d644d6f..05588d712e6 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -1,8 +1,8 @@
1;;; reftex-vars.el --- configuration variables for RefTeX 1;;; reftex-vars.el --- configuration variables for RefTeX
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
@@ -136,7 +136,8 @@ distribution. Mixed-case symbols are convenience aliases.")
136 (?s . "\\citep[see][]{%l}") 136 (?s . "\\citep[see][]{%l}")
137 (?a . "\\citeauthor{%l}") 137 (?a . "\\citeauthor{%l}")
138 (?A . "\\citeauthor*{%l}") 138 (?A . "\\citeauthor*{%l}")
139 (?y . "\\citeyear{%l}"))) 139 (?y . "\\citeyear{%l}")
140 (?n . "\\nocite{%l}")))
140 (bibentry "The Bibentry package" 141 (bibentry "The Bibentry package"
141 "\\bibentry{%l}") 142 "\\bibentry{%l}")
142 (harvard "The Harvard package" 143 (harvard "The Harvard package"
@@ -205,12 +206,57 @@ distribution. Mixed-case symbols are convenience aliases.")
205 :prefix "reftex-" 206 :prefix "reftex-"
206 :group 'tex) 207 :group 'tex)
207 208
209
208;; Table of contents configuration -------------------------------------- 210;; Table of contents configuration --------------------------------------
209 211
210(defgroup reftex-table-of-contents-browser nil 212(defgroup reftex-table-of-contents-browser nil
211 "A multifile table of contents browser." 213 "A multifile table of contents browser."
212 :group 'reftex) 214 :group 'reftex)
213 215
216(defcustom reftex-include-file-commands '("include" "input")
217 "LaTeX commands which input another file.
218The file name is expected after the command, either in braces or separated
219by whitespace."
220 :group 'reftex-table-of-contents-browser
221 :type '(repeat string))
222
223(defcustom reftex-max-section-depth 12
224 "Maximum depth of section levels in document structure.
225Standard LaTeX needs default is 7, but there are packages for which this
226needs to be larger."
227 :group 'reftex-table-of-contents-browser
228 :type 'integer)
229
230;; LaTeX section commands and level numbers
231(defcustom reftex-section-levels
232 '(
233 ("part" . 0)
234 ("chapter" . 1)
235 ("section" . 2)
236 ("subsection" . 3)
237 ("subsubsection" . 4)
238 ("paragraph" . 5)
239 ("subparagraph" . 6)
240 ("subsubparagraph" . 7)
241 ("addchap" . -1) ; KOMA-Script
242 ("addsec" . -2) ; KOMA-Script
243;;; ("minisec" . -7) ; KOMA-Script
244 )
245 "Commands and levels used for defining sections in the document.
246This is an alist with each element like (COMMAND-NAME . LEVEL).
247The car of each cons cell is the name of the section macro (without
248the backslash). The cdr is a number indicating its level. A negative
249level means the same level as the positive value, but the section will
250never get a number. The cdr may also be a function which will be called
251to after the section-re matched to determine the level."
252 :group 'reftex-table-of-contents-browser
253 :set 'reftex-set-dirty
254 :type '(repeat
255 (cons (string :tag "sectioning macro" "")
256 (choice
257 (number :tag "level " 0)
258 (symbol :tag "function " my-level-func)))))
259
214(defcustom reftex-toc-max-level 100 260(defcustom reftex-toc-max-level 100
215 "*The maximum level of toc entries which will be included in the TOC. 261 "*The maximum level of toc entries which will be included in the TOC.
216Section headings with a bigger level will be ignored. In RefTeX, chapters 262Section headings with a bigger level will be ignored. In RefTeX, chapters
@@ -219,6 +265,17 @@ This variable can be changed from within the *toc* buffer with the `t' key."
219 :group 'reftex-table-of-contents-browser 265 :group 'reftex-table-of-contents-browser
220 :type 'integer) 266 :type 'integer)
221 267
268(defcustom reftex-toc-split-windows-horizontally nil
269 "*Non-nil means, create TOC window by splitting window horizontally."
270 :group 'reftex-table-of-contents-browser
271 :type 'boolean)
272
273(defcustom reftex-toc-split-windows-horizontally-fraction .5
274 "*Fraction of the horizontal width of the frame to be used for TOC window.
275Only relevant when `reftex-toc-split-windows-horizontally' is non-nil."
276 :group 'reftex-table-of-contents-browser
277 :type 'number)
278
222(defcustom reftex-toc-keep-other-windows t 279(defcustom reftex-toc-keep-other-windows t
223 "*Non-nil means, split the selected window to display the *toc* buffer. 280 "*Non-nil means, split the selected window to display the *toc* buffer.
224This helps to keep the window configuration, but makes the *toc* small. 281This helps to keep the window configuration, but makes the *toc* small.
@@ -479,43 +536,6 @@ list. However, builtin defaults should normally be set with the variable
479 (nth 0 x))) 536 (nth 0 x)))
480 reftex-label-alist-builtin))))) 537 reftex-label-alist-builtin)))))
481 538
482(defcustom reftex-max-section-depth 12
483 "Maximum depth of section levels in document structure.
484Standard LaTeX needs default is 7, but there are packages for which this
485needs to be larger."
486 :group 'reftex-defining-label-environments
487 :type 'integer)
488
489;; LaTeX section commands and level numbers
490(defcustom reftex-section-levels
491 '(
492 ("part" . 0)
493 ("chapter" . 1)
494 ("section" . 2)
495 ("subsection" . 3)
496 ("subsubsection" . 4)
497 ("paragraph" . 5)
498 ("subparagraph" . 6)
499 ("subsubparagraph" . 7)
500 ("addchap" . -1) ; KOMA-Script
501 ("addsec" . -2) ; KOMA-Script
502;;; ("minisec" . -7) ; KOMA-Script
503 )
504 "Commands and levels used for defining sections in the document.
505This is an alist with each element like (COMMAND-NAME . LEVEL).
506The car of each cons cell is the name of the section macro (without
507the backslash). The cdr is a number indicating its level. A negative
508level means the same level as the positive value, but the section will
509never get a number. The cdr may also be a function which will be called
510to after the section-re matched to determine the level."
511 :group 'reftex-defining-label-environments
512 :set 'reftex-set-dirty
513 :type '(repeat
514 (cons (string :tag "sectioning macro" "")
515 (choice
516 (number :tag "level " 0)
517 (symbol :tag "function " my-level-func)))))
518
519(defcustom reftex-section-prefixes '((0 . "part:") (1 . "cha:") (t . "sec:")) 539(defcustom reftex-section-prefixes '((0 . "part:") (1 . "cha:") (t . "sec:"))
520 "Prefixes for section labels. 540 "Prefixes for section labels.
521When the label prefix given in an entry in `reftex-label-alist' contains `%S', 541When the label prefix given in an entry in `reftex-label-alist' contains `%S',
@@ -855,6 +875,12 @@ string to insert into the buffer."
855 "Support for referencing bibliographic data with BibTeX." 875 "Support for referencing bibliographic data with BibTeX."
856 :group 'reftex) 876 :group 'reftex)
857 877
878(defcustom reftex-bibliography-commands '("bibliography" "nobibliography")
879 "LaTeX commands which specify the BibTeX databases to use with the document."
880 :group 'reftex-citation-support
881 :type '(repeat string))
882
883
858(defvar reftex-bibfile-ignore-list nil) ; compatibility 884(defvar reftex-bibfile-ignore-list nil) ; compatibility
859(defcustom reftex-bibfile-ignore-regexps nil 885(defcustom reftex-bibfile-ignore-regexps nil
860 "*List of regular expressions to exclude files in \\bibliography{..}. 886 "*List of regular expressions to exclude files in \\bibliography{..}.
@@ -898,7 +924,7 @@ If `reftex-cite-format' is a string, it will be used as the format.
898In the format, the following percent escapes will be expanded. 924In the format, the following percent escapes will be expanded.
899 925
900%l The BibTeX label of the citation. 926%l The BibTeX label of the citation.
901%a List of author names, see also `reftex-cite-punctuation. 927%a List of author names, see also `reftex-cite-punctuation'.
902%2a Like %a, but abbreviate more than 2 authors like Jones et al. 928%2a Like %a, but abbreviate more than 2 authors like Jones et al.
903%A First author name only. 929%A First author name only.
904%e Works like %a, but on list of editor names. (%2e and %E work a well) 930%e Works like %a, but on list of editor names. (%2e and %E work a well)
@@ -1175,6 +1201,14 @@ at one of these points, no word boundary is required there."
1175 :group 'reftex-index-support 1201 :group 'reftex-index-support
1176 :type 'boolean) 1202 :type 'boolean)
1177 1203
1204(defcustom reftex-index-verify-function nil
1205 "A function which is called at each match during global indexing.
1206If the function returns nil, the current match is skipped."
1207 :group 'reftex-index-support
1208 :type '(choice
1209 (const :tag "No verification" nil)
1210 (function)))
1211
1178(defcustom reftex-index-phrases-skip-indexed-matches nil 1212(defcustom reftex-index-phrases-skip-indexed-matches nil
1179 "*Non-nil means, skip matches which appear to be indexed already. 1213 "*Non-nil means, skip matches which appear to be indexed already.
1180When doing global indexing from the phrases buffer, searches for some 1214When doing global indexing from the phrases buffer, searches for some
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 8db74a41090..2dca200c0ec 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -1,8 +1,8 @@
1;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX 1;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@science.uva.nl>
5;; Version: 4.16 5;; Version: 4.17
6;; Keywords: tex 6;; Keywords: tex
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
@@ -300,7 +300,7 @@
300;;; Define the formal stuff for a minor mode named RefTeX. 300;;; Define the formal stuff for a minor mode named RefTeX.
301;;; 301;;;
302 302
303(defconst reftex-version "RefTeX version 4.16" 303(defconst reftex-version "RefTeX version 4.17"
304 "Version string for RefTeX.") 304 "Version string for RefTeX.")
305 305
306(defvar reftex-mode nil 306(defvar reftex-mode nil
@@ -312,6 +312,7 @@
312 312
313(defvar reftex-mode-menu nil) 313(defvar reftex-mode-menu nil)
314(defvar reftex-syntax-table nil) 314(defvar reftex-syntax-table nil)
315(defvar reftex-syntax-table-for-bib nil)
315 316
316(defvar reftex-auto-view-crossref-timer nil 317(defvar reftex-auto-view-crossref-timer nil
317 "The timer used for auto-view-crossref.") 318 "The timer used for auto-view-crossref.")
@@ -371,6 +372,12 @@ on the menu bar.
371 (setq reftex-syntax-table (copy-syntax-table (syntax-table))) 372 (setq reftex-syntax-table (copy-syntax-table (syntax-table)))
372 (modify-syntax-entry ?\( "." reftex-syntax-table) 373 (modify-syntax-entry ?\( "." reftex-syntax-table)
373 (modify-syntax-entry ?\) "." reftex-syntax-table)) 374 (modify-syntax-entry ?\) "." reftex-syntax-table))
375 (unless reftex-syntax-table-for-bib
376 (setq reftex-syntax-table-for-bib (copy-syntax-table reftex-syntax-table))
377 (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
378 (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
379 (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
380 (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib))
374 (run-hooks 'reftex-mode-hook)) 381 (run-hooks 'reftex-mode-hook))
375 ;; Mode was turned off 382 ;; Mode was turned off
376 (easy-menu-remove reftex-mode-menu))) 383 (easy-menu-remove reftex-mode-menu)))
@@ -610,49 +617,49 @@ the label information is recompiled on next use."
610;; The following constants are derived from `reftex-label-alist'. 617;; The following constants are derived from `reftex-label-alist'.
611 618
612;; Prompt used for label type queries directed to the user. 619;; Prompt used for label type queries directed to the user.
613(defconst reftex-type-query-prompt nil) 620(defvar reftex-type-query-prompt nil)
614 621
615;; Help string for label type queries. 622;; Help string for label type queries.
616(defconst reftex-type-query-help nil) 623(defvar reftex-type-query-help nil)
617 624
618;; Alist relating label type to reference format. 625;; Alist relating label type to reference format.
619(defconst reftex-typekey-to-format-alist nil) 626(defvar reftex-typekey-to-format-alist nil)
620 627
621;; Alist relating label type to label prefix. 628;; Alist relating label type to label prefix.
622(defconst reftex-typekey-to-prefix-alist nil) 629(defvar reftex-typekey-to-prefix-alist nil)
623 630
624;; Alist relating environments or macros to label type and context regexp. 631;; Alist relating environments or macros to label type and context regexp.
625(defconst reftex-env-or-mac-alist nil) 632(defvar reftex-env-or-mac-alist nil)
626 633
627;; List of special environment parser functions 634;; List of special environment parser functions
628(defconst reftex-special-env-parsers nil) 635(defvar reftex-special-env-parsers nil)
629 636
630;; List of macros carrying a label. 637;; List of macros carrying a label.
631(defconst reftex-label-mac-list nil) 638(defvar reftex-label-mac-list nil)
632 639
633;; List of environments carrying a label. 640;; List of environments carrying a label.
634(defconst reftex-label-env-list nil) 641(defvar reftex-label-env-list nil)
635 642
636;; List of all typekey letters in use. 643;; List of all typekey letters in use.
637(defconst reftex-typekey-list nil) 644(defvar reftex-typekey-list nil)
638 645
639;; Alist relating magic words to a label type. 646;; Alist relating magic words to a label type.
640(defconst reftex-words-to-typekey-alist nil) 647(defvar reftex-words-to-typekey-alist nil)
641 648
642;; The last list-of-labels entry used in a reference. 649;; The last list-of-labels entry used in a reference.
643(defvar reftex-last-used-reference (list nil nil nil nil)) 650(defvar reftex-last-used-reference (list nil nil nil nil))
644 651
645;; Alist relating index macros to other info. 652;; Alist relating index macros to other info.
646(defconst reftex-key-to-index-macro-alist nil) 653(defvar reftex-key-to-index-macro-alist nil)
647;; Prompt for index macro queries 654;; Prompt for index macro queries
648(defconst reftex-query-index-macro-prompt nil) 655(defvar reftex-query-index-macro-prompt nil)
649;; Help string for index macro queries 656;; Help string for index macro queries
650(defconst reftex-query-index-macro-help nil) 657(defvar reftex-query-index-macro-help nil)
651 658
652;; The message when follow-mode is suspended 659;; The message when follow-mode is suspended
653(defconst reftex-no-follow-message 660(defvar reftex-no-follow-message
654 "No follow-mode into unvisited file. Press SPC to visit it.") 661 "No follow-mode into unvisited file. Press SPC to visit it.")
655(defconst reftex-no-info-message 662(defvar reftex-no-info-message
656 "%s: info not available, use `\\[reftex-view-crossref]' to get it.") 663 "%s: info not available, use `\\[reftex-view-crossref]' to get it.")
657 664
658;; Global variables used for communication between functions. 665;; Global variables used for communication between functions.
@@ -1092,9 +1099,15 @@ This enforces rescanning the buffer on next use."
1092 reftex-section-levels)) 1099 reftex-section-levels))
1093 1100
1094 ;; Calculate the regular expressions 1101 ;; Calculate the regular expressions
1095 (let* ((wbol "\\(\\`\\|[\n\r]\\)[ \t]*") 1102 (let* (
1103; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
1104 (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
1096 (label-re "\\\\label{\\([^}]*\\)}") 1105 (label-re "\\\\label{\\([^}]*\\)}")
1097 (include-re (concat wbol "\\\\\\(include\\|input\\)[{ \t]+\\([^} \t\n\r]+\\)")) 1106 (include-re (concat wbol
1107 "\\\\\\("
1108 (mapconcat 'identity
1109 reftex-include-file-commands "\\|")
1110 "\\)[{ \t]+\\([^} \t\n\r]+\\)"))
1098 (section-re 1111 (section-re
1099 (concat wbol "\\\\\\(" 1112 (concat wbol "\\\\\\("
1100 (mapconcat (lambda (x) (regexp-quote (car x))) 1113 (mapconcat (lambda (x) (regexp-quote (car x)))