Commits

Anonymous committed 43c7443

Final fixes for 4.18

  • Participants
  • Parent commits bc61f83

Comments (0)

Files changed (7)

    - `reftex-citation' uses the word before the cursor as a default
      search string.
    - simplified several regular expressions for speed.
+   - Better support for chapterbib
 
 Version 4.17
    - The toc window can be split off horizontally.  See new options
+2002-08-20  Carsten Dominik  <dominik@astro.uva.nl>
+	* reftex-cite.el (reftex-bib-or-thebib):  New function, for better
+	support of the Chapterbib package.
+
 2002-08-17  Carsten Dominik  <dominik@astro.uva.nl>
 
 	* reftex.el (reftex-syntax-table): Preinitialize syntax table for

File reftex-cite.el

 	 reftex-default-bibliography))
   (get 'reftex-default-bibliography :reftex-expanded))
 
+(defun reftex-bib-or-thebib ()
+  ;; Tests if BibTeX or \begin{tehbibliography} should be used for the
+  ;; citation
+  ;; Find the bof of the current file
+  (let* ((docstruct (symbol-value reftex-docstruct-symbol))
+	 (rest (or (member (list 'bof (buffer-file-name)) docstruct)
+		   docstruct))
+	 (bib (assq 'bib rest))
+	 (thebib (assq 'thebib rest))
+	 (bibmem (memq bib rest))
+	 (thebibmem (memq thebib rest)))
+    (when (not (or thebib bib))
+      (setq bib (assq 'bib docstruct)
+	    thebib (assq 'thebib docstruct)
+	    bibmem (memq bib docstruct)
+	    thebibmem (memq thebib docstruct)))
+    (if (> (length bibmem) (length thebibmem))
+	(if bib 'bib nil)
+      (if thebib 'thebib nil))))
+
 (defun reftex-get-bibfile-list ()
   ;; Return list of bibfiles for current document.
   ;; When using the chapterbib or bibunits package you should either
 (defun reftex-offer-bib-menu ()
   ;; Offer bib menu and return list of selected items
 
-  (let (found-list rtn key data selected-entries)
+  (let ((bibtype (reftex-bib-or-thebib))
+	found-list rtn key data selected-entries)
     (while 
 	(not 
 	 (catch 'done
 	   ;; Scan bibtex files
 	   (setq found-list
 	      (cond
-	       ((assq 'bib (symbol-value reftex-docstruct-symbol))
+	       ((eq bibtype 'bib)
+;	       ((assq 'bib (symbol-value reftex-docstruct-symbol))
 		;; using BibTeX database files.
 		(reftex-extract-bib-entries (reftex-get-bibfile-list)))
-	       ((assq 'thebib (symbol-value reftex-docstruct-symbol))
+	       ((eq bibtype 'thebib)
+;	       ((assq 'thebib (symbol-value reftex-docstruct-symbol))
 		;; using thebibliography environment.
 		(reftex-extract-bib-entries-from-thebibliography
 		 (reftex-uniquify
   ;; recommended for follow mode.  It works OK for individual lookups.
   (let ((win (selected-window))
         (key (reftex-get-bib-field "&key" data))
-        bibfile-list item)
+        bibfile-list item bibtype)
 
     (catch 'exit
       (save-excursion
 	(set-buffer reftex-call-back-to-this-buffer)
+	(setq bibtype (reftex-bib-or-thebib))
 	(cond
-	 ((assq 'bib (symbol-value reftex-docstruct-symbol))
+	 ((eq bibtype 'bib)
+;	 ((assq 'bib (symbol-value reftex-docstruct-symbol))
 	  (setq bibfile-list (reftex-get-bibfile-list)))
-	 ((assq 'thebib (symbol-value reftex-docstruct-symbol))
+	 ((eq bibtype 'thebib)
+;	 ((assq 'thebib (symbol-value reftex-docstruct-symbol))
 	  (setq bibfile-list
 		(reftex-uniquify
 		 (mapcar 'cdr

File reftex-dcr.el

       (put 'reftex-auto-view-crossref 'last-window-conf 
 	   (current-window-configuration)))
 
-  (let (files size item (pos (point)) (win (selected-window)) pop-win)
+  (let (files size item (pos (point)) (win (selected-window)) pop-win
+	      (bibtype (reftex-bib-or-thebib)))
     ;; Find the citation mode and the file list
     (cond
-     ((assq 'bib (symbol-value reftex-docstruct-symbol))
+;     ((assq 'bib (symbol-value reftex-docstruct-symbol))
+     ((eq bibtype 'bib)
       (setq item nil
 	    files (reftex-get-bibfile-list)))
-     ((assq 'thebib (symbol-value reftex-docstruct-symbol))
+;     ((assq 'thebib (symbol-value reftex-docstruct-symbol))
+     ((eq bibtype 'thebib)
       (setq item t
 	    files (reftex-uniquify
 		   (mapcar 'cdr

File reftex-index.el

 (require 'reftex)
 ;;;
 
+(defvar mark-active)
+(defvar zmacs-regions)
+(defvar transient-mark-mode)
 (defun reftex-index-selection-or-word (&optional arg phrase)
   "Put selection or the word near point into the default index macro.
 This uses the information in `reftex-index-default-macro' to make an index
 (autoload 'reftex-citation "reftex-cite"
  "Make a citation using BibTeX database files." t)
 (autoload 'reftex-default-bibliography "reftex-cite")
-
+(autoload 'reftex-bib-or-thebib "reftex-cite")
 
 ;;; =========================================================================
 ;;;
 @samp{Einstein&&Bose} will match all articles which mention
 Bose-Einstein condensation, or which are co-authored by Bose and
 Einstein.  When entering the regular expression, you can complete on
-known citation keys.  RefTeX also offeres a default when prompting for a
+known citation keys.  RefTeX also offers a default when prompting for a
 regular expression.  This default is the word before the cursor or the
-word before the current @samp{\cite} comand.  Sometimes this may be a
+word before the current @samp{\cite} command.  Sometimes this may be a
 good search key.@refill
 
 @cindex @code{\bibliography}
 expression, scans the buffers with BibTeX entries (taken from the
 @code{\bibliography} command or a @code{thebibliography} environment)
 and offers the matching entries for selection.  The selected entry is
-formated according to @code{reftex-cite-format} and inserted into the
+formatted according to @code{reftex-cite-format} and inserted into the
 buffer.@refill @*
 When called with one or two @kbd{C-u} prefixes, first rescans the
 document.  When called with a numeric prefix, make that many citations.
 New key binding @kbd{t} in the @file{*toc*} buffer to change this
 setting.@refill 
 @item
-RefTeX maintaines an @file{Index Phrases} file in which phrases can be 
+RefTeX maintains an @file{Index Phrases} file in which phrases can be 
 collected.  When the document is ready, RefTeX can search all
 these phrases and assist indexing all matches.@refill
 @item
 @item
 @code{reftex-citation} uses the word before the cursor as a default
 search string.
+@item
+Simplified several regular expressions for speed.
+@item
+Better support for chapterbib.
 @end itemize
 
 @node Index,  , , Top