Anonymous avatar Anonymous committed 7289572

Synch with reftex.el-3.18.0.4

Comments (0)

Files changed (5)

+_pkg.el
+auto-autoloads.el
+package-info
+1998-02-25  SL Baur  <steve@altair.xemacs.org>
+
+	* reftex.texinfo: Add direntry section for automatic
+	installation.
+	* Update to v3.18.0.4
+
+1998-02-24  SL Baur  <steve@altair.xemacs.org>
+
+	* Update to v3.18.0.2.
+
 1998-02-10  SL Baur  <steve@altair.xemacs.org>
 
 	* Created.
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-VERSION = 1.0
-AUTHOR_VERSION = 3.17
+VERSION = 1.01
+AUTHOR_VERSION = 3.18.0.2
 MAINTAINER = Carsten Dominik <dominik@strw.LeidenUniv.nl>
 PACKAGE = reftex
 PKG_TYPE = regular
 ;; reftex.el --- Minor mode for doing \label, \ref and \cite in LaTeX
 ;; Copyright (c) 1997, 1998 Free Software Foundation, Inc.
 
-;; Version:    3.17 
+;; Version:    3.18.0.4 
 ;; Author:     Carsten Dominik <dominik@strw.LeidenUniv.nl>
 ;; Keywords:   tex
 
 ;;    - File commentary shortened considerably (use Info documentation).
 ;;    - New option `reftex-no-include-regexps' to skip some include files.
 ;;    - New option `reftex-revisit-to-follow'.
+;; Version 3.18
+;;    - The selection now uses a recursive edit, much like minibuffer input.
+;;      This removes all restrictions during selection.  E.g. you can now
+;;      switch buffers at will, use the mouse etc.
+;;    - New option `reftex-highlight-selection'.
+;;    - Mouse-2 can be used to select in selection and *toc* buffers.
+;;    - Fixed some problems regarding the interaction with VIPER mode.
+;;    - Follow-mode is now only used after point motion.
+;;    - RefTeX now finally does not fontify temporary files anymore!
+;; Version 3.19
+;;    - Fixed bug with AUCTeX TeX-master.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;;;;;;
      (("sidewaysfigure" ?f nil nil caption)
       ("sidewaystable"  ?t nil nil caption)))
 
+    (sidecap      "CSfigure and SCtable"
+     (("SCfigure"       ?f nil nil caption)
+      ("SCtable"        ?t nil nil caption)))
+
     (subfigure   "Subfigure environments/macro"
      (("subfigure"   ?f nil nil caption)
       ("subfigure*"  ?f nil nil caption)
 
 (defcustom reftex-default-label-alist-entries
   '(amsmath endnotes fancybox floatfig longtable picinpar
-	    rotating subfigure supertab wrapfig LaTeX)
+	    rotating sidecap subfigure supertab wrapfig LaTeX)
   "Default label alist specifications.  LaTeX should be the last entry.
 This list describes the default label environments RefTeX should always use.
 It is probably a mistake to remove the LaTeX symbol from this list.
 FOLLOW             Follow full context in other window.
 SHOW-COMMENTED     Show labels from regions which are commented out.
 MATCH-IN-TOC       Searches in label menu will also match in toc lines.
-SHOW FILES         Show Begin and end of included files.
+SHOW FILES         Show begin and end of included files.
 
 Each of these flags can be set to t or nil, or to a string of type letters
 indicating the label types for which it should be true.  These strings work
 like character classes in regular expressions.  Thus, setting one of the
 flags to \"sf\" makes the flag true for section and figure labels, nil
-for everything else.  Setting it to \"^ft\" makes it the other way round.
+for everything else.  Setting it to \"^sf\" makes it the other way round.
 The available label types are: s (section), f (figure), t (table), i (item),
 e (equation), n (footnote), plus any definitions in `reftex-label-alist'.
 
   :group 'reftex-miscellaneous-configurations
   :type '(boolean))
 
