+2005-09-16 Carsten Dominik <dominik@science.uva.nl>
+
+ * textmodes/reftex-auc.el: Small changes to remove compiler
+ warnings.
+
+ * textmodes/reftex-cite.el: Small changes to remove compiler
+ warnings.
+
+ * textmodes/reftex-dcr.el: Small changes to remove compiler
+ warnings.
+
+ * textmodes/reftex-global.el: Small changes to remove compiler
+ warnings.
+
+ * textmodes/reftex-index.el: Small changes to remove compiler
+ warnings.
+ (reftex-query-index-phrase): More efficient use of markers.
+
+ * textmodes/reftex-parse.el: Small changes to remove compiler
+ warnings.
+
+ * textmodes/reftex-ref.el: Small changes to remove compiler
+ warnings.
+
+ * textmodes/reftex-sel.el: Small changes to remove compiler
+ warnings.
+
+ * textmodes/reftex-toc.el: Small changes to remove compiler
+ warnings.
+
+ * textmodes/reftex-vars.el: Small changes to remove compiler
+ warnings.
+
+ * textmodes/reftex.el: Small changes to remove compiler warnings.
+
2005-09-15 Chong Yidong <cyd@stupidchicken.com>
* image.el (image-load-path): New variable.
;;; reftex-auc.el --- RefTeX's interface to AUCTeX
-
-;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
(defun reftex-arg-index-tag (optional &optional prompt &rest args)
- "Prompt for an index tag with completion.
+ "Prompt for an index tag with completion.
This is the name of an index, not the entry."
(let (tag taglist)
(setq prompt (concat (if optional "(Optional) " "")
;; Use RefTeX completion
(progn
(reftex-access-scan-info nil)
- (setq taglist
- (cdr (assoc 'index-tags
+ (setq taglist
+ (cdr (assoc 'index-tags
(symbol-value reftex-docstruct-symbol)))
tag (completing-read prompt (mapcar 'list taglist))))
;; Just ask like AUCTeX does.
;; Replace AUCTeX functions with RefTeX functions.
;; Which functions are replaced is controlled by the variable
;; `reftex-plug-into-AUCTeX'.
-
+
(if (reftex-plug-flag 0)
(setq LaTeX-label-function 'reftex-label)
(setq LaTeX-label-function nil))
(and (reftex-plug-flag 3)
(fboundp 'TeX-arg-cite)
(fset 'TeX-arg-cite 'reftex-arg-cite))
-
- (and (reftex-plug-flag 4)
+
+ (and (reftex-plug-flag 4)
(fboundp 'TeX-arg-index-tag)
(fset 'TeX-arg-index-tag 'reftex-arg-index-tag))
- (and (reftex-plug-flag 4)
+ (and (reftex-plug-flag 4)
(fboundp 'TeX-arg-index)
(fset 'TeX-arg-index 'reftex-arg-index)))
;;; reftex-cite.el --- creating citations with RefTeX
-
-;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
(unless (eq (get 'reftex-default-bibliography :reftex-raw)
reftex-default-bibliography)
(put 'reftex-default-bibliography :reftex-expanded
- (reftex-locate-bibliography-files
+ (reftex-locate-bibliography-files
default-directory reftex-default-bibliography))
(put 'reftex-default-bibliography :reftex-raw
reftex-default-bibliography))
;; If RETURN is non-nil, just return the entry.
(let* ((re
- (if item
+ (if item
(concat "\\\\bibitem\\(\\[[^]]*\\]\\)?{" (regexp-quote key) "}")
(concat "@[a-zA-Z]+[ \t\n\r]*[{(][ \t\n\r]*" (regexp-quote key)
"[, \t\r\n}]")))
(when return
;; Just return the relevant entry
(if item (goto-char (match-end 0)))
- (setq return (buffer-substring
+ (setq return (buffer-substring
(point) (reftex-end-of-bib-entry item)))
(set-buffer buffer-conf)
(throw 'exit return))
(error "No BibTeX entry with citation key %s" key)))))
(defun reftex-end-of-bib-entry (item)
- (save-excursion
+ (save-excursion
(condition-case nil
- (if item
+ (if item
(progn (end-of-line)
(re-search-forward
"\\\\bibitem\\|\\end{thebibliography}")
;; Read a regexp, completing on known citation keys.
(setq default (regexp-quote (reftex-get-bibkey-default)))
- (setq re-list
- (split-string
- (completing-read
+ (setq re-list
+ (split-string
+ (completing-read
(concat
"Regex { && Regex...}: "
"[" default "]: ")
(if reftex-mode
(if (fboundp 'LaTeX-bibitem-list)
(LaTeX-bibitem-list)
- (cdr (assoc 'bibview-cache
+ (cdr (assoc 'bibview-cache
(symbol-value reftex-docstruct-symbol))))
nil)
nil nil nil 'reftex-cite-regexp-hist)
(error (goto-char key-point)
(throw 'search-again nil)))
(setq end-point (point))
-
+
;; Ignore @string, @comment and @c entries or things
;; outside entries
(when (or (string= (downcase (match-string 2)) "string")
(< (point) key-point)) ; this means match not in {}
(goto-char key-point)
(throw 'search-again nil))
-
+
;; Well, we have got a match
;;(setq entry (concat
;; (buffer-substring start-point (point)) "\n"))
(setq entry (buffer-substring start-point (point)))
-
+
;; Check if other regexp match as well
(setq re-list rest-re)
(while re-list
;; nope - move on
(throw 'search-again nil))
(pop re-list))
-
+
(setq alist (reftex-parse-bibtex-entry
nil start-point end-point))
(push (cons "&entry" entry) alist)
-
+
;; check for crossref entries
(if (assoc "crossref" alist)
(setq alist
(append
alist (reftex-get-crossref-alist alist))))
-
+
;; format the entry
(push (cons "&formatted" (reftex-format-bib-entry alist))
alist)
-
+
;; make key the first element
(push (reftex-get-bib-field "&key" alist) alist)
-
+
;; add it to the list
(push alist found-list)))))
(reftex-kill-temporary-buffers))))
(unless files
(error "Need file name to find thebibliography environment"))
(while (setq file (pop files))
- (setq buf (reftex-get-file-buffer-force
+ (setq buf (reftex-get-file-buffer-force
file (not reftex-keep-temporary-buffers)))
(unless buf
(error "No such file %s" file))
(save-restriction
(widen)
(goto-char (point-min))
- (while (re-search-forward
+ (while (re-search-forward
"\\(\\`\\|[\n\r]\\)[ \t]*\\\\begin{thebibliography}" nil t)
(beginning-of-line 2)
(setq start (point))
- (if (re-search-forward
+ (if (re-search-forward
"\\(\\`\\|[\n\r]\\)[ \t]*\\\\end{thebibliography}" nil t)
(progn
(beginning-of-line 1)
(setq end (point))))
(when (and start end)
- (setq entries
+ (setq entries
(append entries
(mapcar 'reftex-parse-bibitem
(delete ""
- (split-string
+ (split-string
(buffer-substring-no-properties start end)
"[ \t\n\r]*\\\\bibitem\\(\\[[^]]*]\\)*"))))))
(goto-char end)))))
;; Read a regexp, completing on known citation keys.
(setq default (regexp-quote (reftex-get-bibkey-default)))
- (setq re-list
- (split-string
- (completing-read
+ (setq re-list
+ (split-string
+ (completing-read
(concat
"Regex { && Regex...}: "
"[" default "]: ")
(if reftex-mode
(if (fboundp 'LaTeX-bibitem-list)
(LaTeX-bibitem-list)
- (cdr (assoc 'bibview-cache
+ (cdr (assoc 'bibview-cache
(symbol-value reftex-docstruct-symbol))))
nil)
nil nil nil 'reftex-cite-regexp-hist)
(error "Empty regular expression"))
(while (and (setq re (pop re-list)) entries)
- (setq entries
+ (setq entries
(delq nil (mapcar
(lambda (x)
(if (string-match re (cdr (assoc "&entry" x)))
x nil))
entries))))
- (setq entries
- (mapcar
+ (setq entries
+ (mapcar
(lambda (x)
(push (cons "&formatted" (reftex-format-bibitem x)) x)
(push (reftex-get-bib-field "&key" x) x)
;; This really does the work of reftex-citation.
(let* ((format (reftex-figure-out-cite-format arg no-insert format-key))
- (start 0)
(docstruct-symbol reftex-docstruct-symbol)
(selected-entries (reftex-offer-bib-menu))
(insert-entries selected-entries)
;; FIXME: Unfortunately, this meens that commenting does not work right.
(pop selected-entries)
(let ((concat-keys (mapconcat 'car selected-entries ",")))
- (setq insert-entries
+ (setq insert-entries
(list (list concat-keys (cons "&key" concat-keys))))))
-
+
(unless no-insert
;; We shall insert this into the buffer...
;; it has to go. If there is only a single arg and empty, it can go
;; as well.
(when reftex-cite-cleanup-optional-args
- (cond
+ (cond
((string-match "\\([a-zA-Z0-9]\\)\\[\\]{" string)
(setq string (replace-match "\\1{" nil nil string)))
((string-match "\\[\\]\\(\\[[a-zA-Z0-9., ]+\\]\\)" string)
(delete-char 1))
;; Tell AUCTeX
- (when (and reftex-mode
+ (when (and reftex-mode
(fboundp 'LaTeX-add-bibitems)
reftex-plug-into-AUCTeX)
(apply 'LaTeX-add-bibitems (mapcar 'car selected-entries)))
-
+
;; Produce the cite-view strings
(when (and reftex-mode reftex-cache-cite-echo cite-view)
- (mapcar (lambda (entry)
+ (mapcar (lambda (entry)
(reftex-make-cite-echo-string entry docstruct-symbol))
selected-entries))
(set-marker reftex-select-return-marker nil)
(reftex-kill-buffer "*RefTeX Select*")
-
+
;; Check if the prefix arg was numeric, and call recursively
(when (integerp arg)
(if (> arg 1)
- (progn
+ (progn
(skip-chars-backward "}")
(decf arg)
(reftex-do-citation arg))
(forward-char 1)))
-
+
;; Return the citation key
(car (car selected-entries))))
(no-insert
;; Format does not really matter because nothing will be inserted.
(setq format "%l"))
-
+
((and (stringp macro)
(string-match "\\`\\\\cite\\|cite\\'" macro))
;; We are already inside a cite macro
(when (listp format)
(setq key
(or format-key
- (reftex-select-with-char
+ (reftex-select-with-char
"" (concat "SELECT A CITATION FORMAT\n\n"
(mapconcat
(lambda (x)
(let ((bibtype (reftex-bib-or-thebib))
found-list rtn key data selected-entries)
- (while
- (not
+ (while
+ (not
(catch 'done
;; Scan bibtex files
(setq found-list
(reftex-extract-bib-entries-from-thebibliography
(reftex-uniquify
(mapcar 'cdr
- (reftex-all-assq
+ (reftex-all-assq
'thebib (symbol-value reftex-docstruct-symbol))))))
(reftex-default-bibliography
(message "Using default bibliography")
(reftex-extract-bib-entries (reftex-default-bibliography)))
(t (error "No valid bibliography in this document, and no default available"))))
-
+
(unless found-list
(error "Sorry, no matches found"))
-
+
;; Remember where we came from
(setq reftex-call-back-to-this-buffer (current-buffer))
(set-marker reftex-select-return-marker (point))
-
+
;; Offer selection
(save-window-excursion
(delete-other-windows)
(goto-char 1))
((eq key ?A)
;; Take all (marked)
- (setq selected-entries
+ (setq selected-entries
(if reftex-select-marked
(mapcar 'car (nreverse reftex-select-marked))
found-list))
(throw 'done t))
((eq key ?a)
;; Take all (marked), and push the symbol 'concat
- (setq selected-entries
- (cons 'concat
+ (setq selected-entries
+ (cons 'concat
(if reftex-select-marked
(mapcar 'car (nreverse reftex-select-marked))
found-list)))
((or (eq key ?\C-m)
(eq key 'return))
;; Take selected
- (setq selected-entries
+ (setq selected-entries
(if reftex-select-marked
- (cons 'concat
+ (cons 'concat
(mapcar 'car (nreverse reftex-select-marked)))
(if data (list data) nil)))
(throw 'done t))
(let ((file (read-file-name "File to create: ")))
(find-file-other-window file)
(if (> (buffer-size) 0)
- (unless (yes-or-no-p
+ (unless (yes-or-no-p
(format "Overwrite non-empty file %s? " file))
(error "Abort")))
(erase-buffer)
reftex-mouse-selected-face
nil))
tmp len)
- (mapcar
+ (mapcar
(lambda (x)
(setq tmp (cdr (assoc "&formatted" x))
len (length tmp))
(defun reftex-make-cite-echo-string (entry docstruct-symbol)
;; Format a bibtex entry for the echo area and cache the result.
(let* ((key (reftex-get-bib-field "&key" entry))
- (string
+ (string
(let* ((reftex-cite-punctuation '(" " " & " " etal.")))
(reftex-format-citation entry reftex-cite-view-format)))
(cache (assq 'bibview-cache (symbol-value docstruct-symbol)))
(setq bibfile-list
(reftex-uniquify
(mapcar 'cdr
- (reftex-all-assq
+ (reftex-all-assq
'thebib (symbol-value reftex-docstruct-symbol))))
item t))
(reftex-default-bibliography
(setq bibfile-list (reftex-visited-files bibfile-list)))
(condition-case nil
- (reftex-pop-to-bibtex-entry
+ (reftex-pop-to-bibtex-entry
key bibfile-list (not reftex-keep-temporary-buffers) t item)
(error (ding))))
-
+
(select-window win)))
;;; Global BibTeX file
(defun reftex-all-used-citation-keys ()
(reftex-access-scan-info)
- (let ((files (reftex-all-document-files)) file keys kkk kk k)
+ (let ((files (reftex-all-document-files)) file keys kk k)
(save-excursion
(while (setq file (pop files))
(set-buffer (reftex-get-file-buffer-force file 'mark))
"Create a new BibTeX database file with all entries referenced in document.
The command prompts for a filename and writes the collected entries to
that file. Only entries referenced in the current document with
-any \\cite-like macros are used.
+any \\cite-like macros are used.
The sequence in the new file is the same as it was in the old database."
(interactive "FNew BibTeX file: ")
(let ((keys (reftex-all-used-citation-keys))
(save-restriction
(widen)
(goto-char (point-min))
- (while (re-search-forward
+ (while (re-search-forward
"^[ \t]*@[a-zA-Z]+[ \t]*{\\([^ \t\r\n]+\\),"
nil t)
(setq key (match-string 1)
keys (delete key keys)))))))))
(find-file-other-window bibfile)
(if (> (buffer-size) 0)
- (unless (yes-or-no-p
+ (unless (yes-or-no-p
(format "Overwrite non-empty file %s? " bibfile))
(error "Abort")))
(erase-buffer)
;;; reftex-dcr.el --- viewing cross references and citations with RefTeX
-
-;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;;
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; reftex-global.el --- operations on entire documents with RefTeX
-
-;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
(require 'reftex)
;;;
-(defvar isearch-next-buffer-function)
-(defvar TeX-master)
-
(defun reftex-create-tags-file ()
"Create TAGS file by running `etags' on the current document.
The TAGS file is also immediately visited with `visit-tags-table'."
(tags-query-replace from to (or delimited current-prefix-arg)
(list 'reftex-all-document-files))))
+(eval-when-compile
+ (defvar TeX-master)
+ (defvar isearch-next-buffer-function))
+
(defun reftex-find-duplicate-labels ()
"Produce a list of all duplicate labels in the document."
(set (make-local-variable 'TeX-master) master)
(erase-buffer)
(insert " MULTIPLE LABELS IN CURRENT DOCUMENT:\n")
- (insert
+ (insert
" Move point to label and type `r' to run a query-replace on the label\n"
" and its references. Type `q' to exit this buffer.\n\n")
(insert " LABEL FILE\n")
(not (yes-or-no-p "Replacing all simple labels in multiple files is risky. Continue? ")))
(error "Abort"))
;; Make the translation list
- (let* ((re-core (concat "\\("
- (mapconcat 'cdr reftex-typekey-to-prefix-alist "\\|")
+ (let* ((re-core (concat "\\("
+ (mapconcat 'cdr reftex-typekey-to-prefix-alist "\\|")
"\\)"))
(label-re (concat "\\`" re-core "\\([0-9]+\\)\\'"))
(search-re (concat "[{,]\\(" re-core "\\([0-9]+\\)\\)[,}]"))
(reftex-save-all-document-buffers)
;; First test to check for erros
- (setq n (reftex-translate
+ (setq n (reftex-translate
files search-re translate-alist error-fmt 'test))
;; Now the real thing.
- (if (yes-or-no-p
+ (if (yes-or-no-p
(format "Replace %d items at %d places in %d files? "
(length translate-alist) n (length files)))
(progn
(defun reftex-translate (files search-re translate-alist error-fmt test)
;; In FILES, look for SEARCH-RE and replace match 1 of it with
- ;; its association in TRANSLATE-ALSIT.
+ ;; its association in TRANSLATE-ALSIT.
;; If we do not find an association and TEST is non-nil, query
- ;; to ignore the problematic string.
+ ;; to ignore the problematic string.
;; If TEST is nil, it is ignored without query.
;; Return the number of replacements.
(let ((n 0) file label match-data buf macro pos cell)
(or (looking-at "\\\\ref")
(looking-at "\\\\[a-zA-Z]*ref\\(range\\)?[^a-zA-Z]")
(looking-at "\\\\ref[a-zA-Z]*[^a-zA-Z]")
- (looking-at (format
+ (looking-at (format
reftex-find-label-regexp-format
(regexp-quote label)))))
;; OK, we should replace it.
(defun reftex-isearch-wrap-function ()
(if (not isearch-word)
- (switch-to-buffer
+ (switch-to-buffer
(funcall isearch-next-buffer-function (current-buffer) t)))
(goto-char (if isearch-forward (point-min) (point-max))))
`reftex-isearch-minor-mode' on iff ARG is positive."
(interactive "P")
(let ((old-reftex-isearch-minor-mode reftex-isearch-minor-mode))
- (setq reftex-isearch-minor-mode
+ (setq reftex-isearch-minor-mode
(not (or (and (null arg) reftex-isearch-minor-mode)
(<= (prefix-numeric-value arg) 0))))
(unless (eq reftex-isearch-minor-mode old-reftex-isearch-minor-mode)
;; Force modeline redisplay.
(set-buffer-modified-p (buffer-modified-p))))
-(add-minor-mode 'reftex-isearch-minor-mode "/I" nil nil
+(add-minor-mode 'reftex-isearch-minor-mode "/I" nil nil
'reftex-isearch-minor-mode)
;;; arch-tag: 2dbf7633-92c8-4340-8656-7aa019d0f80d
;;; reftex-index.el --- index support with RefTeX
-
-;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
(require 'reftex)
;;;
-(defvar reftex-index-phrases-marker)
-(defvar TeX-master)
-
;; START remove for XEmacs release
(defvar mark-active)
(defvar zmacs-regions)
(defvar transient-mark-mode)
+(defvar TeX-master)
;; END remove for XEmacs release
(defun reftex-index-selection-or-word (&optional arg phrase)
"Put selection or the word near point into the default index macro.
(active (if (boundp 'zmacs-regions)
(and zmacs-regions (region-exists-p)) ; XEmacs
(and transient-mark-mode mark-active))) ; Emacs
- (beg (if active
+ (beg (if active
(region-beginning)
- (save-excursion
+ (save-excursion
(skip-syntax-backward "w\\") (point))))
(end (if active
(region-end)
- (save-excursion
+ (save-excursion
(skip-syntax-forward "w\\") (point))))
(sel (buffer-substring beg end))
(mathp (condition-case nil (texmathp) (error nil)))
;; Delete what is in the buffer and make the index entry
(delete-region beg end)
(reftex-index def-char full-entry def-tag sel)))))
-
+
(defun reftex-index (&optional char key tag sel no-insert)
"Query for an index macro and insert it along with its argments.
The index macros available are those defined in `reftex-index-macro' or
;; OPT-ARGS is a list of optional argument indices, as given by
;; `reftex-parse-args'.
(let* ((opt (and (integerp itag) (member itag opt-args)))
- (index-tags (cdr (assq 'index-tags
+ (index-tags (cdr (assq 'index-tags
(symbol-value reftex-docstruct-symbol))))
(default (reftex-default-index))
(prompt (concat "Index tag"
(defun reftex-index-select-tag ()
;; Have the user select an index tag.
;; FIXME: should we cache tag-alist, prompt and help?
- (let* ((index-tags (cdr (assoc 'index-tags
+ (let* ((index-tags (cdr (assoc 'index-tags
(symbol-value reftex-docstruct-symbol))))
(default (reftex-default-index)))
- (cond
+ (cond
((null index-tags)
(error "No index tags available"))
((= (length index-tags) 1)
;; Just one index, use it
(car index-tags))
-
+
((> (length index-tags) 1)
;; Several indices, ask.
(let* ((tags (copy-sequence index-tags))
(unless (assq (aref tag i) tag-alist)
(push (list (aref tag i)
tag
- (concat (substring tag 0 i)
+ (concat (substring tag 0 i)
"[" (substring tag i (incf i)) "]"
(substring tag i)))
tag-alist)
(throw 'exit t)))
- (push (list (+ ?0 (incf cnt)) tag
+ (push (list (+ ?0 (incf cnt)) tag
(concat "[" (int-to-string cnt) "]:" tag))
tag-alist)))
(setq tag-alist (nreverse tag-alist))
(if default
(format "[^M] %s (the default)\n" default)
"")
- (mapconcat (lambda(x)
+ (mapconcat (lambda(x)
(apply 'format "[%c] %s" x))
tag-alist "\n")))
;; Query the user for an index-tag
key))
(defun reftex-index-update-taglist (newtag)
- ;; add NEWTAG to the list of available index tags.
+ ;; add NEWTAG to the list of available index tags.
(let ((cell (assoc 'index-tags (symbol-value reftex-docstruct-symbol))))
(and newtag (cdr cell) (not (member newtag (cdr cell)))
(push newtag (cdr cell)))))
(easy-menu-add reftex-index-menu reftex-index-map)
(add-hook 'post-command-hook 'reftex-index-post-command-hook nil t)
(add-hook 'pre-command-hook 'reftex-index-pre-command-hook nil t)
- (run-mode-hooks 'reftex-index-mode-hook))
+ (run-hooks 'reftex-index-mode-hook))
(defconst reftex-index-help
" AVAILABLE KEYS IN INDEX BUFFER
;; Note: This function just looks for the nearest match of the
;; context string and may fail if the entry moved and an identical
;; entry is close to the old position. Frequent rescans make this
- ;; safer.
+ ;; safer.
(let* ((file (nth 3 data))
(literal (nth 2 data))
(pos (nth 4 data))
(calling-file (buffer-file-name))
(restriction
(or overriding-restriction
- (and (not redo)
+ (and (not redo)
(reftex-get-restriction current-prefix-arg docstruct))))
(locations
;; See if we are on an index macro as initial position
(macro (car what-macro))
(here-I-am (when (member macro reftex-macros-with-index)
(save-excursion
- (goto-char (+ (cdr what-macro)
+ (goto-char (+ (cdr what-macro)
(length macro)))
(reftex-move-over-touching-args)
(reftex-where-am-I)))))
(setq buffer-name (reftex-make-index-buffer-name index-tag))
;; Goto the buffer and put it into the correct mode
-
+
(when (or restriction current-prefix-arg)
(reftex-kill-buffer buffer-name))
;; Delete the entry at place
(and (bolp) (forward-char 1))
(delete-region (previous-single-property-change (1+ (point)) :data)
- (or (next-single-property-change (point) :data)
+ (or (next-single-property-change (point) :data)
(point-max))))
;; Walk through the list and insert all entries
(insert indent (nth 7 cell))
(when font
(setq to (point))
- (put-text-property
+ (put-text-property
(- (point) (length (nth 7 cell))) to
'face index-face)
(goto-char to))
(defun reftex-index-insert-new-letter (letter &optional font)
;; Start a new section in the index
(let ((from (point)))
- (insert "\n" letter letter letter
+ (insert "\n" letter letter letter
"-----------------------------------------------------------------")
(when font
(put-text-property from (point) 'face reftex-index-section-face))
(interactive "p")
(setq reftex-callback-fwd t)
(or (eobp) (forward-char 1))
- (goto-char (or (next-single-property-change (point) :data)
+ (goto-char (or (next-single-property-change (point) :data)
(point)))
(unless (get-text-property (point) :data)
- (goto-char (or (next-single-property-change (point) :data)
+ (goto-char (or (next-single-property-change (point) :data)
(point)))))
(defun reftex-index-previous (&optional arg)
"Move to previous selectable item."
(reftex-index-restrict-to-section t)
(setq reftex-index-restriction-indicator (nth 6 bor)
reftex-index-restriction-data
- (list bor
+ (list bor
(car (memq (assq 'toc (cdr (memq bor docstruct)))
docstruct))))
(reftex-index-revert))))
show-window show-buffer match)
(unless data (error "Don't know which index entry to visit"))
-
+
(if (eq (car data) 'index)
(setq match (reftex-index-show-entry data no-revisit)))
attr (nth 2 analyze))
(setf (nth 2 analyze) (if (string= attr bor) "" bor))
(setq new (apply 'concat analyze))
- (reftex-index-change-entry
+ (reftex-index-change-entry
new (if (string= (nth 2 analyze) bor)
"Entry is now START-OF-PAGE-RANGE"
"START-OF-PAGE-RANGE canceled"))))
(t (setf (nth n analyze) (concat initial npart))))
(setq new (apply 'concat analyze))
;; Change the entry and insert the changed version into the index.
- (reftex-index-change-entry
+ (reftex-index-change-entry
new (if (string= npart "")
(format "Deleted: %s" opart)
(format "New value is: %s" npart)))))
(unless data (error "Don't know which index entry to change"))
(setq old (nth 2 data)
key (nth 6 data)
- prefix (completing-read
- "Prefix: "
- (reftex-sublist-nth
+ prefix (completing-read
+ "Prefix: "
+ (reftex-sublist-nth
docstruct 6
(lambda (x)
(and (eq (car x) 'index)
(string= (nth 1 x) reftex-index-tag))) t)))
- (unless (string-match
+ (unless (string-match
(concat (regexp-quote (car reftex-index-special-chars)) "\\'")
prefix)
(setq prefix (concat prefix (car reftex-index-special-chars))))
(defun reftex-index-change-entry (new &optional message)
;; Change the full context string of the index entry at point to
;; NEW. This actually edits the buffer where the entry is defined.
-
+
(let* ((data (get-text-property (point) :data))
old beg end info)
(unless data (error "Cannot change entry"))
(if (eq char ?!)
(error "This <%s> index does not contain entries sorted before the letters"
reftex-index-tag)
- (error "This <%s> index does not contain entries starting with `%c'"
+ (error "This <%s> index does not contain entries starting with `%c'"
reftex-index-tag char)))))
-(easy-menu-define
+(easy-menu-define
reftex-index-menu reftex-index-map
"Menu for Index buffer"
`("Index"
- ["Goto section A-Z"
+ ["Goto section A-Z"
(message "To go to a section, just press any of: !%s"
reftex-index-section-letters) t]
["Show Entry" reftex-index-view-entry t]
["Context" reftex-index-toggle-context :style toggle
:selected reftex-index-include-context]
"--"
- ["Follow Mode" reftex-index-toggle-follow :style toggle
+ ["Follow Mode" reftex-index-toggle-follow :style toggle
:selected reftex-index-follow-mode])
"--"
["Help" reftex-index-show-help t]))
(set-marker reftex-index-return-marker (point))
(reftex-index-selection-or-word arg 'phrase)
(if (eq major-mode 'reftex-index-phrases-mode)
- (message
+ (message
(substitute-command-keys
"Return to LaTeX with \\[reftex-index-phrases-save-and-return]"))))
(sort (copy-sequence reftex-index-macro-alist)
(lambda (a b) (equal (car a) default-macro))))
macro entry key repeat)
-
+
(if master (set (make-local-variable 'TeX-master)
(file-name-nondirectory master)))
(if (looking-at reftex-index-phrases-comment-regexp)
(beginning-of-line 2))
(while (looking-at "^[ \t]*$")
- (beginning-of-line 2))
+ (beginning-of-line 2))
(cond ((fboundp 'zmacs-activate-region) (zmacs-activate-region))
((boundp 'make-active) (setq mark-active t)))
(if (yes-or-no-p "Delete and rebuilt header ")
(defvar reftex-index-phrases-menu)
+(defvar reftex-index-phrases-marker)
(defvar reftex-index-phrases-restrict-file nil)
;;;###autoload
(defun reftex-index-phrases-mode ()
(setq major-mode 'reftex-index-phrases-mode
mode-name "Phrases")
(use-local-map reftex-index-phrases-map)
- (set (make-local-variable 'font-lock-defaults)
+ (set (make-local-variable 'font-lock-defaults)
reftex-index-phrases-font-lock-defaults)
(easy-menu-add reftex-index-phrases-menu reftex-index-phrases-map)
(set (make-local-variable 'reftex-index-phrases-marker) (make-marker))
- (run-mode-hooks 'reftex-index-phrases-mode-hook))
+ (run-hooks 'reftex-index-phrases-mode-hook))
(add-hook 'reftex-index-phrases-mode-hook 'turn-on-font-lock)
;; Font Locking stuff
(let ((ss (if (featurep 'xemacs) 'secondary-selection ''secondary-selection)))
(setq reftex-index-phrases-font-lock-keywords
- (list
+ (list
(cons reftex-index-phrases-comment-regexp 'font-lock-comment-face)
(list reftex-index-phrases-macrodef-regexp
'(1 font-lock-type-face)
(setq reftex-index-phrases-font-lock-defaults
'((reftex-index-phrases-font-lock-keywords)
nil t nil beginning-of-line))
- (put 'reftex-index-phrases-mode 'font-lock-defaults
+ (put 'reftex-index-phrases-mode 'font-lock-defaults
reftex-index-phrases-font-lock-defaults) ; XEmacs
)
(move-marker reftex-index-phrases-marker
(match-beginning 0) (current-buffer))
;; Start the query-replace
- (reftex-query-index-phrase-globally
- files phrase macro-fmt
+ (reftex-query-index-phrase-globally
+ files phrase macro-fmt
index-key repeat as-words)
- (message "%s replaced"
+ (message "%s replaced"
(reftex-number replace-count "occurrence"))))))
(t (error "Cannot parse this line")))))
(unless buf (error "Master file %s not found" master))
(set-buffer buf)
(reftex-access-scan-info)
- (setq reftex-index-phrases-files
+ (setq reftex-index-phrases-files
(reftex-all-document-files))))
;; Parse the files header for macro definitions
(setq reftex-index-phrases-macro-data nil)
;; 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
+ (setq reftex-index-phrases-macro-data
(nreverse reftex-index-phrases-macro-data))
(goto-char (point-min)))))
index the new part without having to go over the unchanged parts again."
(interactive "r")
(let ((win-conf (current-window-configuration))
- (reftex-index-phrases-restrict-file (buffer-file-name)))
+ (reftex-index-phrases-restrict-file (buffer-file-name)))
(save-excursion
(save-restriction
(narrow-to-region beg end)
(setq text (reftex-index-simplify-phrase text))
(goto-char (point-min))
(if (re-search-forward
- (concat "^\\(\\S-*\\)\t\\(" (regexp-quote text)
+ (concat "^\\(\\S-*\\)\t\\(" (regexp-quote text)
"\\) *[\t\n]") nil t)
(progn
(goto-char (match-end 2))
(let* ((phrase (match-string 3))
(case-fold-search reftex-index-phrases-case-fold-search)
(re (reftex-index-phrases-find-dup-re phrase t)))
- (if (save-excursion
+ (if (save-excursion
(goto-char (point-min))
(and (re-search-forward re nil t)
(re-search-forward re nil t)))
(progn
(princ (format " Superphrases: Phrase matches the following %s in the phrase buffer:\n"
(reftex-number ntimes2 "line")))
- (mapcar (lambda(x)
+ (mapcar (lambda(x)
(princ (format " Line %4d: %s\n" (car x) (cdr x))))
(nreverse superphrases))))))))
beg end)
(goto-char (point-min))
;; Find first and last phrase line in buffer
- (setq beg
+ (setq beg
(and (re-search-forward reftex-index-phrases-phrase-regexp12 nil t)
(match-beginning 0)))
(goto-char (point-max))
(if (string-match reftex-index-phrases-phrase-regexp12 a)
(progn
;; Extract macro char and phrase-or-key for a
- (setq ca (match-string 1 a)
- pa (downcase
+ (setq ca (match-string 1 a)
+ pa (downcase
(or (and reftex-index-phrases-sort-prefers-entry
(match-string 6 a))
(match-string 3 a))))
(if (string-match reftex-index-phrases-phrase-regexp12 b)
(progn
;; Extract macro char and phrase-or-key for b
- (setq cb (match-string 1 b)
+ (setq cb (match-string 1 b)
pb (downcase
(or (and reftex-index-phrases-sort-prefers-entry
(match-string 6 b))
(setq c-p (string< ca cb)
p-p (string< pa pb))
;; Do the right comparison, based on the value of `chars-first'
- ;; `chars-first' is bound locally in the calling function
+ ;; `chars-first' is bound locally in the calling function
(if chars-first
(if (string= ca cb) p-p c-p)
(if (string= pa pb) c-p p-p)))))
(not reftex-index-phrases-sort-in-blocks))))
(defvar reftex-index-phrases-menu)
-(defun reftex-index-make-phrase-regexp (phrase &optional
+(defun reftex-index-make-phrase-regexp (phrase &optional
as-words allow-newline)
"Return a regexp matching PHRASE, even if distributed over lines.
With optional arg AS-WORDS, require word boundary at beginning and end.
"\\([ \t]+\\)")))
(concat (if (and as-words (string-match "\\`\\w" (car words)))
"\\(\\<\\|[`']\\)" "")
- (mapconcat (lambda (w) (regexp-quote
+ (mapconcat (lambda (w) (regexp-quote
(if reftex-index-phrases-case-fold-search
(downcase w)
w)))
words space-re)
- (if (and as-words
+ (if (and as-words
(string-match "\\w\\'" (nth (1- (length words)) words)))
"\\(\\>\\|'\\)" ""))))
(let ((index-keys (split-string (or index-key match)
reftex-index-phrases-logical-and-regexp)))
(concat
- (mapconcat (lambda (x)
- (format macro-fmt
+ (mapconcat (lambda (x)
+ (format macro-fmt
(format (if mathp reftex-index-math-format "%s") x)))
index-keys "")
(if repeat (reftex-index-simplify-phrase match) ""))))
(unless files (error "No files"))
(unwind-protect
(progn
- (switch-to-buffer-other-window (reftex-get-file-buffer-force
+ (switch-to-buffer-other-window (reftex-get-file-buffer-force
(car files)))
(catch 'no-more-files
(while (setq file (pop files))
both ends."
(let* ((re (reftex-index-make-phrase-regexp phrase as-words 'allow-newline))
(case-fold-search reftex-index-phrases-case-fold-search)
- (index-keys (split-string
+ (index-keys (split-string
(or index-key phrase)
reftex-index-phrases-logical-or-regexp))
(nkeys (length index-keys))
(ckey (nth 0 index-keys))
- (all-yes nil)
- match rpl char beg end mathp)
+ (all-yes nil)
+ match rpl char (beg (make-marker)) (end (make-marker)) mathp)
+ (move-marker beg 1)
+ (move-marker end 1)
(unwind-protect
(while (re-search-forward re nil t)
(catch 'next-match
(setq mathp
(save-match-data
(condition-case nil (texmathp) (error nil))))
- (setq beg (car (match-data))
- end (nth 1 (match-data)))
+ (setq beg (move-marker beg (match-beginning 0))
+ end (move-marker end (match-end 0)))
(if (and reftex-index-phrases-skip-indexed-matches
(save-match-data
(reftex-index-phrase-match-is-indexed beg
end)))
(throw 'next-match nil))
(reftex-highlight 0 (match-beginning 0) (match-end 0))
- (setq rpl
+ (setq rpl
(save-match-data
(reftex-index-make-replace-string
macro-fmt (match-string 0) ckey repeat mathp)))
- (while
+ (while
(not
(catch 'loop
(message "REPLACE: %s? (yn!qoe%s?)"
rpl
- (if (> nkeys 1)
+ (if (> nkeys 1)
(concat "1-" (int-to-string nkeys))
""))
(setq char (if all-yes ?y (read-char-exclusive)))
((member char '(?o ?O))
;; Select a differnt macro
(let* ((nc (reftex-index-select-phrases-macro 2))
- (macro-data
+ (macro-data
(cdr (assoc nc reftex-index-phrases-macro-data)))
(macro-fmt (car macro-data))
(repeat (nth 1 macro-data)))
;; Recursive edit
(save-match-data
(save-excursion
- (message
+ (message
(substitute-command-keys
"Recursive edit. Resume with \\[exit-recursive-edit]"))
(recursive-edit))))
(t (ding)))
nil)))))
(message "")
+ (move-marker beg nil)
+ (move-marker end nil)
(setq all-yes nil)
(reftex-unhighlight 0))))
(save-excursion
(goto-char end)
(let* ((all-macros (reftex-what-macro t))
- (this-macro (car (car all-macros)))
+; (this-macro (car (car all-macros)))
(before-macro
(and (> beg 2)
(goto-char (1- beg))
("\C-i" . self-insert-command))
do (define-key reftex-index-phrases-map (car x) (cdr x)))
-(easy-menu-define
+(easy-menu-define
reftex-index-phrases-menu reftex-index-phrases-map
"Menu for Phrases buffer"
'("Phrases"
;;; reftex-parse.el --- parser functions for RefTeX
-
-;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;;
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; reftex-ref.el --- code to create labels and references with RefTeX
-
-;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; reftex-sel.el --- the selection modes for RefTeX
-
-;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2440, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
(when (syntax-table-p reftex-latex-syntax-table)
(set-syntax-table reftex-latex-syntax-table))
;; We do not set a local map - reftex-select-item does this.
- (run-mode-hooks 'reftex-select-label-mode-hook))
+ (run-hooks 'reftex-select-label-mode-hook))
(defvar reftex-select-bib-map nil
"Keymap used for *RefTeX Select* buffer, when selecting a BibTeX entry.
mode-name "BSelect")
(set (make-local-variable 'reftex-select-marked) nil)
;; We do not set a local map - reftex-select-item does this.
- (run-mode-hooks 'reftex-select-bib-mode-hook))
+ (run-hooks 'reftex-select-bib-mode-hook))
;;; (defun reftex-get-offset (buf here-am-I &optional typekey toc index file)
;;; ;; Find the correct offset data, like insert-docstruct would, but faster.
;;; reftex-toc.el --- RefTeX's table of contents mode
-
-;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
"Keymap used for *toc* buffer.")
(defvar reftex-toc-menu)
-(defvar zmacs-regions)
-
+(eval-when-compile (defvar zmacs-regions))
+(defvar reftex-last-window-height nil)
+(defvar reftex-last-window-width nil)
(defvar reftex-toc-include-labels-indicator nil)
(defvar reftex-toc-include-index-indicator nil)
(defvar reftex-toc-max-level-indicator nil)
(add-hook 'post-command-hook 'reftex-toc-post-command-hook nil t)
(add-hook 'pre-command-hook 'reftex-toc-pre-command-hook nil t)
(easy-menu-add reftex-toc-menu reftex-toc-map)
- (run-mode-hooks 'reftex-toc-mode-hook))
+ (run-hooks 'reftex-toc-mode-hook))
(defvar reftex-last-toc-file nil
"Stores the file name from which `reftex-toc' was called. For redo command.")
-(defvar reftex-last-window-height nil)
-(defvar reftex-last-window-width nil)
(defvar reftex-toc-return-marker (make-marker)
"Marker which makes it possible to return from toc to old position.")
(frame-parameter (selected-frame) 'unsplittable)))
offset toc-window)
- (if (setq toc-window (get-buffer-window
+ (if (setq toc-window (get-buffer-window
"*toc*"
(if reuse 'visible)))
(select-window toc-window)
(split-window-horizontally
(floor (* (window-width)
reftex-toc-split-windows-fraction)))
- (split-window-vertically
+ (split-window-vertically
(floor (* (window-height)
reftex-toc-split-windows-fraction)))))
reftex-toc-include-context
nil ; counter
nil ; commented
- here-I-am
+ here-I-am
"" ; xr-prefix
t ; a toc buffer
))
-
+
(run-hooks 'reftex-display-copied-context-hook)
(message "Building *toc* buffer...done.")
(setq buffer-read-only t))
t
reftex-toc-include-index-entries
reftex-toc-include-file-boundaries)
- (reftex-last-assoc-before-elt
+ (reftex-last-assoc-before-elt
'toc here-I-am
(symbol-value reftex-docstruct-symbol))))
(put 'reftex-toc :reftex-line 3)
(not (get-text-property (point) 'intangible))
(memq reftex-highlight-selection '(cursor both))
(reftex-highlight 2
- (or (previous-single-property-change
+ (or (previous-single-property-change
(min (point-max) (1+ (point))) :data)
(point-min))
(or (next-single-property-change (point) :data)
(window-height))))))
(defun reftex-toc-dframe-p (&optional frame error)
- ;; Check if FRAME is the dedicated TOC frame.
+ ;; Check if FRAME is the dedicated TOC frame.
;; If yes, and ERROR is non-nil, throw an error.
(setq frame (or frame (selected-frame)))
- (let ((res (equal
+ (let ((res (equal
(if (fboundp 'frame-property)
(frame-property frame 'name)
(frame-parameter frame 'name))
(if (boundp 'zmacs-region-stays) (setq zmacs-region-stays t))
(setq reftex-callback-fwd t)
(or (eobp) (forward-char 1))
- (goto-char (or (next-single-property-change (point) :data)
+ (goto-char (or (next-single-property-change (point) :data)
(point))))
(defun reftex-toc-previous (&optional arg)
"Move to previous selectable item."
With prefix ARG, prompt for a label type and include only labels of
that specific type."
(interactive "P")
- (setq reftex-toc-include-labels
+ (setq reftex-toc-include-labels
(if arg (reftex-query-label-type)
(not reftex-toc-include-labels)))
(reftex-toc-revert))
(defun reftex-toc-rescan (&rest ignore)
"Regenerate the *toc* buffer by reparsing file of section at point."
(interactive)
- (if (and reftex-enable-partial-scans
+ (if (and reftex-enable-partial-scans
(null current-prefix-arg))
(let* ((data (get-text-property (point) :data))
(what (car data))
(defun reftex-toc-revert (&rest ignore)
"Regenerate the *toc* from the internal lists."
(interactive)
- (let ((unsplittable
+ (let ((unsplittable
(if (fboundp 'frame-property)
(frame-property (selected-frame) 'unsplittable)
(frame-parameter (selected-frame) 'unsplittable)))
;; Promotion/Demotion stuff
+(defvar delta)
+(defvar mpos)
+(defvar pro-or-de)
+(defvar start-pos)
+(defvar start-line)
+(defvar mark-line)
+
(defun reftex-toc-demote (&optional arg)
"Demote section at point. If region is active, apply to all in region."
(interactive "p")
(goto-char start-pos)
(setq sections (reftex-toc-extract-section-number (car entries)))
(if (> (setq nsec (length entries)) 1)
- (setq sections
+ (setq sections
(concat sections "-"
(reftex-toc-extract-section-number
(nth (1- nsec) entries)))))
(save-window-excursion
(reftex-toc-Rescan))
(reftex-toc-restore-region start-line mark-line)
- (message "%d section%s %smoted"
+ (message "%d section%s %smoted"
nsec (if (= 1 nsec) "" "s") pro-or-de)
nil))
(if msg (progn (ding) (message msg)))))
-(defvar delta)
-(defvar mpos)
-(defvar pro-or-de)
-(defvar start-pos)
-(defvar start-line)
-(defvar mark-line)
(defun reftex-toc-restore-region (point-line &optional mark-line)
(if mark-line
(setq mark-active t
deactivate-mark nil)))))
+(defvar name1)
+(defvar dummy)
+(defvar dummy2)
+
(defun reftex-toc-promote-prepare (x)
"Look at a toc entry and see if we could pro/demote it.
Expects the level change DELTA to be dynamically scoped into this function.
(beginning-of-line 1)
(if (looking-at reftex-section-regexp)
(setq name (reftex-match-string 2))
- (error "Something is wrong! Contact maintainer!")))
+ (error "Something is wrong! Contact maintainer!")))
;; Section has changed, request scan and loading
;; We use a variable to delay until after the safe-exc.
;; because otherwise we loose the region.
(error "This is not a label entry."))
(setq newlabel (read-string (format "Rename label \"%s\" to:" label)))
(if (assoc newlabel (symbol-value reftex-docstruct-symbol))
- (if (not (y-or-n-p
+ (if (not (y-or-n-p
(format "Label '%s' exists. Use anyway? " label)))
(error "Abort")))
(save-excursion
(reftex-query-replace-document
(concat "{" (regexp-quote label) "}")
(format "{%s}" newlabel))
- (error t))))
+ (error t))))
(reftex-toc-rescan)))
show-window show-buffer match)
(unless toc (error "Don't know which toc line to visit"))
-
+
(cond
-
+
((eq (car toc) 'toc)
;; a toc entry
(setq match (reftex-toc-find-section toc no-revisit)))
(file (nth 1 toc)))
(if (or (not no-revisit) (reftex-get-buffer-visiting file))
(progn
- (switch-to-buffer-other-window
+ (switch-to-buffer-other-window
(reftex-get-file-buffer-force file nil))
(goto-char (if (eq where 'bof) (point-min) (point-max))))
(message reftex-no-follow-message) nil))))
(looking-at (reftex-make-desperate-section-regexp literal))
(looking-at (concat "\\\\"
(regexp-quote
- (car
- (rassq level
+ (car
+ (rassq level
reftex-section-levels-all)))
"[[{]?"))))
((or (not no-revisit)
(define-key reftex-toc-map (vector (list key)) 'digit-argument))
(define-key reftex-toc-map "-" 'negative-argument)
-(easy-menu-define
+(easy-menu-define
reftex-toc-menu reftex-toc-map
"Menu for Table of Contents buffer"
'("TOC"
["Context" reftex-toc-toggle-context :style toggle
:selected reftex-toc-include-context]
"--"
- ["Follow Mode" reftex-toc-toggle-follow :style toggle
+ ["Follow Mode" reftex-toc-toggle-follow :style toggle
:selected reftex-toc-follow-mode]
["Auto Recenter" reftex-toggle-auto-toc-recenter :style toggle
:selected reftex-toc-auto-recenter-timer]
;;; reftex-vars.el --- configuration variables for RefTeX
-
-;; Copyright (C) 1997, 1998, 1999, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2003, 2004, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; Code:
-
+(eval-when-compile (defvar reftex-tables-dirty))
(eval-when-compile (require 'cl))
(eval-and-compile
- (defvar reftex-tables-dirty)
(defun reftex-set-dirty (symbol value)
(setq reftex-tables-dirty t)
(set symbol value)))
("enumerate" ?i "item:" "~\\ref{%s}" item
(regexp "items?" "Punkte?"))
-
+
("equation" ?e "eq:" "~(\\ref{%s})" t
(regexp "equations?" "eqs?\\." "eqn\\." "Gleichung\\(en\\)?" "Gl\\."))
("eqnarray" ?e "eq:" nil eqnarray-like)
-
+
("figure" ?f "fig:" "~\\ref{%s}" caption
(regexp "figure?[sn]?" "figs?\\." "Abbildung\\(en\\)?" "Abb\\."))
("figure*" ?f nil nil caption)
-
+
("table" ?t "tab:" "~\\ref{%s}" caption
(regexp "tables?" "tab\\." "Tabellen?"))
("table*" ?t nil nil caption)
-
+
("\\footnote[]{}" ?n "fn:" "~\\ref{%s}" 2
(regexp "footnotes?" "Fussnoten?"))
-
+
("any" ?\ " " "~\\ref{%s}" nil)
;; The label macro is hard coded, but it *could* be defined like this:
`?t' should point to a textual citation (citation as a noun).
`?p' should point to a parenthetical citation.")
-(defconst reftex-index-macros-builtin
+(defconst reftex-index-macros-builtin
'((default "Default \\index and \\glossary macros"
(("\\index{*}" "idx" ?i "" nil t)
("\\glossary{*}" "glo" ?g "" nil t)))
(Index-Shortcut "index.sty with \\shortindexingon"
(("\\index[]{*}" 1 ?i "" nil t)
("\\index*[]{*}" 1 ?I "" nil nil)
- ("^[]{*}" 1 ?^ "" texmathp t)
+ ("^[]{*}" 1 ?^ "" texmathp t)
("_[]{*}" 1 ?_ "" texmathp nil))))
"Builtin stuff for reftex-index-macros.
Lower-case symbols correspond to a style file of the same name in the LaTeX
(defgroup reftex nil
"LaTeX label and citation support."
:tag "RefTeX"
- :link '(url-link :tag "Home Page"
+ :link '(url-link :tag "Home Page"
"http://zon.astro.uva.nl/~dominik/Tools/")
:link '(emacs-commentary-link :tag "Commentary in reftex.el" "reftex.el")
:link '(custom-manual "(reftex)Top")
automatic recentering is turned on. When the frame gets destroyed, automatic
recentering is turned off again.
-This feature can be turned on and off from the menu
+This feature can be turned on and off from the menu
\(Ref->Options)."
:group 'reftex-table-of-contents-browser
:type '(choice
(const :tag "never" nil)
(const :tag "always" t)
(const :tag "in dedicated frame only" frame)))
-
+
(defcustom reftex-toc-split-windows-horizontally nil
"*Non-nil means, create TOC window by splitting window horizontally."
:group 'reftex-table-of-contents-browser
'(amsmath endnotes fancybox floatfig longtable picinpar
rotating sidecap subfigure supertab wrapfig LaTeX)
"Default label alist specifications. LaTeX should always be the last entry.
-The value of this variable is a list of symbols with associations in the
+The value of this variable is a list of symbols with associations in the
constant `reftex-label-alist-builtin'. Check that constant for a full list
of options."
:group 'reftex-defining-label-environments
(defcustom reftex-section-prefixes '((0 . "part:") (1 . "cha:") (t . "sec:"))
"Prefixes for section labels.
When the label prefix given in an entry in `reftex-label-alist' contains `%S',
-this list is used to determine the correct prefix string depending on the
+this list is used to determine the correct prefix string depending on the
current section level.
The list is an alist, with each entry of the form (KEY . PREFIX)
Possible keys are sectioning macro names like `chapter', section levels
(regexp)
(repeat :tag "List"
(string :tag "prefix (with colon)"))))
-
+
(defcustom reftex-special-environment-functions nil
"List of functions to be called when trying to figure out current environment.
These are special functions to detect \"environments\" which do not
(let ((pos (point)) p1)
(save-excursion
;; Search for any of the linguex item macros at the beginning of a line
- (if (re-search-backward
+ (if (re-search-backward
\"^[ \\t]*\\\\(\\\\\\\\\\\\(ex\\\\|a\\\\|b\\\\|c\\\\|d\\\\|e\\\\|f\\\\)g?\\\\.\\\\)\" bound t)
(progn
(setq p1 (match-beginning 1))
nil
;; OK, we got it
(cons \"linguex\" p1)))
- ;; Return nil for not found
+ ;; Return nil for not found
nil))))
3. Tell RefTeX to use this function
(defcustom reftex-vref-is-default nil
"*Non-nil means, the varioref macro \\vref is used as default.
-In the selection buffer, the `v' key toggles the reference macro between
+In the selection buffer, the `v' key toggles the reference macro between
`\\ref' and `\\vref'. The value of this variable determines the default
which is active when entering the selection process.
Instead of nil or t, this may also be a string of type letters indicating
(defcustom reftex-fref-is-default nil
"*Non-nil means, the fancyref macro \\fref is used as default.
-In the selection buffer, the `V' key toggles the reference macro between
+In the selection buffer, the `V' key toggles the reference macro between
`\\ref', `\\fref' and `\\Fref'. The value of this variable determines
the default which is active when entering the selection process.
Instead of nil or t, this may also be a string of type letters indicating
(defcustom reftex-format-ref-function nil
"Function which produces the string to insert as a reference.
-Normally should be nil, because the format to insert a reference can
+Normally should be nil, because the format to insert a reference can
already be specified in `reftex-label-alist'.
This hook also is used by the special commands to insert `\\vref' and `\\fref'
references, so even if you set this, your setting will be ignored by
%i institution %j journal %k key %m month
%n number %o organization %p pages %P first page
%r address %s school %u publisher %t title
-%v volume %y year
+%v volume %y year
%B booktitle, abbreviated %T title, abbreviated
Usually, only %l is needed. The other stuff is mainly for the echo area
display, and for (setq reftex-comment-citations t).
-%< as a special operator kills punctuation and space around it after the
+%< as a special operator kills punctuation and space around it after the
string has been formatted.
A pair of square brackets indicates an optional argument, and RefTeX
strings.
In order to configure this variable, you can either set
`reftex-cite-format' directly yourself or set it to the SYMBOL of one of
-the predefined styles. The predefined symbols are those which have an
+the predefined styles. The predefined symbols are those which have an
association in the constant `reftex-cite-format-builtin'.
E.g.: (setq reftex-cite-format 'natbib)"
:group 'reftex-citation-support
(defcustom reftex-format-cite-function nil
"Function which produces the string to insert as a citation.
-Normally should be nil, because the format to insert a reference can
+Normally should be nil, because the format to insert a reference can
already be specified in `reftex-cite-format'.
The function will be called with two arguments, the CITATION KEY and the
DEFAULT FORMAT, which is taken from `reftex-cite-format'. The function
:group 'reftex-index-support
:set 'reftex-set-dirty
:type `(list
- (repeat
+ (repeat
:inline t
(list :value ("" "idx" ?a "" nil)
(string :tag "Macro with args")
This is a list with (MACRO-KEY DEFAULT-TAG).
MACRO-KEY: Character identifying an index macro - see `reftex-index-macros'.
-DEFAULT-TAG: This is the tag to be used if the macro requires a TAG argument.
+DEFAULT-TAG: This is the tag to be used if the macro requires a TAG argument.
When this is nil and a TAG is needed, RefTeX will ask for it.
When this is the empty string and the TAG argument of the index
macro is optional, the TAG argument will be omitted."
(defcustom reftex-index-include-context nil
"*Non-nil means, display the index definition context in the index buffer.
-This flag may also be toggled from the index buffer with the `c' key."
+This flag may also be toggled from the index buffer with the `c' key."
:group 'reftex-index-support
:type 'boolean)
argument of a macro. Note that crossref viewing for citations,
references (both ways) and index entries is hard-coded. This variable
is only to configure additional structures for which crossreference
-viewing can be useful. Each entry has the structure
+viewing can be useful. Each entry has the structure
\(MACRO-RE SEARCH-RE HIGHLIGHT).
displayed, the echo area will display information about that cross
reference. You can also set the variable to the symbol `window'. In
this case a small temporary window is used for the display.
-This feature can be turned on and off from the menu
+This feature can be turned on and off from the menu
\(Ref->Options)."
:group 'reftex-viewing-cross-references
:type '(choice (const :tag "off" nil)
- If an element is the name of an environment variable, its content is used.
- If an element starts with an exclamation mark, it is used as a command
to retrieve the path. A typical command with the kpathsearch library would
- be `!kpsewhich -show-path=.tex'.
+ be `!kpsewhich -show-path=.tex'.
- Otherwise the element itself is interpreted as a path.
Multiple directories can be separated by the system dependent `path-separator'.
Directories ending in `//' or `!!' will be expanded recursively.
- If an element is the name of an environment variable, its content is used.
- If an element starts with an exclamation mark, it is used as a command
to retrieve the path. A typical command with the kpathsearch library would
- be `!kpsewhich -show-path=.bib'.
+ be `!kpsewhich -show-path=.bib'.
- Otherwise the element itself is interpreted as a path.
Multiple directories can be separated by the system dependent `path-separator'.
Directories ending in `//' or `!!' will be expanded recursively.
TEXINPUTS and BIBINPUTS to find TeX files and BibTeX database files.
With this option turned on, it calls an external program specified in the
option `reftex-external-file-finders' instead. As a side effect,
-the variables `reftex-texpath-environment-variables' and
+the variables `reftex-texpath-environment-variables' and
`reftex-bibpath-environment-variables' will be ignored."
:group 'reftex-finding-files
:type 'boolean)
(defcustom reftex-save-parse-info nil
"*Non-nil means, save information gathered with parsing in a file.
The file MASTER.rel in the same directory as MASTER.tex is used to save the
-information. When this variable is t,
+information. When this variable is t,
- accessing the parsing information for the first time in an editing session
will read that file (if available) instead of parsing the document.
- exiting Emacs or killing a buffer in reftex-mode will cause a new version
may require a restart of Emacs in order to become effective."
:group 'reftex-miscellaneous-configurations
:group 'LaTeX
- :type '(choice
+ :type '(choice
(const :tag "No plug-ins" nil)
(const :tag "All possible plug-ins" t)
(list
;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX
-
-;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004, 2005
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.28
+;; Version: VERSIONTAG
;; Keywords: tex
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;---------------------------------------------------------------------------
;;
;;; Commentary:
-;;
+;;
;; RefTeX is a minor mode with distinct support for \ref, \label, \cite,
;; and \index commands in (multi-file) LaTeX documents.
;; - A table of contents provides easy access to any part of a document.
;;
;; Introduction
;; ************
-;;
+;;
;; RefTeX is a specialized package for support of labels, references,
;; citations, and the index in LaTeX. RefTeX wraps itself round 4 LaTeX
;; macros: `\label', `\ref', `\cite', and `\index'. Using these macros
;; time-consuming tasks almost entirely. It also provides functions to
;; display the structure of a document and to move around in this
;; structure quickly.
-;;
+;;
;; *Note Imprint::, for information about who to contact for help, bug
;; reports or suggestions.
-;;
+;;
;; Environment
;; ===========
-;;
+;;
;; RefTeX needs to access all files which are part of a multifile
;; document, and the BibTeX database files requested by the
;; `\bibliography' command. To find these files, RefTeX will require a
;; which are also used by RefTeX. However, on some systems these
;; variables do not contain the full search path. If RefTeX does not work
;; for you because it cannot find some files, read *Note Finding Files::.
-;;
+;;
;; Entering RefTeX Mode
;; ====================
-;;
+;;
;; To turn RefTeX Mode on and off in a particular buffer, use `M-x
;; reftex-mode'. To turn on RefTeX Mode for all LaTeX files, add the
;; following lines to your `.emacs' file:
-;;
+;;
;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
-;;
+;;
;; RefTeX in a Nutshell
;; ====================
-;;
+;;
;; 1. Table of Contents
;; Typing `C-c =' (`reftex-toc') will show a table of contents of the
;; document. This buffer can display sections, labels and index
;; entries defined in the document. From the buffer, you can jump
;; quickly to every part of your document. Press `?' to get help.
-;;
+;;
;; 2. Labels and References
;; RefTeX helps to create unique labels and to find the correct key
;; for references quickly. It distinguishes labels for different
;; others), and can be configured to recognize any additional labeled
;; environments you have defined yourself (variable
;; `reftex-label-alist').
-;;
+;;
;; * Creating Labels
;; Type `C-c (' (`reftex-label') to insert a label at point.
;; RefTeX will either
;; tables) or
;; - insert a simple label made of a prefix and a number (all
;; other environments)
-;;
+;;
;; Which labels are created how is configurable with the variable
;; `reftex-insert-label-flags'.
-;;
+;;
;; * Referencing Labels
;; To make a reference, type `C-c )' (`reftex-reference'). This
;; shows an outline of the document with all labels of a certain
;; type (figure, equation,...) and some label context.
;; Selecting a label inserts a `\ref{LABEL}' macro into the
;; original buffer.
-;;
+;;
;; 3. Citations
;; Typing `C-c [' (`reftex-citation') will let you specify a regular
;; expression to search in current BibTeX database files (as
;; sorted. The selected article is referenced as `\cite{KEY}' (see
;; the variable `reftex-cite-format' if you want to insert different
;; macros).
-;;
+;;
;; 4. Index Support
;; RefTeX helps to enter index entries. It also compiles all entries
;; into an alphabetically sorted `*Index*' buffer which you can use
;; index macros and can be configured to recognize any additional
;; macros you have defined (`reftex-index-macros'). Multiple indices
;; are supported.
-;;
+;;
;; * Creating Index Entries
;; To index the current selection or the word at point, type
;; `C-c /' (`reftex-index-selection-or-word'). The default macro
;; `reftex-index-default-macro' will be used. For a more
;; complex entry type `C-c <' (`reftex-index'), select any of
;; the index macros and enter the arguments with completion.
-;;
+;;
;; * The Index Phrases File (Delayed Indexing)
;; Type `C-c \' (`reftex-index-phrase-selection-or-word') to add
;; the current word or selection to a special _index phrase
;; file_. RefTeX can later search the document for occurrences
;; of these phrases and let you interactively index the matches.
-;;
+;;
;; * Displaying and Editing the Index
;; To display the compiled index in a special buffer, type `C-c
;; >' (`reftex-display-index'). From that buffer you can check
;; and edit all entries.
-;;
+;;
;; 5. Viewing Cross-References
;; When point is on the KEY argument of a cross-referencing macro
;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations)
;; When the enclosing macro is `\cite' or `\ref' and no other message
;; occupies the echo area, information about the citation or label
;; will automatically be displayed in the echo area.
-;;
+;;
;; 6. Multifile Documents
;; Multifile Documents are fully supported. The included files must
;; have a file variable `TeX-master' or `tex-main-file' pointing to
;; the master file. RefTeX provides cross-referencing information
;; from all parts of the document, and across document borders
;; (`xr.sty').
-;;
+;;
;; 7. Document Parsing
;; RefTeX needs to parse the document in order to find labels and
;; other information. It does it automatically once and updates its
;; with a raw `C-u' prefix, or press the `r' key in the label
;; selection buffer, the table of contents buffer, or the index
;; buffer.
-;;
+;;
;; 8. AUCTeX
;; If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it
;; (see variable `reftex-plug-into-AUCTeX'). AUCTeX contains style
;; files which trigger appropriate settings in RefTeX, so that for
;; many of the popular LaTeX packages no additional customizations
;; will be necessary.
-;;
+;;
;; 9. Useful Settings
;; To make RefTeX faster for large documents, try these:
;; (setq reftex-enable-partial-scans t)
;; (setq reftex-save-parse-info t)
;; (setq reftex-use-multiple-selection-buffers t)
-;;
+;;
;; To integrate with AUCTeX, use
;; (setq reftex-plug-into-AUCTeX t)
-;;
+;;
;; To make your own LaTeX macro definitions known to RefTeX,
;; customize the variables
;; `reftex-label-alist' (for label macros/environments)
;; `reftex-index-default-macro' (to set the default macro)
;; If you have a large number of macros defined, you may want to write
;; an AUCTeX style file to support them with both AUCTeX and RefTeX.
-;;
+;;
;; 10. Where Next?
;; Go ahead and use RefTeX. Use its menus until you have picked up
;; the key bindings. For an overview of what you can do in each of
;; The first part of the manual explains in a tutorial way how to use
;; and customize RefTeX. The second part is a command and variable
;; reference.
-;;
+;;
;;---------------------------------------------------------------------------
;;
;; AUTHOR
(setq reftex-tables-dirty t)
(set symbol value)))
-(defvar font-lock-keywords)
-
;;; =========================================================================
;;;
;;; Define the formal stuff for a minor mode named RefTeX.
;;;
-(defconst reftex-version "RefTeX version 4.28"
+(defconst reftex-version "RefTeX version VERSIONTAG"
"Version string for RefTeX.")
(defvar reftex-mode nil
(setq reftex-syntax-table (copy-syntax-table))
(modify-syntax-entry ?\( "." reftex-syntax-table)
(modify-syntax-entry ?\) "." reftex-syntax-table))
-
+
(unless reftex-syntax-table-for-bib
(setq reftex-syntax-table-for-bib
(copy-syntax-table reftex-syntax-table))
(setq reftex-syntax-table (copy-syntax-table (syntax-table)))
(modify-syntax-entry ?\( "." reftex-syntax-table)
(modify-syntax-entry ?\) "." reftex-syntax-table)
-
+
(setq reftex-syntax-table-for-bib
(copy-syntax-table reftex-syntax-table))
(modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
(defvar tex-main-file)
(defvar outline-minor-mode)
(defvar font-lock-mode)
+ (defvar font-lock-keywords)
(defvar font-lock-fontify-region-function)
(defvar font-lock-syntactic-keywords))
((master
(cond
((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism.
- (condition-case nil
+ (condition-case nil
(TeX-master-file t)
(error (buffer-file-name))))
((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode
)
(t
;; Use buffer file name.
- (buffer-file-name)))
+ (setq master (buffer-file-name))))
(expand-file-name master)))
(defun reftex-is-multi ()
;; A list of all variables in the cache.
;; The cache is used to save the compiled versions of some variables.
-(defconst reftex-cache-variables
+(defconst reftex-cache-variables
'(reftex-memory ;; This MUST ALWAYS be the first!
-
+
;; Outline
reftex-section-levels-all
;; Labels
- reftex-env-or-mac-alist
+ reftex-env-or-mac-alist
reftex-special-env-parsers
reftex-macros-with-labels
reftex-label-mac-list
reftex-index-macro-alist
reftex-macros-with-index
reftex-query-index-macro-prompt
- reftex-query-index-macro-help
+ reftex-query-index-macro-help
reftex-key-to-index-macro-alist
;; Regular expressions
(t (reftex-compile-variables)))))
(defun reftex-reset-mode ()
- "Reset RefTeX Mode.
+ "Reset RefTeX Mode.
This will re-compile the configuration information and remove all
current scanning information and the parse file to enforce a rescan
on next use."
(defun reftex-erase-all-selection-and-index-buffers ()
;; Remove all selection buffers associated with current document.
- (mapcar
+ (mapcar
(lambda (type)
(reftex-erase-buffer (reftex-make-selection-buffer-name type)))
reftex-typekey-list)
;; Kill all index buffers
- (mapcar
+ (mapcar
(lambda (tag)
(reftex-kill-buffer (reftex-make-index-buffer-name tag)))
(cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol)))))
;; Record that we have done this, and what we have used.
(setq reftex-tables-dirty nil)
- (setq reftex-memory
+ (setq reftex-memory
(list reftex-label-alist
(get reftex-docstruct-symbol 'reftex-section-levels)
(get reftex-docstruct-symbol 'reftex-label-alist-style)
'(nil)))
(all-index (reftex-uniquify-by-car
(reftex-splice-symbols-into-list
- (append reftex-index-macros
+ (append reftex-index-macros
(get reftex-docstruct-symbol
'reftex-index-macros-style)
'(default))
macro verify repeat nindex tag key toc-level toc-levels)
(setq reftex-words-to-typekey-alist nil
- reftex-prefix-to-typekey-alist
+ reftex-prefix-to-typekey-alist
'(("sec:" . "s") ("cha:" . "s") ("chap:" . "s"))
reftex-typekey-list nil
reftex-typekey-to-format-alist nil
((symbolp env-or-mac)
;; A special parser function
(unless (fboundp env-or-mac)
- (message "Warning: %s does not seem to be a valid function"
+ (message "Warning: %s does not seem to be a valid function"
env-or-mac))
(setq nargs nil nlabel nil opt-args nil)
(add-to-list 'reftex-special-env-parsers env-or-mac)
(push (cons string toc-level) toc-levels))))))))
;; Translate some special context cases
(when (assq context reftex-default-context-regexps)
- (setq context
- (format
+ (setq context
+ (format
(cdr (assq context reftex-default-context-regexps))
(regexp-quote env-or-mac))))
;; See if this is the first format for this typekey
(nreverse reftex-typekey-to-prefix-alist))
;; Prepare the typekey query prompt and help string.
- (setq qh-list
+ (setq qh-list
(sort qh-list
(lambda (x1 x2)
(string< (downcase (car x1)) (downcase (car x2))))))
"]"))
;; In the help string, we need to wrap lines...
(setq reftex-type-query-help
- (concat
+ (concat
"SELECT A LABEL TYPE:\n--------------------\n"
(mapconcat
(lambda(x)
;; which allow for some chars from the ref format to be in the buffer.
;; These characters will be seen and removed.
(setq reftex-words-to-typekey-alist
- (mapcar
+ (mapcar
(lambda (x)
(setq word (car x)
typekey (cdr x)
(setq reftex-key-to-index-macro-alist
(sort reftex-key-to-index-macro-alist
(lambda (a b) (< (downcase (car a)) (downcase (car b))))))
- (setq reftex-query-index-macro-prompt
+ (setq reftex-query-index-macro-prompt
(concat "Index macro: ["
(mapconcat (lambda (x) (char-to-string (car x)))
reftex-key-to-index-macro-alist "")
"]"))
(setq i 0
reftex-query-index-macro-help
- (concat
+ (concat
"SELECT A MACRO:\n---------------\n"
(mapconcat
(lambda(x)
- (format "[%c] %-20.20s%s" (car x) (nth 1 x)
+ (format "[%c] %-20.20s%s" (car x) (nth 1 x)
(if (= 0 (mod (incf i) 3)) "\n" "")))
reftex-key-to-index-macro-alist "")))
(let* (
; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
(wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because
- ;;; because match number are hard coded
+ ;;; because match number are hard coded
(label-re "\\\\label{\\([^}]*\\)}")
- (include-re (concat wbol
+ (include-re (concat wbol
"\\\\\\("
- (mapconcat 'identity
+ (mapconcat 'identity
reftex-include-file-commands "\\|")
"\\)[{ \t]+\\([^} \t\n\r]+\\)"))
(section-re
reftex-macros-with-labels macros-with-labels
reftex-find-index-entry-regexp-format find-index-re-format
reftex-find-label-regexp-format find-label-re-format
- reftex-find-label-regexp-format2
+ reftex-find-label-regexp-format2
"\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]")
(message "Compiling label environment definitions...done")))
(put reftex-docstruct-symbol 'reftex-cache
(and (symbolp reftex-docstruct-symbol)
(symbol-value reftex-docstruct-symbol)
t))
-
+
(defun reftex-silence-toc-markers (list n)
;; Set all toc markers in the first N entries in list to nil
(while (and list (> (decf n) -1))
(master (reftex-TeX-master-file))
(enable-local-variables nil)
(file (if (string-match "\\.[a-zA-Z]+\\'" master)
- (concat (substring master 0 (match-beginning 0))
+ (concat (substring master 0 (match-beginning 0))
reftex-parse-file-extension)
(concat master reftex-parse-file-extension))))
(cond
;; Check if the master is the same: when moving a document, this will see it.
(let* ((real-master (reftex-TeX-master-file))
- (parsed-master
+ (parsed-master
(nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol)))))
(unless (string= (file-truename real-master) (file-truename parsed-master))
(message "Master file name in load file is different: %s versus %s"
(defun reftex-select-external-document (xr-alist xr-index)
;; Return index of an external document.
(let* ((len (length xr-alist)) (highest (1- (+ ?0 len)))
- (prompt (format "[%c-%c] Select TAB: Read prefix with completion"
+ (prompt (format "[%c-%c] Select TAB: Read prefix with completion"
?0 highest))
key prefix)
(cond
(- 1 xr-index))
(t
(save-excursion
- (let* ((length (apply 'max (mapcar
+ (let* ((length (apply 'max (mapcar
(lambda(x) (length (car x))) xr-alist)))
(fmt (format " [%%c] %%-%ds %%s\n" length))
(n (1- ?0)))
(concat
"SELECT EXTERNAL DOCUMENT\n------------------------\n"
(mapconcat
- (lambda (x)
+ (lambda (x)
(format fmt (incf n) (or (car x) "")
(abbreviate-file-name (cdr x))))
xr-alist ""))
(let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t)))
(extensions (cdr (assoc type reftex-file-extensions)))
(def-ext (car extensions))
- (ext-re (concat "\\("
+ (ext-re (concat "\\("
(mapconcat 'regexp-quote extensions "\\|")
"\\)\\'"))
(files (if (string-match ext-re file)
path old-path file1)
(cond
((file-name-absolute-p file)
- (setq file1
- (or
+ (setq file1
+ (or
(and (car files) (file-regular-p (car files)) (car files))
(and (cdr files) (file-regular-p (cdr files)) (cdr files)))))
((and reftex-use-external-file-finders
(setq old-path path
path (cons master-dir path)
file1 (or (and (car files)
- (reftex-find-file-on-path
+ (reftex-find-file-on-path
(car files) path master-dir))
(and (cdr files)
- (reftex-find-file-on-path
+ (reftex-find-file-on-path
(cdr files) path master-dir))))))))
(cond (file1 file1)
(die (error "No such file: %s" file) nil)
(reftex-uniquify
(reftex-parse-colon-path
(mapconcat
- (lambda(x)
+ (lambda(x)
(if (string-match "^!" x)
(apply 'reftex-process-string
(split-string (substring x 1)))
;; (cdr (assoc type reftex-path-environment))
;; However, historically we have separate options for the
;; environment variables, so we have to do this:
- (symbol-value (intern (concat "reftex-" type
+ (symbol-value (intern (concat "reftex-" type
"path-environment-variables")))
path-separator))))
(put pathvar 'status 'split)
;; or: Relative recursive path elements need to be expanded
;; relative to new default directory
(message "Expanding search path to find %s file: %s ..." type file)
- (put pathvar 'recursive-path
+ (put pathvar 'recursive-path
(reftex-expand-path (symbol-value pathvar) master-dir))
(put pathvar 'master-dir master-dir)
(get pathvar 'recursive-path))
- (t
+ (t
;; Recursive path computed earlier is still OK.
(get pathvar 'recursive-path)))
;; The simple path was requested
;; Trailing ! or !! will be converted into `//' (emTeX convention)
(mapcar
(lambda (dir)
- (if (string-match "\\(//+\\|/*!+\\)\\'" dir)
+ (if (string-match "\\(//+\\|/*!+\\)\\'" dir)
(setq dir (replace-match "//" t t dir)))
(file-name-as-directory dir))
(delete "" (split-string path (concat path-separator "+")))))
(when (file-directory-p dir)
(setq files (nreverse (directory-files dir t "[^.]")))
(while (setq file (pop files))
- (if (file-directory-p file)
+ (if (file-directory-p file)
(push (file-name-as-directory file) path)))
(push dir path1)))
path1))
"Show the table of contents for the current document." t)
(autoload 'reftex-toc-recenter "reftex-toc"
"Display the TOC window and highlight line corresponding to current position." t)
-(autoload 'reftex-toggle-auto-toc-recenter "reftex-toc"
+(autoload 'reftex-toggle-auto-toc-recenter "reftex-toc"
"Toggle automatic recentering of TOC window." t)
;;; =========================================================================
(while list
(if (funcall predicate (car list))
(push (if completion
- (list (nth nth (car list)))
+ (list (nth nth (car list)))
(nth nth (car list)))
rtn))
(setq list (cdr list)))
;; If POS is given, calculate distances relative to it.
;; Return nil if there is no match.
(let ((pos (point))
- (dist (or max-length (length regexp)))
+ (dist (or max-length (length regexp)))
match1 match2 match)
(goto-char (min (+ pos dist) (point-max)))
(when (re-search-backward regexp nil t)
((and scroll (equal char ?\C-? ))
(condition-case nil (scroll-down) (error nil))
(message prompt))
- (t (message "")
+ (t (message "")
(throw 'exit char)))
(setq char (read-char-exclusive)))))))
-
+
(defun reftex-make-regexp-allow-for-ctrl-m (string)
;; convert STRING into a regexp, allowing ^M for \n and vice versa
;; Restrict number of words
(if (> (length words) nwords)
(setcdr (nthcdr (1- nwords) words) nil))
-
+
;; First, try to use all words
(setq string (mapconcat 'identity words sep))
-
+
;; Abbreviate words if enforced by user settings or string length
(if (or (eq t abbrev)
(and abbrev
(font-lock-set-defaults-1)
(reftex-select-font-lock-fontify-region (point-min) (point-max))))
(t
- ;; Oops?
+ ;; Oops?
(message "Sorry: cannot refontify RefTeX Select buffer."))))
(rename-buffer oldname))))
;; Initialize the overlays
(aset reftex-highlight-overlays 0 (reftex-make-overlay 1 1))
-(reftex-overlay-put (aref reftex-highlight-overlays 0)
+(reftex-overlay-put (aref reftex-highlight-overlays 0)
'face 'highlight)
(aset reftex-highlight-overlays 1 (reftex-make-overlay 1 1))
(reftex-overlay-put (aref reftex-highlight-overlays 1)
;;; =========================================================================
;;;
-;;; Keybindings
+;;; Keybindings
;; The default bindings in the mode map.
(loop for x in
;; Bind `reftex-mouse-view-crossref' only when the key is still free
(if (featurep 'xemacs)
(unless (key-binding [(shift button2)])
- (define-key reftex-mode-map [(shift button2)]
+ (define-key reftex-mode-map [(shift button2)]
'reftex-mouse-view-crossref))
(unless (key-binding [(shift mouse-2)])
- (define-key reftex-mode-map [(shift mouse-2)]
+ (define-key reftex-mode-map [(shift mouse-2)]
'reftex-mouse-view-crossref)))
;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map
("Reference Style"
["Default" (setq reftex-vref-is-default nil
reftex-fref-is-default nil)
- :style radio :selected (not (or reftex-vref-is-default
+ :style radio :selected (not (or reftex-vref-is-default
reftex-fref-is-default))]
["Varioref" (setq reftex-vref-is-default t
reftex-fref-is-default nil)
(list 'reftex-add-index-macros (list 'list (list 'quote (car x))))
:style 'radio :selected
(list 'memq (list 'quote (car x))
- (list 'get 'reftex-docstruct-symbol
+ (list 'get 'reftex-docstruct-symbol
(list 'quote 'reftex-index-macros-style)))))
reftex-index-macros-builtin))
"--"
("Customize"
["Browse RefTeX Group" reftex-customize t]
"--"
- ["Build Full Customize Menu" reftex-create-customize-menu
+ ["Build Full Customize Menu" reftex-create-customize-menu
(fboundp 'customize-menu-create)])
("Documentation"
["Info" reftex-info t]
(interactive)
(if (fboundp 'customize-menu-create)
(progn
- (easy-menu-change
+ (easy-menu-change
'("Ref") "Customize"
`(["Browse RefTeX group" reftex-customize t]
"--"
;;; That's it! ----------------------------------------------------------------
(setq reftex-tables-dirty t) ; in case this file is evaluated by hand
-(provide 'reftex)
+(provide 'reftex)
;;;============================================================================