changeset 46683:060f433ebf11

Updated to RefTeX 4.18
author Carsten Dominik <dominik@science.uva.nl>
date Thu, 25 Jul 2002 07:03:41 +0000
parents 7a836df2d686
children 9569bac241a3
files lisp/textmodes/reftex-auc.el lisp/textmodes/reftex-cite.el lisp/textmodes/reftex-dcr.el lisp/textmodes/reftex-global.el lisp/textmodes/reftex-index.el lisp/textmodes/reftex-parse.el lisp/textmodes/reftex-ref.el lisp/textmodes/reftex-sel.el lisp/textmodes/reftex-toc.el lisp/textmodes/reftex-vars.el lisp/textmodes/reftex.el
diffstat 11 files changed, 72 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/reftex-auc.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex-auc.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-cite.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex-cite.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 
 ;; This file is part of GNU Emacs.
 
@@ -164,13 +164,16 @@
   (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)
+                 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 
-	    "RegExp [ && RegExp...]: "
+	    (concat
+	     "Regex { && Regex...}: "
+	     "[" default "]: ")
 	    (if reftex-mode
 		(if (fboundp 'LaTeX-bibitem-list)
 		    (LaTeX-bibitem-list)
@@ -180,6 +183,9 @@
 	    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,7 +321,7 @@
   ;; 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)
+  (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,10 +357,26 @@
     (unless entries
       (error "No bibitems found"))
 
-    (setq re-list (split-string 
-		   (read-string "RegExp [ && RegExp...]: "
-				nil 'reftex-cite-regexp-hist)
-		   "[ \t]*&&[ \t]*"))
+    ;; 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"))
 
@@ -375,6 +397,16 @@
 
     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
 
 (defun reftex-get-bib-names (field entry)
--- a/lisp/textmodes/reftex-dcr.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex-dcr.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 ;;
 
 ;; This file is part of GNU Emacs.
--- a/lisp/textmodes/reftex-global.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex-global.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-index.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex-index.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 
 ;; This file is part of GNU Emacs.
 
@@ -299,6 +299,10 @@
 	      "  R<" 'reftex-index-restriction-indicator ">"
 	      " -%-"))
   (setq truncate-lines t)
+  (when (featurep 'xemacs)
+    ;; XEmacs needs the call to make-local-hook
+    (make-local-hook 'post-command-hook)
+    (make-local-hook 'pre-command-hook))
   (make-local-variable 'reftex-last-follow-point)
   (easy-menu-add reftex-index-menu reftex-index-map)
   (add-hook 'post-command-hook 'reftex-index-post-command-hook nil t)
--- a/lisp/textmodes/reftex-parse.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex-parse.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 ;;
 
 ;; This file is part of GNU Emacs.
@@ -335,7 +335,8 @@
       (goto-char (point-min))
       (if (re-search-forward
 	   (concat
-	    "\\(\\`\\|[\n\r]\\)[^%]*\\\\\\("
+;	    "\\(\\`\\|[\n\r]\\)[^%]*\\\\\\("
+	    "\\(^\\)[^%]*\\\\\\("
 	    (mapconcat 'identity reftex-bibliography-commands "\\|")
 	    "\\){[ \t]*\\([^}]+\\)") nil t)
 	  (setq files 
--- a/lisp/textmodes/reftex-ref.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex-ref.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 
 ;; This file is part of GNU Emacs.
 
@@ -646,7 +646,7 @@
 	      selection-buffers)
       (reftex-kill-temporary-buffers))
     ;; Add the prefixes, put together the relevant information in the form
-    ;; (LABEL TYPEKEY SEPERATOR) and return a list of those.
+    ;; (LABEL TYPEKEY SEPARATOR) and return a list of those.
     (mapcar (lambda (x)
 	      (if (listp x)
 		  (list (concat prefix (car (car x)))
--- a/lisp/textmodes/reftex-sel.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex-sel.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 
 ;; This file is part of GNU Emacs.
 
@@ -49,6 +49,10 @@
 
   (interactive)
   (kill-all-local-variables)
+  (when (featurep 'xemacs)
+    ;; XEmacs needs the call to make-local-hook
+    (make-local-hook 'pre-command-hook)
+    (make-local-hook 'post-command-hook))
   (setq major-mode 'reftex-select-label-mode
 	mode-name "LSelect")
   (set (make-local-variable 'reftex-select-marked) nil)
@@ -75,6 +79,10 @@
 \\{reftex-select-label-map}"
   (interactive)
   (kill-all-local-variables)
+  (when (featurep 'xemacs)
+    ;; XEmacs needs the call to make-local-hook
+    (make-local-hook 'pre-command-hook)
+    (make-local-hook 'post-command-hook))
   (setq major-mode 'reftex-select-bib-mode
 	mode-name "BSelect")
   (set (make-local-variable 'reftex-select-marked) nil)
--- a/lisp/textmodes/reftex-toc.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex-toc.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 
 ;; This file is part of GNU Emacs.
 
@@ -62,6 +62,10 @@
 	      "  T<" 'reftex-toc-max-level-indicator ">"
 	      " -%-"))
   (setq truncate-lines t)
+  (when (featurep 'xemacs)
+    ;; XEmacs needs the call to make-local-hook
+    (make-local-hook 'post-command-hook)
+    (make-local-hook 'pre-command-hook))
   (make-local-variable 'reftex-last-follow-point)
   (add-hook 'post-command-hook 'reftex-toc-post-command-hook nil t)
   (add-hook 'pre-command-hook  'reftex-toc-pre-command-hook nil t)
--- a/lisp/textmodes/reftex-vars.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex-vars.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex.el	Thu Jul 25 06:25:51 2002 +0000
+++ b/lisp/textmodes/reftex.el	Thu Jul 25 07:03:41 2002 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.17
+;; Version: 4.18
 ;; Keywords: tex
 
 ;; This file is part of GNU Emacs.
@@ -300,7 +300,7 @@
 ;;; Define the formal stuff for a minor mode named RefTeX.
 ;;;
 
-(defconst reftex-version "RefTeX version 4.17"
+(defconst reftex-version "RefTeX version 4.18"
   "Version string for RefTeX.")
 
 (defvar reftex-mode nil
@@ -1101,7 +1101,8 @@
     ;; Calculate the regular expressions
     (let* (
 ;	   (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
-	   (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
+	   (wbol "\\(^\\)[ \t]*")  ; Need to keep the empty group because
+	                          ;;; because match number are hard coded  
 	   (label-re "\\\\label{\\([^}]*\\)}")
 	   (include-re (concat wbol 
 			       "\\\\\\("