+(defcustom reftex-highlight-selection 'cursor
+  "*Non-nil mean, highlight selected text in selection and *toc* buffers.
+Normally, the text near the cursor is the selected text, and it is
+highlighted.  This is the entry most keys in the selction and *toc*
+buffers act on.  However, if you mainly use the mouse to select an
+item, you may find it nice to have mouse-triggered highlighting
+instead or as well. The varaiable may have one of these values:
+
+   nil      No highlighting.
+   cursor   Highlighting is cursor driven.
+   mouse    Highlighting is mouse driven.
+   both     Both cursor and mouse trigger highlighting."
+  :group 'reftex-miscellaneous-configurations
+  :type '(choice
+	  (const :tag "Never" nil)
+	  (const :tag "Cursor driven" cursor)
+	  (const :tag "Mouse driven" mouse)
+	  (const :tag "Mouse and Cursor driven." both)))
+
 (defcustom reftex-auto-show-entry 'copy
   "*Non-nil means, do something when context in other window is hidden.
 Some modes like `outline-mode' or `folding-mode' hide parts of buffers.
 ;;; Define the formal stuff for a minor mode named RefTeX.
 ;;;
 
-(defconst reftex-version "RefTeX version 3.17"
+(defconst reftex-version "RefTeX version 3.18.0.4"
   "Version string for RefTeX.")
 
 (defvar reftex-mode nil
 (defvar reftex-default-context-position nil)
 (defvar reftex-location-start nil)
 (defvar reftex-call-back-to-this-buffer nil)
+(defvar reftex-select-return-marker (make-marker))
 (defvar reftex-active-toc nil)
 (defvar reftex-tex-path nil)
 (defvar reftex-bib-path nil)
+(defvar reftex-last-follow-point nil)
 (defvar reftex-prefix)
 
 ;; List of buffers created temporarily for lookup, which should be killed.
  t i c # %  Toggle: [i]ncl. file borders, [t]able of contents,  [c]ontext
                     [#] label counters,   [%] labels in comments
  SPC / f    Show full context in other window / Toggle follow mode
- v / e      Toggle \\ref <-> \\vref  / Recursive Edit into other window
+ v   / .    Toggle \\ref <-> \\vref / Show insertion point in other window
  TAB        Enter a label with completion
- q / RET    Quit without accepting label / Accept current label")
+ q / RET    Quit without referencing / Accept current label (also on mouse-2)")
 
 (defvar reftex-select-label-map nil
   "Keymap used for *RefTeX Select* buffer, when selecting a label.
 This keymap can be used to configure the label selection process which is
 started with the command \\[reftex-reference].")
 
+(defun reftex-select-label-mode ()
+  "Major mode for selecting a label in a LaTeX document.
+This buffer was created with RefTeX.
+It only has a meaningful keymap when you are in the middle of a 
+selection process.
+To select a label, move the cursor to it and press RET.
+Press `?' for a summary of important key bindings.
+
+During a selection process, these are the local bindings.
+
+\\{reftex-select-label-map}"
+
+  (interactive)
+  (kill-all-local-variables)
+  (make-local-hook 'pre-command-hook)
+  (make-local-hook 'post-command-hook)
+  (setq major-mode 'reftex-select-label-mode
+	mode-name "RefTeX Select Label")
+  ;; We do not set a local map - reftex-select-item does this.
+  (run-hooks 'reftex-select-label-mode-hook))
+
 (defun reftex-reference (&optional type no-insert cut)
   "Make a LaTeX reference.  Look only for labels of a certain TYPE.
 With prefix arg, force to rescan buffer for labels.  This should only be
 	 label pair)
 
     ;; Have the user select a label
+    (set-marker reftex-select-return-marker (point))
     (setq pair (save-excursion
 		 (reftex-offer-label-menu type)))
+    (set-marker reftex-select-return-marker nil)
     (setq label (car pair)
 	  type  (cdr pair)
 	  form (or (cdr (assoc type reftex-typekey-to-format-alist))
             (save-window-excursion
 	      (delete-other-windows)
 	      (setq reftex-call-back-to-this-buffer buf)
-	      (if reftex-use-multiple-selection-buffers
-		  (switch-to-buffer-other-window
-		   (save-excursion
-		     (set-buffer buf)
-		     (reftex-make-selection-buffer-name typekey)))
-		(switch-to-buffer-other-window "*RefTeX Select*")
-		(erase-buffer))
+	      (let ((default-major-mode 'reftex-select-label-mode))
+		(if reftex-use-multiple-selection-buffers
+		    (switch-to-buffer-other-window
+		     (save-excursion
+		       (set-buffer buf)
+		       (reftex-make-selection-buffer-name typekey)))
+		  (switch-to-buffer-other-window "*RefTeX Select*")
+		  (reftex-erase-buffer)))
+	      (unless (eq major-mode 'reftex-select-label-mode)
+		(reftex-select-label-mode))
 	      (add-to-list 'selection-buffers (current-buffer))
               (setq truncate-lines t)
 	      (setq mode-line-format
 			  " -%-"))
 	      (cond
 	       ((= 0 (buffer-size))
-		(setq offset (reftex-make-and-insert-label-list
-			      typekey buf toc files context counter commented
-			      (or here-I-am offset) prefix)))
+		(let ((buffer-read-only nil))
+		  (setq offset (reftex-make-and-insert-label-list
+				typekey buf toc files context counter commented
+				(or here-I-am offset) prefix))))
 	       (here-I-am
 		(setq offset (reftex-get-offset buf here-I-am typekey)))
 	       (t (setq offset t)))
+	      (setq buffer-read-only t)
 	      (setq offset (or offset t))
 
               (setq here-I-am nil) ; turn off determination of offset
               (cond
 	       ((eq key ?g)
 		;; update buffer
-		(erase-buffer))
+		(reftex-erase-buffer))
                ((or (eq key ?r)
                     (eq key ?R))
                 ;; rescan buffer
-		(erase-buffer)
+		(reftex-erase-buffer)
                 (reftex-parse-document buf last-data key))
                ((eq key ?c)
                 ;; toggle context mode
-		(erase-buffer)
+		(reftex-erase-buffer)
                 (setq context (not context)))
                ((eq key ?s)
                 ;; switch type
                 (setq typekey (reftex-query-label-type)))
                ((eq key ?t)
                 ;; toggle table of contents display
-		(erase-buffer)
+		(reftex-erase-buffer)
                 (setq toc (not toc)))
                ((eq key ?i)
                 ;; toggle display of included file borders
-		(erase-buffer)
+		(reftex-erase-buffer)
                 (setq files (not files)))
                ((eq key ?#)
                 ;; toggle counter display
-		(erase-buffer)
+		(reftex-erase-buffer)
                 (setq counter (not counter)))
                ((eq key ?%)
                 ;; toggle display of commented labels
-		(erase-buffer)
+		(reftex-erase-buffer)
                 (setq commented (not commented)))
                ((eq key ?l)
                 ;; reuse the last referenced label again
          (context-indent
           (concat ".   "
                   (if toc (make-string (* 7 reftex-level-indent) ?\ ) "")))
+	 (mouse-face 
+	  (cond ((eq reftex-highlight-selection 'mouse) 'highlight)
+		((eq reftex-highlight-selection 'both) 'secondary-selection)
+		(t nil)))
          all cell text label typekey note comment master-dir-re
          offset from to docstruct-symbol)
 
             (insert context-indent text "\n")
             (setq to (point)))
           (put-text-property from to ':data cell)
+	  (when mouse-face
+	    (put-text-property from (1- to)
+			       'mouse-face mouse-face))	  
           (goto-char to)))))
 
     (when (reftex-refontify)
 (defvar reftex-toc-map (make-sparse-keymap)
   "Keymap used for *toc* buffer.")
 
+(defun reftex-toc-mode ()
+  "Major mode for managing Table of Contents for LaTeX files.
+This buffer was created with RefTeX.
+Press `?' for a summary of important key bindings.
+
+Here are all local bindings.
+
+\\{reftex-toc-map}"
+  (interactive)
+  (kill-all-local-variables)
+  (setq major-mode 'reftex-toc-mode
+	mode-name "RefTeX Table of Contents")
+  (use-local-map reftex-toc-map)
+  (set (make-local-variable 'revert-buffer-function) 'reftex-toc-revert)
+  (setq truncate-lines t)
+  (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)
+  (run-hooks 'reftex-toc-mode-hook))
+
 (defvar reftex-last-toc-master nil
   "Stores the name of the tex file that `reftex-toc' was last run on.")
 
 
   (if (or (not (string= reftex-last-toc-master (reftex-TeX-master-file)))
           current-prefix-arg)
-      (reftex-empty-toc-buffer))
+      (reftex-erase-buffer "*toc*"))
 
   (setq reftex-last-toc-file   (buffer-file-name))
   (setq reftex-last-toc-master (reftex-TeX-master-file))
 	 (xr-data (assq 'xr all))
 	 (xr-alist (cons (cons "" (buffer-file-name)) (nth 1 xr-data)))
          (where (reftex-nearest-section))
-         toc1 cell startpos)
+	 (mouse-face 
+ 	  (cond ((eq reftex-highlight-selection 'mouse) 'highlight)
+		((eq reftex-highlight-selection 'both) 'secondary-selection)
+		(t nil)))
+	 toc1 cell startpos)
 
     (if (get-buffer-window "*toc*")
         (select-window (get-buffer-window "*toc*"))
 	(delete-other-windows))
       (setq reftex-last-window-height (window-height))  ; remember
       (split-window)
-      (switch-to-buffer (get-buffer-create "*toc*")))
+      (let ((default-major-mode 'reftex-toc-mode))
+	(switch-to-buffer "*toc*")))
+
+    (or (eq major-mode 'reftex-toc-mode) (reftex-toc-mode))
 
     (cond
      ;; buffer is empty - fill it with the table of contents
      ((= (buffer-size) 0)
       (message "Building *toc* buffer...")
-      (make-local-variable 'revert-buffer-function)
-      (setq revert-buffer-function 'reftex-toc-revert)
-      (setq truncate-lines t)
-      (make-local-hook 'post-command-hook)
-      (make-local-hook 'pre-command-hook)
-      (setq post-command-hook '(reftex-toc-post-command-hook))
-      (setq pre-command-hook  '(reftex-toc-pre-command-hook))
-      (use-local-map reftex-toc-map)
-
+
+      (setq buffer-read-only nil)
       (insert (format
 "TABLE-OF-CONTENTS on %s
 SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [f]ollow-mode e[x]tern [?]Help
         (when (eq (car cell) 'toc)
           (setq toc1 (concat (nth 2 cell) "\n"))
           (put-text-property 0 (length toc1) 'toc cell toc1)
+	  (when mouse-face
+	    (put-text-property 0 (1- (length toc1))
+			       'mouse-face mouse-face toc1))
           (insert toc1)))
 
       (backward-delete-char 1)
     (beginning-of-line)
     (while (and (> (point) startpos)
                 (not (eq (get-text-property (point) 'toc) where)))
-      (beginning-of-line 0))))
+      (beginning-of-line 0))
+    (setq reftex-last-follow-point (point))))
 
 (defun reftex-nearest-section ()
   ;; Return (file . find) of nearest section command
 (defun reftex-toc-post-command-hook ()
   ;; used in the post-command-hook for the *toc* buffer
   (and (> (point) 1)
+       (memq reftex-highlight-selection '(cursor both))
        (save-excursion
          (reftex-highlight 1
                           (progn (beginning-of-line) (point))
    ((integerp reftex-toc-follow-mode)
     ;; remove delayed action
     (setq reftex-toc-follow-mode t))
-   (reftex-toc-follow-mode
+   ((and reftex-toc-follow-mode
+	 (not (equal reftex-last-follow-point (point))))
     ;; show context in other window
+    (setq reftex-last-follow-point (point))
     (condition-case nil
         (reftex-toc-visit-line nil (not reftex-revisit-to-follow))
       (error t)))))
 
-(defun reftex-empty-toc-buffer ()
-  (if (get-buffer "*toc*")
-      (save-excursion
-        (set-buffer "*toc*")
-        (setq buffer-read-only nil)
-        (erase-buffer))))
-
 (defun reftex-re-enlarge ()
   (enlarge-window
    (max 0 (- (or reftex-last-window-height (window-height))
   "View document location in other window."
   (interactive)
   (reftex-toc-visit-line))
+(defun reftex-toc-mouse-view-line (ev)
+  "View document location in other window."
+  (interactive "e")
+  (mouse-set-point ev)
+  (reftex-toc-visit-line))
 (defun reftex-toc-goto-line-and-hide ()
   "Go to document location in other window.  Hide the *toc* window."
   (interactive)
   (interactive)
   (switch-to-buffer-other-window
    (reftex-get-file-buffer-force reftex-last-toc-file))
-  (reftex-empty-toc-buffer)
+  (reftex-erase-buffer "*toc*")
   (setq current-prefix-arg nil)
   (reftex-toc))
 (defun reftex-toc-external (&rest ignore)
  g   / r    Start over with new regexp / Refine with additional regexp.
  SPC        Show full database entry in other window.
  f          Toggle follow mode: Other window will follow with full db entry.
+ .          Show insertion point.
  q          Quit without inserting \\cite macro into buffer.
- e          Recursive edit into other window.
  TAB        Enter citation key with completion.
- RET  / a   Accept current entry / Accept all entries.")
+ RET        Accept current entry (also on mouse-2)
+ a          Accept all entries.")
 
 (defvar reftex-select-bib-map nil
   "Keymap used for *RefTeX Select* buffer, when selecting a BibTeX entry.
 This keymap can be used to configure the BibTeX selection process which is
 started with the command \\[reftex-citation].")
 
+(defun reftex-select-bib-mode ()
+  "Major mode for selecting a citation key in a LaTeX document.
+This buffer was created with RefTeX.
+It only has a meaningful keymap when you are in the middle of a 
+selection process.
+In order to select a citation, move the cursor to it and press RET.
+Press `?' for a summary of important key bindings.
+
+During a selection process, these are the local bindings.
+
+\\{reftex-select-label-map}"
+  (interactive)
+  (kill-all-local-variables)
+  (make-local-hook 'pre-command-hook)
+  (make-local-hook 'post-command-hook)
+  (setq major-mode 'reftex-select-bib-mode
+	mode-name "RefTeX Select Bib")
+  ;; We do not set a local map - reftex-select-item does this.
+  (run-hooks 'reftex-select-bib-mode-hook))
+
 ;; Find bibtex files
 
 (defun reftex-get-bibfile-list ()
 
       ;; remember where we came from
       (setq reftex-call-back-to-this-buffer (current-buffer))
+      (set-marker reftex-select-return-marker (point))
 
       ;; offer selection
       (save-window-excursion
 	(delete-other-windows)
-        (switch-to-buffer-other-window "*RefTeX Select*")
-        (erase-buffer)
-        (reftex-insert-bib-matches found-list)
+	(let ((default-major-mode 'reftex-select-bib-mode))
+	  (switch-to-buffer-other-window "*RefTeX Select*")
+	  (unless (eq major-mode 'reftex-select-bib-mode)
+	    (reftex-select-bib-mode))
+	  (let ((buffer-read-only nil))
+	    (erase-buffer)
+	    (reftex-insert-bib-matches found-list)))
+	(setq buffer-read-only t)
         (if (= 0 (buffer-size))
             (error "Sorry, no matches found"))
         (setq truncate-lines t)
                           (set-buffer reftex-call-back-to-this-buffer)
                           (reftex-extract-bib-entries
                            (reftex-get-bibfile-list))))
-                  (erase-buffer)
-                  (reftex-insert-bib-matches found-list)
+		  (let ((buffer-read-only nil))
+		    (erase-buffer)
+		    (reftex-insert-bib-matches found-list))
                   (if (= 0 (buffer-size))
                       (error "Sorry, no matches found"))
                   (goto-char 1))
                   (if found-list-r
                       (setq found-list found-list-r)
                     (ding))
-                  (erase-buffer)
-                  (reftex-insert-bib-matches found-list)
+		  (let ((buffer-read-only nil))
+		    (erase-buffer)
+		    (reftex-insert-bib-matches found-list))
                   (goto-char 1))
                  ((eq key ?a)
                   (setq entry 'all)
 			(reftex-format-citation entry format)))))
           (setq ins-string "")
           (message "Quit")))
+      (set-marker reftex-select-return-marker (point))
       (kill-buffer "*RefTeX Select*")
 
       (unless no-insert
 
 (defun reftex-insert-bib-matches (list)
   ;; Insert the bib matches and number them correctly
-  (let (tmp)
+  (let ((mouse-face 
+	 (cond ((eq reftex-highlight-selection 'mouse) 'highlight)
+	       ((eq reftex-highlight-selection 'both) 'secondary-selection)
+	       (t nil)))
+	tmp len)    
     (mapcar 
      (function
       (lambda (x)
-	(setq tmp (cdr (assoc "&formatted" x)))
-	(put-text-property 0 (length tmp) ':data x tmp)
+	(setq tmp (cdr (assoc "&formatted" x))
+	      len (length tmp))
+	(put-text-property 0 len ':data x tmp)
+	(put-text-property 0 (1- len) 'mouse-face mouse-face tmp)
 	(insert tmp)))
      list)))
 
   (if (marker-position reftex-recursive-edit-marker)
       (error
        (substitute-command-keys
-        "In unfinished recursive edit. Finish (\\[exit-recursive-edit]) or abort (\\[abort-recursive-edit])."))))
+        "In unfinished selection process. Finish, or abort with \\[abort-recursive-edit]."))))
 
 (defun reftex-select-item (prompt help-string keymap
 				  &optional offset
 ;; When MATCH-EVERYWHERE is t, searches will also match in non-selectable
 ;; places.
 
-  (let* (key-sq b e ev data last-data cmd skip-callback
-		(orig-buffer (current-buffer))
-		(search-str "") last-cmd callback-fwd)
+  (let* (ev data last-data callback-fwd)
 
     (setq ev
-          (catch 'exit
+          (catch 'myexit
             (save-window-excursion
               (setq truncate-lines t)
 
 		     (point-min))))
 	       (t (goto-char (point-min))))
               (beginning-of-line 1)
+	      (set (make-local-variable 'reftex-last-follow-point) (point))
 
       (unwind-protect
 	  (progn
 	    (use-local-map keymap)
-	    (while t
-	      (setq data (get-text-property (point) ':data))
-	      (setq last-data (or data last-data))
-
-	      (if (and data cb-flag call-back (not skip-callback))
-		  (funcall call-back data callback-fwd 
-			   (not reftex-revisit-to-follow)))
-	      (setq skip-callback nil)
-	      (if data
-		  (setq b (or (previous-single-property-change
-			       (1+ (point)) ':data)
-			      (point-min))
-			e (or (next-single-property-change
-			       (point) ':data)
-			      (point-max)))
-		(setq b (point) e (point)))
-	      (reftex-highlight 1 b e)
-	      (if (or (not (pos-visible-in-window-p b))
-		      (not (pos-visible-in-window-p e)))
-		  (recenter (/ (window-height) 2)))
-	      
-	      (setq last-cmd cmd
-		    cmd nil)
-
-	      (setq key-sq (read-key-sequence prompt))
-	      (setq cmd (lookup-key keymap key-sq))
-
-	      (reftex-unhighlight 2)
-	      (reftex-unhighlight 1)
-	      (reftex-unhighlight 0)
-
-	      (if cmd
-		  (condition-case nil
-		      (progn
-			(command-execute cmd)
-			;FIXME: (run-hooks 'post-command-hook)
-			)
-		    (error (ding)))
-		(ding))
-
-	      (unless (equal (current-buffer) orig-buffer)
-		(error "Selection commands must return to *RefTeX Select* buffer."))))
-	(use-local-map nil)))))
+	    (add-hook 'pre-command-hook 'reftex-select-pre-command-hook nil t)
+	    (add-hook 'post-command-hook 'reftex-select-post-command-hook nil t)
+	    (princ prompt)
+	    (set-marker reftex-recursive-edit-marker (point))
+	    (run-hooks 'post-command-hook)  ;; because XEmacs does not do it
+	    (recursive-edit))
+
+	(use-local-map nil)
+	(remove-hook 'pre-command-hook 'reftex-select-pre-command-hook t)
+	(remove-hook 'post-command-hook 'reftex-select-post-command-hook t)
+	(set-marker reftex-recursive-edit-marker nil)))))
 
     (set (make-local-variable 'reftex-last-line)
 	 (+ (count-lines (point-min) (point)) (if (bolp) 1 0)))
     (set (make-local-variable 'reftex-last-data) last-data)
-    (and (get-buffer "*RefTeX Help*") (kill-buffer "*RefTeX Help*"))
+    (reftex-kill-buffer "*RefTeX Help*")
     (message "")
     (list ev data last-data)))
 
 ;; The following variables are all bound dynamically in `reftex-select-item'.
 ;; The defvars are here only to silence the byte compiler.
 
-(defvar last-cmd)
 (defvar found-list)
 (defvar cb-flag)
 (defvar data)
+(defvar prompt)
+(defvar last-data)
 (defvar call-back)
 (defvar help-string)
-(defvar skip-callback)
-(defvar search-str)
 (defvar match-everywhere)
-(defvar forward)
-(defvar keymap)
 (defvar callback-fwd)
 (defvar varioref)
-(defconst reftex-select-search-minibuffer-map
-  (let ((map (copy-keymap minibuffer-local-map)))
-    (define-key map "\C-s"
-      (function (lambda() (interactive) (setq forward t) (exit-minibuffer))))
-    (define-key map "\C-r"
-      (function (lambda() (interactive) (setq forward nil) (exit-minibuffer))))
-    (define-key map "\C-m" 'exit-minibuffer)
-    map))
 
 ;; The selection commands
 
-(defun reftex-select-next ()
-  (interactive)
+(defun reftex-select-pre-command-hook ()
+  (reftex-unhighlight 1)
+  (reftex-unhighlight 0))
+
+(defun reftex-select-post-command-hook ()
+  (let (b e)
+    (setq data (get-text-property (point) ':data))
+    (setq last-data (or data last-data))
+  
+    (when (and data cb-flag
+	       (not (equal reftex-last-follow-point (point))))
+      (setq reftex-last-follow-point (point))
+      (funcall call-back data callback-fwd 
+	       (not reftex-revisit-to-follow)))
+    (if data
+	(setq b (or (previous-single-property-change
+		     (1+ (point)) ':data)
+		    (point-min))
+	      e (or (next-single-property-change
+		     (point) ':data)
+		    (point-max)))
+      (setq b (point) e (point)))
+    (and (memq reftex-highlight-selection '(cursor both))
+	 (reftex-highlight 1 b e))
+    (if (or (not (pos-visible-in-window-p b))
+	    (not (pos-visible-in-window-p e)))
+	(recenter (/ (window-height) 2)))
+    (when (and (fboundp 'current-message)
+	       (not (current-message)))
+      (princ prompt))))
+
+(defun reftex-select-next (&optional arg)
+  (interactive "p")
   (setq callback-fwd t)
   (or (eobp) (forward-char 1))
-  (re-search-forward "^[^. \t\n\r]" nil t 1)
+  (re-search-forward "^[^. \t\n\r]" nil t arg)
   (beginning-of-line 1))
-(defun reftex-select-previous ()
-  (interactive)
+(defun reftex-select-previous (&optional arg)
+  (interactive "p")
   (setq callback-fwd nil)
-  (re-search-backward "^[^. \t\n\r]" nil t))
-(defun reftex-select-scroll-up ()
-  (interactive)
-  (setq callback-fwd t)
-  (while (and (pos-visible-in-window-p)
-	      (re-search-forward "^[^. \t\n\r]" nil t)))
-  (beginning-of-line 1)
-  (recenter 1))
-(defun reftex-select-scroll-down ()
-  (interactive)
-  (setq callback-fwd nil)
-  (while (and (pos-visible-in-window-p)
-	      (re-search-backward "^[^. \t\n\r]" nil t)))
-  (recenter (- (window-height) 4)))
-(defun reftex-select-next-heading ()
-  (interactive)
+  (re-search-backward "^[^. \t\n\r]" nil t arg))
+(defun reftex-select-next-heading (&optional arg)
+  (interactive "p")
   (end-of-line)
-  (re-search-forward "^ " nil t)
+  (re-search-forward "^ " nil t arg)
   (beginning-of-line))
-(defun reftex-select-previous-heading ()
-  (interactive)
-  (re-search-backward "^ " nil t))
-(defun reftex-select-scroll-other-window ()
-  (interactive)
-  (setq skip-callback t)
-  (scroll-other-window))
-(defun reftex-select-scroll-other-window-down ()
-  (interactive)
-  (setq skip-callback t)
-  (scroll-other-window-down nil))
+(defun reftex-select-previous-heading (&optional arg)
+  (interactive "p")
+  (re-search-backward "^ " nil t arg))
 (defun reftex-select-quit ()
   (interactive)
-  (throw 'exit nil))
+  (throw 'myexit nil))
+(defun reftex-select-keyboard-quit ()
+  (interactive)
+  (throw 'exit t))
 (defun reftex-select-jump-to-previous ()
   (interactive)
   (let (pos)
       (setq varioref "\\vref")
     (setq varioref "\\ref"))
   (force-mode-line-update))
+(defun reftex-select-show-insertion-point ()
+  (interactive)
+  (let ((this-window (selected-window)))
+    (unwind-protect
+	(progn
+	  (switch-to-buffer-other-window
+	   (marker-buffer reftex-select-return-marker))
+	  (goto-char (marker-position reftex-select-return-marker))
+	  (recenter (/ (window-height) 2)))
+      (select-window this-window))))
 (defun reftex-select-callback ()
   (interactive)
   (if data (funcall call-back data callback-fwd nil) (ding)))
 (defun reftex-select-accept ()
   (interactive)
-  (throw 'exit 'return))
+  (throw 'myexit 'return))
+(defun reftex-select-mouse-accept (ev)
+  (interactive "e")
+  (mouse-set-point ev)
+  (setq data (get-text-property (point) ':data))
+  (setq last-data (or data last-data))
+  (throw 'myexit 'return))
 (defun reftex-select-read-label ()
   (interactive)
   (let ((label (completing-read 
 		"Label: " (symbol-value reftex-docstruct-symbol)
 		nil nil reftex-prefix)))
     (unless (or (equal label "") (equal label reftex-prefix))
-      (throw 'exit label))))
+      (throw 'myexit label))))
 (defun reftex-select-read-cite ()
   (interactive)
   (let* ((list (mapcar (lambda (x) 
 		       found-list))
 	 (key (completing-read "Citation key: " list)))
     (unless (equal key "")
-      (throw 'exit key))))
+      (throw 'myexit key))))
 (defun reftex-select-help ()
   (interactive)
   (with-output-to-temp-buffer "*RefTeX Help*"
     (princ help-string))
-  (reftex-enlarge-to-fit "*RefTeX Help*" t)
-  (setq skip-callback t))
-(defun reftex-select-recursive-edit ()
-  (interactive)
-  (set-marker reftex-recursive-edit-marker (point))
-  (unwind-protect
-      (progn
-	(save-window-excursion
-	  (save-excursion
-	    (other-window 1)
-	    (message
-	     (substitute-command-keys
-	      "Recursive edit.  Return to selection with \\[exit-recursive-edit]"))
-	    (recursive-edit)))
-	(unless (equal (marker-buffer
-			reftex-recursive-edit-marker)
-		       (current-buffer))
-	  (error "Cannot continue RefTeX from this buffer."))
-	(goto-char reftex-recursive-edit-marker))
-    (set-marker reftex-recursive-edit-marker nil)))
-
-(defun reftex-select-search-forward ()
-  (interactive)
-  (reftex-select-search t))
-(defun reftex-select-search-backward ()
-  (interactive)
-  (reftex-select-search nil))
-(defun reftex-select-search (forward)
-  (let (tmp search-start matched)
-    (if (or (and (not (eq last-cmd 'reftex-select-search-forward))
-		 (not (eq last-cmd 'reftex-select-search-backward)))
-	    (string= search-str ""))
-	(setq tmp				; get a new string
-	      (read-from-minibuffer
-	       (if (string= search-str "")
-		   "Search: "
-		 (format "Search [%s]:" search-str))
-	       nil reftex-select-search-minibuffer-map)
-	      search-str (if (string= tmp "")
-			     search-str tmp)))
-    (setq search-start (point))
-    (and (not (string= search-str ""))
-	 (progn
-	   (while
-	       (and (setq matched
-			  (if forward
-			      (search-forward search-str nil 1)
-			    (search-backward search-str nil 1)))
-		    (or (>= (save-excursion
-			      (goto-char (match-beginning 0))
-			      (current-column))
-			    (window-width))
-			(not (or (get-text-property (point) ':data)
-				 match-everywhere)))))
-	   (if matched
-	       (reftex-highlight 2 (match-beginning 0)
-				 (match-end 0))
-	     (ding)
-	     (goto-char search-start))))))
+  (reftex-enlarge-to-fit "*RefTeX Help*" t))
 
 ;;; ===========================================================================
 ;;;
     (buffer-substring-no-properties (match-beginning n) (match-end n))))
 
 (defun reftex-kill-buffer (buffer)
-;; Kill buffer if it exists.
+  ;; Kill buffer if it exists.
   (and (setq buffer (get-buffer buffer))
        (kill-buffer buffer)))
 
-(defun reftex-erase-buffer (buffer)
-;; Erase buffer if it exists.
-  (and (setq buffer (get-buffer buffer))
-       (save-excursion
-	 (set-buffer buffer)
-	 (erase-buffer))))
+(defun reftex-erase-buffer (&optional buffer)
+  ;; Erase BUFFER if it exists.  BUFFER defaults to current buffer.
+  ;; This even erases read-only buffers.
+  (cond
+   ((null buffer)
+    ;; erase current buffer
+    (let ((buffer-read-only nil)) (erase-buffer)))
+   ((setq buffer (get-buffer buffer))
+    ;; buffer exists
+    (save-excursion
+      (set-buffer buffer)
+      (let ((buffer-read-only nil)) (erase-buffer))))))
 
 (defun reftex-this-word (&optional class)
   ;; Grab the word around point.
              (let ((format-alist nil)
                    (auto-mode-alist (reftex-auto-mode-alist))
                    (default-major-mode 'fundamental-mode)
+		   (enable-local-variables nil)
                    (after-insert-file-functions nil))
                (setq buf (find-file-noselect file)))
 
         (error "RefTeX needs overlay emulation (available in XEmacs 19.15)"))))
 
 ;; We keep a vector with several different overlays to do our highlighting.
-(defvar reftex-highlight-overlays [nil nil nil])
+(defvar reftex-highlight-overlays [nil nil])
 
 ;; Initialize the overlays
 (aset reftex-highlight-overlays 0 (make-overlay 1 1))
 (overlay-put (aref reftex-highlight-overlays 0) 'face 'highlight)
 (aset reftex-highlight-overlays 1 (make-overlay 1 1))
 (overlay-put (aref reftex-highlight-overlays 1) 'face 'highlight)
-(aset reftex-highlight-overlays 2 (make-overlay 1 1))
-(overlay-put (aref reftex-highlight-overlays 2) 'face
-             (if (string-match "XEmacs" emacs-version) 'zmacs-region 'region))
 
 ;; Two functions for activating and deactivation highlight overlays
 (defun reftex-highlight (index begin end &optional buffer)
   "Reset the symbols containing information from buffer scanning.
 This enforces rescanning the buffer on next use."
   (if (string= reftex-last-toc-master (reftex-TeX-master-file))
-      (reftex-empty-toc-buffer))
+      (reftex-erase-buffer "*toc*"))
   (let ((symlist reftex-multifile-symbols)
         symbol)
     (while symlist
   (substitute-key-definition
    'previous-line 'reftex-select-previous	       map global-map)
   (substitute-key-definition
-   'scroll-up 'reftex-select-scroll-up		       map global-map)
-  (substitute-key-definition
-   'scroll-down 'reftex-select-scroll-down	       map global-map)
-  (substitute-key-definition
-   'scroll-other-window 'reftex-select-scroll-other-window map global-map)
-  (substitute-key-definition
-   'scroll-other-window-down 'reftex-select-scroll-other-window-down map global-map)
-  (substitute-key-definition
-   'beginning-of-buffer 'beginning-of-buffer	       map global-map)
-  (substitute-key-definition
-   'end-of-buffer 'end-of-buffer		       map global-map)
-  (substitute-key-definition
-   'keyboard-quit 'keyboard-quit                       map global-map)
+   'keyboard-quit 'reftex-select-keyboard-quit         map global-map)
   (substitute-key-definition
    'newline 'reftex-select-accept		       map global-map)
-  (substitute-key-definition
-   'delete-other-windows 'delete-other-windows	       map global-map)
   (define-key map " "        'reftex-select-callback)
   (define-key map "n"        'reftex-select-next)
   (define-key map [(down)]   'reftex-select-next)
   (define-key map "f"        'reftex-select-toggle-follow)
   (define-key map "\C-m"     'reftex-select-accept)
   (define-key map [(return)] 'reftex-select-accept) 
-  (define-key map "\C-s"     'reftex-select-search-forward)
-  (define-key map "\C-r"     'reftex-select-search-backward)
-  (define-key map "e"        'reftex-select-recursive-edit)
   (define-key map "q"        'reftex-select-quit)
+  (define-key map "."        'reftex-select-show-insertion-point)
   (define-key map "?"        'reftex-select-help)
+  (if (string-match "XEmacs" emacs-version)
+      (define-key map [(button2)] 'reftex-select-mouse-accept) ; XEmacs
+    (define-key map [(mouse-2)] 'reftex-select-mouse-accept))  ; Emacs
+
+  (loop for key across "0123456789" do
+	(define-key map (vector (list key)) 'digit-argument))
+  (define-key map "-" 'negative-argument)
 
   (setq reftex-select-label-map map)
   (setq reftex-select-bib-map (copy-keymap map))
 
   (loop for key across "cgilrRstx#%" do
 	(define-key reftex-select-label-map (vector (list key))
-	  (list 'lambda '() '(interactive) (list 'throw '(quote exit) key))))
+	  (list 'lambda '() '(interactive) (list 'throw '(quote myexit) key))))
   (define-key reftex-select-label-map "b"     'reftex-select-jump-to-previous)
   (define-key reftex-select-label-map "v"     'reftex-select-toggle-varioref)
   (define-key reftex-select-label-map [(tab)] 'reftex-select-read-label)
 
   (loop for key across "grRa" do
 	(define-key reftex-select-bib-map (vector (list key))
-	  (list 'lambda '() '(interactive) (list 'throw '(quote exit) key))))
+	  (list 'lambda '() '(interactive) (list 'throw '(quote myexit) key))))
   (define-key reftex-select-bib-map "\C-i" 'reftex-select-read-cite)
   (define-key reftex-select-bib-map [(tab)] 'reftex-select-read-cite))
 
 ;; Table of Contents map
 (let ((map reftex-toc-map))
-  (define-key map  [(mouse-2)] 'reftex-toc-mouse-goto-line-and-hide); Emacs
-  (define-key map  [(button2)] 'reftex-toc-mouse-goto-line-and-hide); XEmacs
+  (if (string-match "XEmacs" emacs-version)
+      (define-key map  [(button2)] 'reftex-toc-mouse-goto-line-and-hide);XEmacs
+    (define-key map  [(mouse-2)] 'reftex-toc-mouse-goto-line-and-hide)) ;Emacs
   (define-key map  "n"         'next-line)
   (define-key map  "p"         'previous-line)
   (define-key map  "?"         'reftex-toc-show-help)
 
 (provide 'reftex) 
 
-; Make sure tables are compiled
-(message "updating internal tables...")
-(reftex-compute-ref-cite-tables)
-(message "updating internal tables...done")
-(setq reftex-tables-dirty nil)
-
 ;;;============================================================================
 
 ;;; reftex.el ends here
 @c %**start of header
 @c $Id$
 @setfilename reftex
-@settitle RefTeX User User Manual
+@settitle RefTeX User Manual
 @synindex ky cp
 @syncodeindex vr cp
 @syncodeindex fn cp
+@direntry
+* RefTeX::      Emacs support for LaTeX cross-references, citations...
+@end direntry
 @c %**end of header
 @finalout
 
 This file documents @b{RefTeX}, a package to do labels, references and
 citations for LaTeX documents with Emacs.@refill
 
-This is edition 1.17 of the @b{RefTeX} User Manual for @b{RefTeX} 3.17
-
-Copyright (c) 1997, 1998 Carsten Dominik <dominik@@strw.LeidenUniv.nl>
+This is edition 1.18 of the @b{RefTeX} User Manual for @b{RefTeX} 3.18
+
+Copyright (c) 1997, 1998 Free Software Foundation, Inc.
+
+Permission is granted to make and distribute verbatim
+copies of this manual provided the copyright notice and
+this permission notice are preserved on all copies.
+     
+@ignore
+Permission is granted to process this file through TeX
+and print the results, provided the printed document
+carries a copying permission notice identical to this
+one except for the removal of this paragraph (this
+paragraph not being relevant to the printed manual).
+     
+@end ignore
+Permission is granted to copy and distribute modified
+versions of this manual under the conditions for
+verbatim copying, provided that the entire resulting
+derive work is distributed under the terms of a permission
+notice identical to this one.
+     
+Permission is granted to copy and distribute
+translations of this manual into another language,
+under the above conditions for modified versions,
+except that this permission notice may be stated in a
+translation approved by the Free Software Foundation.
 @end ifinfo
 
 @titlepage
 @title RefTeX User Manual
 @subtitle Support for LaTeX labels, references, and citations with GNU Emacs
-@subtitle Edition 1.17, January 1997
+@subtitle Edition 1.18, February 1998
 
 @author by Carsten Dominik
 @page
-Copyright @copyright{} 1997, 1998 Carsten Dominik @t{<dominik@@strw.LeidenUniv.nl>}
+Copyright @copyright{} 1997, 1998 Free Software Foundation, Inc.
 
 @sp 2
-This is edition 1.17 of the @cite{RefTeX User Manual} for @b{RefTeX}
-version 3.17, January 1998.@refill
+This is edition 1.18 of the @cite{RefTeX User Manual} for @b{RefTeX}
+version 3.18, February 1998.@refill
 
 @sp 2
 
-Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on  all copies.@refill
-
-Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.@refill
-
-Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that this permission notice may be stated in a
-translation approved by the author.@refill
+Permission is granted to make and distribute verbatim
+copies of this manual provided the copyright notice and
+this permission notice are preserved on all copies.
+     
+Permission is granted to copy and distribute modified
+versions of this manual under the conditions for
+verbatim copying, provided that the entire resulting
+derive work is distributed under the terms of a permission
+notice identical to this one.
+     
+Permission is granted to copy and distribute
+translations of this manual into another language,
+under the above conditions for modified versions,
+except that this permission notice may be stated in a
+translation approved by the Free Software Foundation.
 
 @end titlepage
 @page
 @file{reftex.html}).
 
 @section Entering RefTeX Minor Mode
+
 @findex turn-on-reftex
 @findex reftex-mode
 To turn @b{RefTeX} Minor Mode on and off in a particular buffer, use
 @cindex @code{\label}
 
 LaTeX provides a powerful mechanism to deal with cross references in a
-file.  When writing a document, any part of it can be marked with a
+document.  When writing a document, any part of it can be marked with a
 label, like @samp{\label@{mark@}}.  LaTeX records the current value of a
 certain counter when a label is defined.  Later references to this label
 (like @samp{\ref@{mark@}}) will produce the recorded value of the
 variable @var{reftex-insert-label-flags} (@pxref{Options (Creating
 Labels)}).@refill
 
+@page
 @node Referencing Labels, Builtin Label Environments, Creating Labels, Labels and References
 @section Referencing Labels
 @cindex Referencing labels
 label, pressing @kbd{SPC} will show the label definition point in
 another window.@refill
 
-In order to reference a label, move to cursor to the correct label
-and press @kbd{RET}.@*
-Here is a list of commands available in the selection buffer.  A summary
-of this information is always available from the selection process by
-pressing @kbd{?}.@refill
+In order to reference a label, move to cursor to the correct label and
+press @kbd{RET}.@* Here is a list of special commands available in the
+selection buffer.  A summary of this information is always available
+from the selection process by pressing @kbd{?}.@refill
 
 @table @kbd
+@item 0-9,-
+Prefix argument.
 @item Cursor
-All normal cursor motions are available to move through the buffer.
-This includes scrolling and @code{beginning-of-buffer},
-@code{end-of-buffer}.@refill
+All normal cursor motions are available to move through the
+buffer.@refill
 
 @item b
 Jump back to the position where you last left the selection buffer.
 document and let you select a label from there (@pxref{xr (LaTeX
 package),,xr}).@refill
 
+@item .
+Show insertion point in another window.  This is the point from where you
+called @code{reftex-reference}.@refill
+
 @item TAB
 Enter a label with completion.  This may also be a label which does not
 yet exist in the document.
 Insert a reference to the label at point into the buffer from which the
 selection process was started.@refill
 
+@item mouse-2
+Clicking with mouse button 2 on a label will accept it like @key{RET}
+would. See also variable @var{reftex-highlight-selection}, @ref{Options
+(Misc)}.@refill
+
 @item #
 Toggle the display of a label counter in the selection buffer.@refill
 
 Goto next section heading (like outline mode).
 
 @item C-c C-p
-Goto next section heading (like outline mode).
-
-@item C-s / C-r
-Search forward/backward.  This works almost like incremental search -
-subsequent @kbd{C-s}/@kbd{C-r} will find other occurrences of the same
-search string.@refill
+Goto previous section heading (like outline mode).
 
 @end table
 
 @code{longtable} (@file{longtable.sty})
 @item
 @cindex @code{picinpar}, LaTeX package
-@cindex LaTeX packages, picinpar
+@cindex LaTeX packages, @code{picinpar}
 @cindex @code{figwindow}, LaTeX environment
 @cindex @code{tabwindow}, LaTeX environment
 @code{figwindow}, @code{tabwindow} (@file{picinpar.sty})
 @item
+@cindex @code{sidecap}, LaTeX package
+@cindex LaTeX packages, @code{sidecap}
+@cindex @code{SCfigure}, LaTeX environment
+@cindex @code{SCtable}, LaTeX environment
+@item
 @cindex @code{rotating}, LaTeX package
 @cindex LaTeX packages, @code{rotating}
 @cindex @code{sidewaysfigure}, LaTeX environment
 external documents by using the prefixes @samp{V1-} and @samp{V3-},
 respectively.@refill
 
-@b{RefTeX} can be used to create such labels as well.  Start the
+@b{RefTeX} can be used to create such references as well.  Start the
 referencing process normally, by pressing @kbd{C-c )}.  Select a label
 type if necessary.  When you see the label selection buffer, pressing
 @kbd{x} will switch to the label selection buffer of one of the external
 references with page information.  When you want to make a reference
 with the @code{\vref} macro, just press the @kbd{v} key in the selection
 buffer to toggle between the @code{\ref} and @code{\vref}
-(@pxref{Referencing Labels}.  The mode line of the selection buffer
+(@pxref{Referencing Labels}).  The mode line of the selection buffer
 shows the current status of this switch.  If you find that you almost
 always use @code{\vref}, you may want to make it the default by
 customizing the variable @var{reftex-vref-is-default}@refill
 @node Citations, Table of Contents, Labels and References, Top
 @chapter Citations
 @cindex Citations
+@cindex @code{\cite}
 
 Citations in LaTeX are done with the @code{\cite} macro or variations of
 it.  The argument of the macro is a citation key which identifies a piece
-literature in either a BibTeX database file or in an explicit
+of literature in either a BibTeX database file or in an explicit
 @code{thebibliography} environment in the document.  @b{RefTeX}'s support
 for citations helps to select the correct key quickly.@refill
 
 @code{\bibitems}, not the structured listing available with BibTeX
 database files.@refill
 
-In the selection buffer, the following keys are available to find and
-select an article.  A summary of this information is always
-available from the selection process by pressing @kbd{?}.@refill
+In the selection buffer, the following keys provide special commands.  A
+summary of this information is always available from the selection
+process by pressing @kbd{?}.@refill
 
 @table @kbd
+@item 0-9,-
+Prefix argument.
 @item Cursor
-All normal cursor motions are available to move through the buffer.
-This includes scrolling and @code{beginning-of-buffer},
-@code{end-of-buffer}.@refill
+All normal cursor motions are available to move through the
+buffer.@refill
 
 @item a
 Accept all entries in the selection buffer and create @code{\cite}
 macros referring to them.@refill
 
-@item e
-Start a recursive edit in the other window (which usually displays the
-full database entry when using this).  See @key{SPC} and @kbd{f}
-keys.@refill
-
 @item f
 Toggle follow mode.  When follow mode is active, the other window will
 always display the full database entry of the current article.  This is
 Go to previous article.
 
 @item q
-Exit the selection process without inserting any citation into the
+Exit the selection process without inserting a citation into the
 buffer.@refill
 
 @item r
 @emph{not} rescan the entire database, but just the already selected
 entries.@refill
 
+@item .
+Show insertion point in another window.  This is the point from where you
+called @code{reftex-citation}.@refill
+
+
 @item TAB
 Enter a citation key with completion.  This may also be a key which does
 not yet exist.
 the other window are also available.@refill
 
 @item RET
-Insert a citation to the article at point into the buffer from which the
-selection process was started.@refill
-
-@item C-s / C-r
-Search forward/backward.  This works almost like incremental search -
-subsequent @kbd{C-s}/@kbd{C-r} will find other occurrences of the same
-search string.@refill
+Insert a citation referencing the article at point into the buffer from
+which the selection process was started.@refill
+
+@item mouse-2
+Clicking with mouse button 2 on a citation will accept it like @key{RET}
+would.  See also variable @var{reftex-highlight-selection}, @ref{Options
+(Misc)}.@refill
 
 @item ?
 Show a summary of the available keys.
 When you press @kbd{C-c =}, @b{RefTeX} will pop up a buffer showing the
 table of contents of the document.  With the cursor in any of the lines
 denoting a section, simple key strokes will jump to that section or
-perform other actions.  Here is a list of available commands.  A summary
-of this information is always available by pressing @kbd{?}.@refill
+perform other actions.  Here is a list of available special commands.  A
+summary of this information is always available by pressing
+@kbd{?}.@refill
 
 @table @kbd
 
 @item x
 Switch to the @samp{*toc*} buffer of an external document.  When the
 current document is using the @code{xr} package (@pxref{xr (LaTeX
-package)}), @b{RefTeX} will switch to one of these external
+package)}), @b{RefTeX} will switch to one of the external
 documents.@refill
 
 @item SPC
 @item RET
 Go to the section and hide the @samp{*toc*} buffer.  This will restore
 the window configuration before @code{reftex-toc} (@kbd{C-c =}) was
-called. @refill
+called.@refill
+
+@item mouse-2
+Clicking with mouse button 2 on a line has the same effect as @key{RET}.
+See also variable @var{reftex-highlight-selection}, @ref{Options
+(Misc)}.@refill
 @end table
 
 In order to define additional commands for the @samp{*toc*} buffer, the
 @kbd{C-c =}    @code{reftex-toc}
 @kbd{C-c (}    @code{reftex-label}
 @kbd{C-c )}    @code{reftex-reference}
-@kbd{C-c [}    @code{reftex-view-crossref}
+@kbd{C-c [}    @code{reftex-citation}
+@kbd{C-c &}    @code{reftex-view-crossref}
 @end example
 
 These keys were chosen to avoid interfering with AUCTeX's settings.
 (TeX-add-style-hook "myprop"
   (function
    (lambda ()
-     (if (featurep 'reftex)
-         (setq reftex-cite-format 'harvard)))))
+     (and (featurep 'reftex) (setq reftex-cite-format 'harvard)))))
 @end lisp
 
 @node Bib-Cite, , AUCTeX, Social Matters
 ftp://ftp.phys.ocean.dal.ca/users/rhogee/elisp/bib-cite.el
 @end example
 
-Bib-cite versions 3.06 and later can be configured so that bib-cite's
+Bib-cite version 3.06 and later can be configured so that bib-cite's
 mouse functions use @b{RefTeX} for displaying references and citations.
 This can be useful in particular when working with the LaTeX @code{xr}
 package or with an explicit @code{thebibliography} environment (rather
 @end lisp
 
 @b{RefTeX} will then occasionally annotate new labels in the selection
-buffer, saying that their position in the label list in uncertain.  I
-manual document scan will fix this.
+buffer, saying that their position in the label list in uncertain.  A
+manual document scan will fix this.@refill
 
 @item
 @b{Multiple Selection Buffers}@*
 @cindex Selection buffers, updating
 You can also inhibit the automatic updating entirely.  Then the
 selection buffer will always pop up very fast, but may not contain the
-most recently defined labels.  You can always update the buffer hand,
+most recently defined labels.  You can always update the buffer by hand,
 with the @kbd{g} key.  To get this behavior, use instead@refill
 
 @vindex reftex-auto-update-selection-buffers
 @cindex Overlays, problems with XEmacs 19.15
 In XEmacs 19.15, the overlay library has a bug.  @b{RefTeX} does not
 suffer from it, but since it loads the library, other packages like
-GNUS will switch from extents to overlays and hit the bug.  Upgrade
+GNUS will switch from extends to overlays and hit the bug.  Upgrade
 to XEmacs 20, or fix the overlay library (in line 180 of overlay.el,
 change @code{(list before after)} to @code{(cons before after)}).@refill
 
 @cindex Viper mode
 @cindex Keybindings, problems with Viper mode
 @findex viper-harness-minor-mode
-If you use @i{Viper} mode, you need to protect @b{RefTeX}'s keymaps
-with@refill
+If you use @i{Viper} mode prior to Vipers version 3.01, you need to
+protect @b{RefTeX}'s keymaps with@refill
 
 @lisp
 (viper-harness-minor-mode "reftex")
 @end example
 
 @noindent
-The version at this site is actually compatible with Emacs 19 - the
+The version at this site is actually compatible with Emacs 19; the
 versions of @b{RefTeX} distributed with Emacs 20 are not.@refill
 
 Thanks to the people on the Net who have used @b{RefTeX} and helped
 @end defopt
 
 @defopt reftex-label-alist
-Set this variable to define additions and changes to the default.  The
-only things you @emph{must not} change is that @code{?s} is the type
-indicator for section labels, and @key{SPC} for the @code{any} label
-type.  These are hard-coded at other places in the code.@refill
+Set this variable to define additions and changes to the defaults in
+@var{reftex-default-label-alist-entries}.  The only things you
+@emph{must not} change is that @code{?s} is the type indicator for
+section labels, and @key{SPC} for the @code{any} label type.  These are
+hard-coded at other places in the code.@refill
 
 The value of the variable must be a list of items.  Each item is a list
 itself and has the following structure:
 If a string, use as regexp to search @emph{backward} from the label.
 Context is then the text following the end of the match.  E.g. putting
 this to @samp{\\caption[@{]]} will use the caption in a figure or table
-environment.  @samp{\\begin@{eqnarray@}\\|\\\\} works for
+environment.  @samp{\\begin@{eqnarray@}\|\\\\} works for
 eqnarrays.@refill
 @item
 If any of @code{caption}, @code{item}, @code{eqnarray-like},
 @end defopt
 
 @defopt reftex-section-levels
-Commands and levels used for defining sections in the document.  The car
-of each cons cell is the name of the section macro.  The cdr is a number
-indicating its level.@refill
+Commands and levels used for defining sections in the document.  The
+@code{car} of each cons cell is the name of the section macro.  The
+@code{cdr} is a number indicating its level.@refill
 @end defopt
 
 @defopt reftex-default-context-regexps
 @item SECTION-NUMBERS
 Include section numbers (like 4.1.3) in table of contents.@refill
 @item COUNTERS
-Show counters.  These are just numbers the labels in the menu.@refill
+Show counters.  This just numbers the labels in the menu.@refill
 @item NO-CONTEXT
 Non-@code{nil} means do NOT show the short context.@refill
 @item FOLLOW
 @item MATCH-EVERYWHERE
 Searches in label menu will also match in toc lines etc.@refill
 @item SHOW FILES
-Show Begin and end of included files.@refill
+Show begin and end of included files.@refill
 @end table
 
 Each of these flags can be set to @code{t} or @code{nil}, or to a string
 These strings work like character classes in regular expressions.  Thus,
 setting one of the flags to @samp{"sf"} makes the flag true for section
 and figure labels, @code{nil} for everything else.  Setting it to
-@samp{"^ft"} makes it the other way round.@refill
+@samp{"^sf"} makes it the other way round.@refill
 
 The available label types are: @code{s} (section), @code{f} (figure),
 @code{t} (table), @code{i} (item), @code{e} (equation), @code{n}
 @var{reftex-label-alist}.  When it finds a match, @b{RefTeX} will
 immediately offer the correct label menu - otherwise it will prompt you
 for a label type.  If you set this variable to @code{nil}, @b{RefTeX}
-will always prompt.@refill
+will always prompt for a label type.@refill
 @end defopt
 
 @node Options (Creating Citations), Options (Table of Contents), Options (Referencing Labels), Options
 @end defopt
 
 @defopt reftex-allow-automatic-rescan
-Non-@code{nil} means, RefTeX may rescan the document when this seems
+Non-@code{nil} means, @b{RefTeX} may rescan the document when this seems
 necessary.  Applies (currently) only in rare cases, when a new label
 cannot be placed with certainty into the internal label list.
 @end defopt
 display.@refill
 @end defopt
 
+@defopt reftex-highlight-selection
+Non-@code{nil} means, highlight selected text in selection and
+@code{*toc*} buffers.  Normally, the text near the cursor is the
+@emph{selected} text, and it is highlighted.  This is the entry most
+keys in the selction and @code{*toc*} buffers act on.  However, if you
+mainly use the mouse to select an item, you may find it nice to have
+mouse-triggered highlighting @emph{instead} or @emph{as well}. The
+varaiable may have one of these values:@refill
+
+@example
+nil      @r{No highlighting.}
+cursor   @r{Highlighting is cursor driven.}
+mouse    @r{Highlighting is mouse driven.}
+both     @r{Both cursor and mouse trigger highlighting.}
+@end example
+
+@end defopt
+
 @defopt reftex-auto-show-entry
 Non-@code{nil} means, do something when context in other window is
 hidden.  Some modes like @code{outline-mode} or @code{folding-mode} hide
 
 @defvar reftex-select-label-map
 The keymap which is active in the labels selection process
-(@pxref{Referencing Labels}).  Commands added to this map must return to
-the selection buffer after any excursion.@refill
+(@pxref{Referencing Labels}).@refill
 @end defvar
 
 @defvar reftex-select-bib-map
 The keymap which is active in the citation-key selection process
-(@pxref{Creating Citations}).  Commands added to this map must return to
-the selection buffer after any excursion.@refill
+(@pxref{Creating Citations}).@refill
 @end defvar
 
 @defvar reftex-toc-map
 Normal hook which is being run when turning on @b{RefTeX} mode.@refill
 @end deffn
 
+@deffn {Normal Hook} reftex-select-label-mode-hook
+Normal hook which is run when a selection buffer enters
+@code{reftex-select-label-mode}.@refill 
+@end deffn
+
+@deffn {Normal Hook} reftex-select-bib-mode-hook
+Normal hook which is run when a selection buffer enters
+@code{reftex-select-bib-mode}.@refill 
+@end deffn
+
+@deffn {Normal Hook} reftex-toc-mode-hook
+Normal hook which is run when a @code{*toc*} buffer is
+created.@refill
+@end deffn
+
 See also the following variables which have hook properties as well:
 
 @itemize @bullet
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.