summaryrefslogtreecommitdiff
path: root/lisp/textmodes/reftex-cite.el
diff options
context:
space:
mode:
authorCarsten Dominik <dominik@science.uva.nl>1999-12-15 17:02:38 +0000
committerCarsten Dominik <dominik@science.uva.nl>1999-12-15 17:02:38 +0000
commit7c4d13cca61958bc3387b200450779cd50fdda11 (patch)
tree430544f1c955f8ecc64f3cf9e6d155579e6fbdda /lisp/textmodes/reftex-cite.el
parentcfad01b4c177361ecacff4f7ffb28154985e7483 (diff)
downloademacs-7c4d13cca61958bc3387b200450779cd50fdda11.tar.gz
* reftex.el (reftex-compile-variables): respect new structure of
`reftex-index-macro' (reftex-compile-variables): Use the changed structure of `reftex-label-alist'. * reftex-vars.el (reftex-index-math-format, (reftex-toc-max-level): New option. reftex-index-phrases-search-whole-words, reftex-index-phrases-case-fold-search, reftex-index-phrases-skip-indexed-matches, reftex-index-phrases-wrap-long-lines, reftex-index-phrases-sort-prefers-entry, reftex-index-phrases-sort-in-blocks): New options. (reftex-index-macros): Option structure changed. (reftex-index-macros-builtin): Added `repeat' item to each entry. (reftex-label-alist): Additional item in each entry to specify if the environment should be listed in the TOC. (eval-when-compile (require 'cl)) added. * reftex-index.el (reftex-index-selection-or-word): No longer deals with "repeat". (reftex-index): "repeat property in `reftex-index-macro-alist' is now used. (reftex-index-phrases-comment-regexp, reftex-index-phrases-macrodef-regexp, reftex-index-phrases-phrase-regexp1, reftex-index-phrases-phrase-regexp2, reftex-index-phrases-phrase-regexp12, reftex-index-phrases-help): New constants. (reftex-index-phrases-macro-data, reftex-index-phrases-files, reftex-index-phrases-font-lock-keywords, reftex-index-phrases-font-lock-defaults, reftex-index-phrases-map, reftex-index-phrases-restrict-file): New variables. (reftex-index-phrase-selection-or-word, reftex-index-visit-phrases-buffer, reftex-index-initialize-phrases-buffer, reftex-index-phrases-save-and-return, reftex-index-phrases-mode, reftex-index-next-phrase, reftex-index-this-phrase, reftex-index-all-phrases, reftex-index-region-phrases, reftex-index-phrases-parse-header, reftex-index-phrases-toggle-restricted, reftex-index-new-phrase, reftex-index-find-next-conflict-phrase, reftex-index-phrases-info, reftex-index-phrases-set-macro-key, reftex-index-sort-phrases, reftex-compare-phrase-lines, reftex-index-make-phrase-regexp, reftex-index-simplify-phrase, reftex-index-phrases-find-dup-re, reftex-index-make-replace-string, reftex-query-index-phrase-globally, reftex-query-index-phrase, reftex-index-phrase-match-is-indexed, reftex-index-phrases-fixup-line, reftex-index-phrases-replace-space, reftex-index-select-phrases-macro): New functions. (reftex-index-globalize, reftex-index-globally): functions removed (eval-when-compile (require 'cl)) added. * reftex-toc.el (reftex-toc-mode): Create new indicator for max level. (reftex-toc-max-level-indicator): New variable. (reftex-toc-max-level): New command. (reftex-toc-map): New keybinding `t'. (reftex-toc-help): Constant updated. (eval-when-compile (require 'cl)) added. * reftex-ref.el (reftex-offer-label-menu): Prefix to `t' command key can change `reftex-toc-max-level' (eval-when-compile (require 'cl)) added. * reftex-sel (reftex-insert-docstruct): Respect `reftex-toc-max-level' (eval-when-compile (require 'cl)) added. * reftex-auc.el (eval-when-compile (require 'cl)) added. * reftex-vcr.el (eval-when-compile (require 'cl)) added. * reftex-cite.el (reftex-citep, reftex-citet): New commands. (reftex-citation, reftex-do-citation, reftex-figure-out-cite-format): Additional argument FORMAT-KEY to preselect a citation format. (eval-when-compile (require 'cl)) added. * reftex-parse.el (reftex-context-substring): Optional parameter to-end (reftex-section-info): Deal with environment matches. (eval-when-compile (require 'cl)) added. * reftex-global.el (eval-when-compile (require 'cl)) added.
Diffstat (limited to 'lisp/textmodes/reftex-cite.el')
-rw-r--r--lisp/textmodes/reftex-cite.el42
1 files changed, 28 insertions, 14 deletions
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index d528b54540e..ae42e7a932c 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -1,8 +1,9 @@
;;; reftex-cite.el - Creating citations with RefTeX
-;;; Version: 4.6
+;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
+(eval-when-compile (require 'cl))
(provide 'reftex-cite)
(require 'reftex)
;;;
@@ -501,7 +502,7 @@
;; Make a citation
;;;###autoload
-(defun reftex-citation (&optional no-insert)
+(defun reftex-citation (&optional no-insert format-key)
"Make a citation using BibTeX database files.
After prompting for a regular expression, scans the buffers with
bibtex entries (taken from the \\bibliography command) and offers the
@@ -510,6 +511,8 @@ to `reftex-cite-format' and inserted into the buffer.
If NO-INSERT is non-nil, nothing is inserted, only the selected key returned.
+FORAT-KEY can be used to pre-select a citation format.
+
When called with one or two `C-u' prefixes, first rescans the document.
When called with a numeric prefix, make that many citations. When
called with point inside the braces of a `\cite' command, it will
@@ -533,13 +536,13 @@ While entering the regexp, completion on knows citation keys is possible.
;; Call reftex-do-citation, but protected
(unwind-protect
- (reftex-do-citation current-prefix-arg no-insert)
+ (reftex-do-citation current-prefix-arg no-insert format-key)
(reftex-kill-temporary-buffers)))
-(defun reftex-do-citation (&optional arg no-insert)
+(defun reftex-do-citation (&optional arg no-insert format-key)
;; This really does the work of reftex-citation.
- (let* ((format (reftex-figure-out-cite-format arg no-insert))
+ (let* ((format (reftex-figure-out-cite-format arg no-insert format-key))
(docstruct-symbol reftex-docstruct-symbol)
(selected-entries (reftex-offer-bib-menu))
(insert-entries selected-entries)
@@ -610,7 +613,7 @@ While entering the regexp, completion on knows citation keys is possible.
;; Return the citation key
(car (car selected-entries))))
-(defun reftex-figure-out-cite-format (arg no-insert)
+(defun reftex-figure-out-cite-format (arg &optional no-insert format-key)
;; Check if there is already a cite command at point and change cite format
;; in order to only add another reference in the same cite command.
(let ((macro (car (reftex-what-macro 1)))
@@ -640,19 +643,30 @@ While entering the regexp, completion on knows citation keys is possible.
cite-format-value))
(when (listp format)
(setq key
- (reftex-select-with-char
- "" (concat "SELECT A CITATION FORMAT\n\n"
- (mapconcat
- (lambda (x)
- (format "[%c] %s %s" (car x)
- (if (> (car x) 31) " " "")
- (cdr x)))
- format "\n"))))
+ (or format-key
+ (reftex-select-with-char
+ "" (concat "SELECT A CITATION FORMAT\n\n"
+ (mapconcat
+ (lambda (x)
+ (format "[%c] %s %s" (car x)
+ (if (> (car x) 31) " " "")
+ (cdr x)))
+ format "\n")))))
(if (assq key format)
(setq format (cdr (assq key format)))
(error "No citation format associated with key `%c'" key)))))
format))
+(defun reftex-citep ()
+ "Call `reftex-citation' with a format selector `?p'."
+ (interactive)
+ (reftex-citation nil ?p))
+
+(defun reftex-citet ()
+ "Call `reftex-citation' with a format selector `?t'."
+ (interactive)
+ (reftex-citation nil ?t))
+
(defvar reftex-select-bib-map)
(defun reftex-offer-bib-menu ()
;; Offer bib menu and return list of selected items