[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/textmodes/reftex-cite.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/textmodes/reftex-cite.el |
Date: |
Tue, 13 May 2003 16:39:27 -0400 |
Index: emacs/lisp/textmodes/reftex-cite.el
diff -c emacs/lisp/textmodes/reftex-cite.el:1.18
emacs/lisp/textmodes/reftex-cite.el:1.19
*** emacs/lisp/textmodes/reftex-cite.el:1.18 Tue Feb 4 08:30:45 2003
--- emacs/lisp/textmodes/reftex-cite.el Tue May 13 16:39:27 2003
***************
*** 1,5 ****
;;; reftex-cite.el --- creating citations with RefTeX
! ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <address@hidden>
;; Version: 4.18
--- 1,5 ----
;;; reftex-cite.el --- creating citations with RefTeX
! ;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
;; Author: Carsten Dominik <address@hidden>
;; Version: 4.18
***************
*** 177,215 ****
;; Parse bibtex buffers
! (defun reftex-extract-bib-entries (buffers)
;; Extract bib entries which match regexps from BUFFERS.
;; BUFFERS is a list of buffers or file names.
;; Return list with entries."
! (let* (re-list first-re rest-re
! (buffer-list (if (listp buffers) buffers (list buffers)))
! found-list entry buffer1 buffer alist
! key-point start-point end-point default)
!
! ;; Read a regexp, completing on known citation keys.
! (setq default (regexp-quote (reftex-get-bibkey-default)))
! (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
! (symbol-value reftex-docstruct-symbol))))
! nil)
! nil nil nil 'reftex-cite-regexp-hist)
! "[ \t]*&&[ \t]*"))
!
! (if (or (null re-list ) (equal re-list '("")))
! (setq re-list (list default)))
!
! (setq first-re (car re-list) ; We'll use the first re to find things,
! rest-re (cdr re-list)) ; the others to narrow down.
! (if (string-match "\\`[ \t]*\\'" (or first-re ""))
! (error "Empty regular expression"))
(save-excursion
(save-window-excursion
--- 177,191 ----
;; Parse bibtex buffers
! (defun reftex-extract-bib-entries (buffers re-list)
;; Extract bib entries which match regexps from BUFFERS.
;; BUFFERS is a list of buffers or file names.
;; Return list with entries."
! (let* ((buffer-list (if (listp buffers) buffers (list buffers)))
! (first-re (car re-list)) ; We'll use the first re to find things,
! (rest-re (cdr re-list)) ; the others to narrow down.
! found-list entry buffer1 buffer alist
! key-point start-point end-point default)
(save-excursion
(save-window-excursion
***************
*** 235,241 ****
(catch 'search-again
(setq key-point (point))
(unless (re-search-backward
! "\\(\\`\\|[\n\r]\\)[ address@hidden([a-zA-Z]+\\)[
\t\n\r]*[{(]" nil t)
(throw 'search-again nil))
(setq start-point (point))
(goto-char (match-end 0))
--- 211,217 ----
(catch 'search-again
(setq key-point (point))
(unless (re-search-backward
! "^[ address@hidden([a-zA-Z]+\\)[ \t\n\r]*[{(]" nil t)
(throw 'search-again nil))
(setq start-point (point))
(goto-char (match-end 0))
***************
*** 247,263 ****
;; Ignore @string, @comment and @c entries or things
;; outside entries
! (when (or (string= (downcase (match-string 2)) "string")
! (string= (downcase (match-string 2)) "comment")
! (string= (downcase (match-string 2)) "c")
(< (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"))
!
;; Check if other regexp match as well
(setq re-list rest-re)
(while re-list
--- 223,237 ----
;; Ignore @string, @comment and @c entries or things
;; outside entries
! (when (or (member-ignore-case (match-string 1)
! '("string" "comment" "c"))
(< (point) key-point)) ; this means match not in {}
(goto-char key-point)
(throw 'search-again nil))
;; Well, we have got a match
! (setq entry (buffer-substring start-point (point)))
!
;; Check if other regexp match as well
(setq re-list rest-re)
(while re-list
***************
*** 336,347 ****
nil)))))
;; Parse the bibliography environment
! (defun reftex-extract-bib-entries-from-thebibliography (files)
;; Extract bib-entries from the \begin{thebibliography} environment.
;; Parsing is not as good as for the BibTeX database stuff.
;; The environment should be located in file FILE.
! (let* (start end buf entries re re-list file default)
(unless files
(error "Need file name to find thebibliography environment"))
(while (setq file (pop files))
--- 310,321 ----
nil)))))
;; Parse the bibliography environment
! (defun reftex-extract-bib-entries-from-thebibliography (files re-list)
;; Extract bib-entries from the \begin{thebibliography} environment.
;; Parsing is not as good as for the BibTeX database stuff.
;; The environment should be located in file FILE.
! (let* (start end buf entries re file default)
(unless files
(error "Need file name to find thebibliography environment"))
(while (setq file (pop files))
***************
*** 377,405 ****
(unless entries
(error "No bibitems found"))
- ;; Read a regexp, completing on known citation keys.
- (setq default (regexp-quote (reftex-get-bibkey-default)))
- (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
- (symbol-value reftex-docstruct-symbol))))
- nil)
- nil nil nil 'reftex-cite-regexp-hist)
- "[ \t]*&&[ \t]*"))
-
- (if (or (null re-list ) (equal re-list '("")))
- (setq re-list (list default)))
-
- (if (string-match "\\`[ \t]*\\'" (car re-list))
- (error "Empty regular expression"))
-
(while (and (setq re (pop re-list)) entries)
(setq entries
(delq nil (mapcar
--- 351,356 ----
***************
*** 757,773 ****
;; Offer bib menu and return list of selected items
(let ((bibtype (reftex-bib-or-thebib))
! found-list rtn key data selected-entries)
(while
(not
(catch 'done
;; Scan bibtex files
(setq found-list
(cond
((eq bibtype 'bib)
; ((assq 'bib (symbol-value reftex-docstruct-symbol))
;; using BibTeX database files.
! (reftex-extract-bib-entries (reftex-get-bibfile-list)))
((eq bibtype 'thebib)
; ((assq 'thebib (symbol-value reftex-docstruct-symbol))
;; using thebibliography environment.
--- 708,744 ----
;; Offer bib menu and return list of selected items
(let ((bibtype (reftex-bib-or-thebib))
! found-list rtn key data selected-entries re-list)
(while
(not
(catch 'done
+ ;; Get the search regexps, completing on known citation keys.
+ (setq re-list
+ (let ((default (regexp-quote (reftex-get-bibkey-default))))
+ (split-string
+ (completing-read
+ (concat
+ "Regex { && Regex...}: "
+ "[" default "]: ")
+ (if reftex-mode
+ (if (fboundp 'LaTeX-bibitem-list)
+ (LaTeX-bibitem-list)
+ (cdr (assoc 'bibview-cache
+ (symbol-value reftex-docstruct-symbol))))
+ nil)
+ nil nil nil 'reftex-cite-regexp-hist default)
+ "[ \t]*&&[ \t]*")))
+
+ (if (string-match "\\`[ \t]*\\'" (car re-list))
+ (error "Empty regular expression"))
+
;; Scan bibtex files
(setq found-list
(cond
((eq bibtype 'bib)
; ((assq 'bib (symbol-value reftex-docstruct-symbol))
;; using BibTeX database files.
! (reftex-extract-bib-entries (reftex-get-bibfile-list) re-list))
((eq bibtype 'thebib)
; ((assq 'thebib (symbol-value reftex-docstruct-symbol))
;; using thebibliography environment.
***************
*** 775,784 ****
(reftex-uniquify
(mapcar 'cdr
(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
--- 746,757 ----
(reftex-uniquify
(mapcar 'cdr
(reftex-all-assq
! 'thebib (symbol-value reftex-docstruct-symbol))))
! re-list))
(reftex-default-bibliography
(message "Using default bibliography")
! (reftex-extract-bib-entries (reftex-default-bibliography)
! re-list))
(t (error "No valid bibliography in this document, and no
default available"))))
(unless found-list
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/textmodes/reftex-cite.el,
Stefan Monnier <=