[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: |
Carsten Dominik |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/textmodes/reftex-cite.el |
Date: |
Thu, 25 Jul 2002 03:03:41 -0400 |
Index: emacs/lisp/textmodes/reftex-cite.el
diff -c emacs/lisp/textmodes/reftex-cite.el:1.15
emacs/lisp/textmodes/reftex-cite.el:1.16
*** emacs/lisp/textmodes/reftex-cite.el:1.15 Mon Jul 22 06:36:26 2002
--- emacs/lisp/textmodes/reftex-cite.el Thu Jul 25 03:03:41 2002
***************
*** 2,8 ****
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <address@hidden>
! ;; Version: 4.17
;; This file is part of GNU Emacs.
--- 2,8 ----
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <address@hidden>
! ;; Version: 4.18
;; This file is part of GNU Emacs.
***************
*** 164,176 ****
(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)
;; Read a regexp, completing on known citation keys.
(setq re-list
(split-string
(completing-read
! "RegExp [ && RegExp...]: "
(if reftex-mode
(if (fboundp 'LaTeX-bibitem-list)
(LaTeX-bibitem-list)
--- 164,179 ----
(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)
***************
*** 180,185 ****
--- 183,191 ----
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 ""))
***************
*** 315,321 ****
;; 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)
(unless files
(error "Need file name to find thebibliography environment"))
(while (setq file (pop files))
--- 321,327 ----
;; 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))
***************
*** 351,360 ****
(unless entries
(error "No bibitems found"))
! (setq re-list (split-string
! (read-string "RegExp [ && RegExp...]: "
! nil 'reftex-cite-regexp-hist)
! "[ \t]*&&[ \t]*"))
(if (string-match "\\`[ \t]*\\'" (car re-list))
(error "Empty regular expression"))
--- 357,382 ----
(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"))
***************
*** 374,379 ****
--- 396,411 ----
entries))
entries))
+
+ (defun reftex-get-bibkey-default ()
+ ;; Return the word before the cursor. If the cursor is in a
+ ;; citation macro, return the word before the macro.
+ (let* ((macro (reftex-what-macro 1)))
+ (save-excursion
+ (if (and macro (string-match "cite" (car macro)))
+ (goto-char (cdr macro)))
+ (skip-chars-backward "^a-zA-Z0-9")
+ (reftex-this-word))))
;; Parse and format individual entries