Index: ChangeLog =================================================================== RCS file: /sources/auctex/reftex/ChangeLog,v retrieving revision 1.68 diff -u -u -p -r1.68 ChangeLog --- ChangeLog 16 Oct 2008 18:57:01 -0000 1.68 +++ ChangeLog 21 Oct 2008 19:21:48 -0000 @@ -1,3 +1,53 @@ +2008-10-21 Timothy Toolan + + * lisp/reftex-sel.el (reftex-insert-docstruct): Add support to + prune sections and labels. + (reftex-select-item): Changed `princ' to `message' to erase the + echo-area. Comment message statement which flashed echo area. + Comment reset of reftex-select-marked. + (reftex-select-post-command-hook): Add support for follow mode + after erasing buffer. + (reftex-select-label-map): Add remapping for `delete-char' and + `delete-backward-char'. Add C-c prefix to printable chars. + (reftex-select-prune-map): New keymap. + (reftex-select-label-mode): Removed reftex-select-marked def. + (reftex-select-marked): Made buffer local. + (reftex-select-follow-mode): New variable. + + * lisp/reftex-ref.el (reftex-scan-aux-files) + (reftex-augment-scan-info, reftex-redraw-echo-area-hook) + (reftex-label-get-pruned-list): New functions. + (reftex-label-info-update, reftex-label): Add support for + "resolved" field of label objects in docstruct. + (reftex-select-label-prompt, reftex-select-label-help): Include + description of new functionality. + (reftex-select-prune-prompt, reftex-select-prune-help): New help. + (reftex-reference): Add call to `reftex-augment-scan-info'. Add + support for reftex-ref-type-prompt. + (reftex-offer-label-menu): Major change to add support for filter + mode. Support HIDE-RESOLVED flag from `reftex-label-menu-flags'. + Support reftex-ref-start-in-filter-mode. Keep mode line and echo + area current. Handle new keys and a second keymap. Determine + what subset of labels to display. Determine which label is the + best default selection. Support follow mode after erasing buffer. + (reftex-reparse-document): Add call to `reftex-augment-scan-info' + + * lisp/reftex-vars.el (reftex-label-menu-flags): Mark COUNTERS + flag obsolete. Add flag HIDE-RESOLVED. + (reftex-ref-type-prompt, reftex-ref-start-in-filter-mode): New + variables. + (reftex-ref-macro-prompt): Changed default value. + + * lisp/reftex-base.el (reftex-augment-scan-info) + (reftex-label-get-pruned-list, reftex-label-read-label) + (reftex-label-self-insert-command) + (reftex-label-delete-backward-char): Autoloads for new functions. + (reftex-select-follow-mode): New global variable. + + * doc/reftex.texi (RefTeX in a Nutshell): Small change in + "Referencing Labels". + (Referencing Labels): Changed to reflect new functionality. + 2008-10-16 Ralf Angeli * doc/reftex.texi (Referencing Labels, Reference Styles): Document Index: doc/reftex.texi =================================================================== RCS file: /sources/auctex/reftex/doc/reftex.texi,v retrieving revision 1.59 diff -u -u -p -r1.59 reftex.texi --- doc/reftex.texi 16 Oct 2008 18:56:46 -0000 1.59 +++ doc/reftex.texi 21 Oct 2008 19:21:48 -0000 @@ -279,16 +279,14 @@ prompt for a label string (default for f insert a simple label made of a prefix and a number (all other environments) @end itemize address@hidden -Which labels are created how is configurable with the variable address@hidden @item @b{Referencing address@hidden To make a reference, type @kbd{C-c )} (@code{reftex-reference}). This shows an outline of the document with -all labels of a certain type (figure, equation,...) and some label -context. Selecting a label inserts a @address@hidden@address@hidden macro -into the original buffer. +and some label context. Enter a number as it appears in the document +(``1.1'', ``IV'', ``123'', ...) to jump a label, or navigate there in +the buffer. Selecting a label inserts a @address@hidden@address@hidden +macro into the original buffer. @end itemize @item @@ -769,52 +767,30 @@ the parsing by using type-specific prefi the variable @code{reftex-trust-label-prefix}. Referencing Labels is really at the heart of @RefTeX{}. Press @kbd{C-c -)} in order to reference a label (@code{reftex-reference}). This will -start a selection process and finally insert the complete address@hidden@address@hidden into the buffer. - address@hidden reftex-ref-macro-prompt -First, you can select which reference macro you want to use, -e.g. @samp{\ref} or @samp{\pageref}. Later in the process you have -another chance to make this selection and you can therefore disable this -step by customizing @code{reftex-ref-macro-prompt} if you find it too -intrusive. @xref{Reference Styles}. - -Then, @RefTeX{} will determine the label category which is required. -Often that can be figured out from context. For example, if you write address@hidden shown in eq.} and then press @kbd{C-c )}, @RefTeX{} knows that -an equation label is going to be referenced. If it cannot figure out -what label category is needed, it will query for one. - -You will then be presented with a label selection menu. This is a -special buffer which contains an outline of the document along with all -labels of the given label category. In addition, next to the label -there will be one line of context of the label definition, which is some -text in the buffer near the label definition. Usually this is -sufficient to identify the label. If you are unsure about a certain -label, pressing @key{SPC} will show the label definition point in -another window. - -In order to reference a label, move the cursor to the correct label and -press @key{RET}. You can also reference several labels with a single -call to @code{reftex-reference} by marking entries with the @kbd{m} -key (see below). +)} in order to reference a label (@code{reftex-reference}). Enter the +number as it appears in the typeset document (``1.2'', ``IV'', ``134'', +...) then press @key{RET} to insert the complete @address@hidden@}} +into the buffer. If there is more than one exact match, such as address@hidden@ 3}, @emph{Eq.@ 3}, and @emph{Fig.@ 3}, press address@hidden to cycle between these choices. + +If for some reason you cannot run @LaTeX{} to generate the typeset +document, move the cursor to the correct label and press @key{RET}. You +can also reference several labels with a single call to address@hidden by marking entries with the @kbd{m} key (see +below). @kindex ? -Here is a list of special commands in the selection buffer. A summary -of this information is always available from the selection process by -pressing @kbd{?}. - - +Here is a list of special commands in the selection buffer. A @kbd{C-c} +prefix is necessary for all printable characters when in filter mode. A +summary of this information is always available from the selection +process by pressing @kbd{?}. @table @kbd @tablesubheading{General} @item ? Show a summary of available commands. address@hidden 0-9,- -Prefix argument. - @tablesubheading{Moving around} @item n Go to next label. Index: lisp/reftex-base.el =================================================================== RCS file: /sources/auctex/reftex/lisp/reftex-base.el,v retrieving revision 1.15 diff -u -u -p -r1.15 reftex-base.el --- lisp/reftex-base.el 15 Oct 2008 16:28:14 -0000 1.15 +++ lisp/reftex-base.el 21 Oct 2008 19:21:48 -0000 @@ -119,6 +119,11 @@ (autoload 'reftex-query-label-type "reftex-ref") (autoload 'reftex-goto-label "reftex-ref" "Prompt for label name and go to that location." t) +(autoload 'reftex-augment-scan-info "reftex-ref") +(autoload 'reftex-label-get-pruned-list "reftex-ref") +(autoload 'reftex-label-read-label "reftex-ref") +(autoload 'reftex-label-self-insert-command "reftex-ref") +(autoload 'reftex-label-delete-backward-char "reftex-ref") ;; Table of contents (autoload 'reftex-toc "reftex-toc" @@ -149,6 +154,7 @@ (autoload 'reftex-insert-docstruct "reftex-sel") (autoload 'reftex-get-offset "reftex-sel") (autoload 'reftex-select-item "reftex-sel") +(autoload 'reftex-select-mark "reftex-sel") ;; Index support (autoload 'reftex-index "reftex-index" @@ -614,6 +620,7 @@ the label information is recompiled on n (defvar reftex-section-levels-all nil) (defvar reftex-buffers-with-changed-invisibility nil) (defvar reftex-callback-fwd t) +(defvar reftex-select-follow-mode nil) (defvar reftex-last-toc-master nil "Stores the name of the tex file that `reftex-toc' was last run on.") ;; Marker for return point from recursive edit Index: lisp/reftex-ref.el =================================================================== RCS file: /sources/auctex/reftex/lisp/reftex-ref.el,v retrieving revision 1.36 diff -u -u -p -r1.36 reftex-ref.el --- lisp/reftex-ref.el 15 Oct 2008 16:27:57 -0000 1.36 +++ lisp/reftex-ref.el 21 Oct 2008 19:21:48 -0000 @@ -75,10 +75,12 @@ If optional BOUND is an integer, limit b (file (nth 3 cell)) (comment (nth 4 cell)) (note (nth 5 cell)) + (resolved (nth 6 cell)) (buf (reftex-get-file-buffer-force file (not (eq t reftex-keep-temporary-buffers))))) (if (not buf) - (list label typekey "" file comment "LOST LABEL. RESCAN TO FIX.") + (list label typekey "" file comment + "LOST LABEL. RESCAN TO FIX." resolved) (save-excursion (set-buffer buf) (save-restriction @@ -94,8 +96,9 @@ If optional BOUND is an integer, limit b (progn (backward-char 1) - (append (reftex-label-info label file) (list note))) - (list label typekey "" file "LOST LABEL. RESCAN TO FIX."))))))) + (append (reftex-label-info label file) (list note resolved))) + (list label typekey "" file + "LOST LABEL. RESCAN TO FIX." resolved))))))) (defun reftex-label-info (label &optional file bound derive env-or-mac) ;; Return info list on LABEL at point. @@ -255,7 +258,7 @@ This function is controlled by the setti (or (cdr here-I-am-info) (setq rescan-is-useful t)) (when tail - (push (list label typekey text file nil note) (cdr tail)) + (push (list label typekey text file nil note "?") (cdr tail)) (put reftex-docstruct-symbol 'modified t))) ;; Insert the label into the buffer @@ -385,10 +388,12 @@ also applies `reftex-translate-to-ascii- ;; Help string for the reference label menu (defconst reftex-select-label-prompt - "Select: [n]ext [p]revious [r]escan [ ]context e[x]tern [q]uit RET [?]HELP+more") + "Select: TAB [n]ext [p]revious [r]escan [ ]context [q]uit RET [?]HELP+more") +(defconst reftex-select-prune-prompt + "Select: TAB DEL RET [C-q]uit [?]HELP Label: ") -(defconst reftex-select-label-help - " n / p Go to next/previous label (Cursor motion works as well) +(defconst reftex-select-common-help + " n / p Go to next/previous label (Cursor motion works as well). C-c C-n/p Go to next/previous section heading. b / l Jump back to previous selection / Reuse last referenced label. z Jump to a specific section, e.g. '3 z' jumps to section 3. @@ -399,11 +404,27 @@ also applies `reftex-translate-to-ascii- # % Toggle: [#] label counters, [%] labels in comments SPC / f Show full context in other window / Toggle follow mode. . Show insertion point in other window. - v / V Toggle \\ref <-> \\vref / Rotate \\ref <=> \\fref <=> \\Fref - TAB Enter a label with completion. - m , - + Mark entry. `,-+' also assign a separator. - a / A Put all marked entries into one/many \\ref commands. - q / RET Quit without referencing / Accept current label (also on mouse-2).") + v / V Toggle \\ref <-> \\vref / Rotate \\ref <=> \\fref <=> \\Fref + m / u Mark/unmark an entry. + , - + Mark entry and also assign a separator. + a / A Put all marked entries into one/many \\ref commands.") + +(defconst reftex-select-label-help + (concat + " TAB Enter filter mode and filter on labels from typeset document. + DEL / BS Toggle filter mode / Delete a character from the current filter. + q / RET Quit without referencing / Accept current label (also on mouse-2). +" reftex-select-common-help)) + +(defconst reftex-select-prune-help + (concat + " TAB Complete label, go to next exact match, or go to next match. + DEL / BS Toggle filter mode / Delete a character from the current filter. + C-q / RET Quit without referencing / Accept current label (also on mouse-2). + +The following commands require a C-c prefix: +" (replace-regexp-in-string "c C-n/p" "n / C-p" reftex-select-common-help) " + ? / q Insert question mark into filter / Quit without referencing.")) (defun reftex-reference (&optional type no-insert cut) "Make a LaTeX reference. Look only for labels of a certain TYPE. @@ -423,11 +444,14 @@ When called with 2 C-u prefix args, disa ;; Ensure access to scanning info and rescan buffer if prefix is '(4) (reftex-access-scan-info current-prefix-arg) + ;; Add the resolved labels to the scan info + (reftex-augment-scan-info) + (let ((refstyle (when (and (boundp 'refstyle) refstyle) refstyle)) - (reftex-format-ref-function reftex-format-ref-function) + (reftex-format-ref-function reftex-format-ref-function) (form "\\ref{%s}") label labels sep sep1 style-alist) - + (unless refstyle (if reftex-ref-macro-prompt (progn @@ -460,10 +484,11 @@ When called with 2 C-u prefix args, disa (unless type ;; Guess type from context (if (and reftex-guess-label-type - (setq type (reftex-guess-label-type))) - (setq cut (cdr type) - type (car type)) - (setq type (reftex-query-label-type)))) + (setq type (reftex-guess-label-type))) + (setq cut (cdr type) + type (car type)) + (setq type (if reftex-ref-type-prompt + (reftex-query-label-type) " ")))) ;; Have the user select a label (set-marker reftex-select-return-marker (point)) @@ -530,7 +555,18 @@ When called with 2 C-u prefix args, disa (cons (cdr cell) (- (match-end 0) (match-end 1))) nil))) +;; This is used to store the match for filtering +(defvar reftex-label-prune-buffer nil) +(make-variable-buffer-local 'reftex-label-prune-buffer) +;; This is used to store the list of desired labels for filtering +(defvar reftex-label-pruned-labels nil) +(make-variable-buffer-local 'reftex-label-pruned-labels) +;; This is used to determine if we are filtering or not +(defvar reftex-label-prune-mode nil) +(make-variable-buffer-local 'reftex-label-prune-mode) + (defvar reftex-select-label-map) +(defvar reftex-select-prune-map) (defun reftex-offer-label-menu (typekey) ;; Offer a menu with the appropriate labels. (let* ((buf (current-buffer)) @@ -543,14 +579,17 @@ When called with 2 C-u prefix args, disa (files (reftex-typekey-check typekey reftex-label-menu-flags 7)) (context (not (reftex-typekey-check typekey reftex-label-menu-flags 3))) - (counter (reftex-typekey-check - typekey reftex-label-menu-flags 2)) + (counter (not (reftex-typekey-check + typekey reftex-label-menu-flags 8))) (follow (reftex-typekey-check typekey reftex-label-menu-flags 4)) (commented (nth 5 reftex-label-menu-flags)) + (exact-only nil) ; don't use this right now (prefix "") selection-buffers - offset rtn key data last-data entries) + offset rtn key data last-data entries + select-label-prompt select-label-help select-label-map + num-exact-labels mode-match offset-cell not-first-pass timer-canceler) (unwind-protect (catch 'exit @@ -571,15 +610,48 @@ When called with 2 C-u prefix args, disa (reftex-select-label-mode)) (add-to-list 'selection-buffers (current-buffer)) (setq truncate-lines t) + ;; Reset these variables on a new call to reftex-reference + (unless not-first-pass + (setq timer-canceler + (run-with-idle-timer 2 t 'reftex-redraw-echo-area-hook)) + (make-local-variable 'cursor-in-echo-area) + (setq reftex-label-prune-buffer nil + reftex-select-marked nil + reftex-select-follow-mode follow + reftex-label-prune-mode reftex-ref-start-in-filter-mode + cursor-in-echo-area reftex-label-prune-mode + not-first-pass t)) + ;; Create the pruning list here + (setq reftex-label-pruned-labels + (reftex-label-get-pruned-list + reftex-label-prune-buffer typekey data nil buf commented + exact-only) + num-exact-labels (pop reftex-label-pruned-labels) + offset-cell (pop reftex-label-pruned-labels)) + ;; Add number of labels matched or filter to mode line + (setq mode-match + (cond + ((and reftex-label-prune-mode num-exact-labels) + (format " (%d match, %d exact)" + (length reftex-label-pruned-labels) + num-exact-labels)) + (reftex-label-prune-mode + (format " (%d match)" + (length reftex-label-pruned-labels))) + ((and (not reftex-label-prune-mode) + (> (length reftex-label-prune-buffer) 0)) + (concat " (Filter: \"" + reftex-label-prune-buffer "\")")) + (t ""))) (setq mode-line-format (list "---- " 'mode-line-buffer-identification " " 'global-mode-string " (" mode-name ")" - " S<" 'refstyle ">" + " S<" 'refstyle ">" mode-match " -%-")) (cond ((= 0 (buffer-size)) (let ((buffer-read-only nil)) - (message "Creating Selection Buffer...") +; (message "Creating Selection Buffer...") ; causes flashing (setq offset (reftex-insert-docstruct buf toc @@ -592,6 +664,8 @@ When called with 2 C-u prefix args, disa (or here-I-am offset) prefix nil ; no a toc buffer + t ; use pruned labels + reftex-label-pruned-labels )))) (here-I-am (setq offset (reftex-get-offset buf here-I-am typekey))) @@ -600,13 +674,27 @@ When called with 2 C-u prefix args, disa (setq offset (or offset t)) (setq here-I-am nil) ; turn off determination of offset + (if (not reftex-label-prune-mode) + (setq select-label-prompt reftex-select-label-prompt + select-label-help reftex-select-label-help + select-label-map reftex-select-label-map) + (setq select-label-prompt (concat reftex-select-prune-prompt + reftex-label-prune-buffer) + select-label-help reftex-select-prune-help + select-label-map reftex-select-prune-map + offset offset-cell)) + (when reftex-select-follow-mode + (if reftex-label-prune-mode + (reftex-show-label-location offset nil nil) + (reftex-show-label-location data nil nil))) + (reftex-label-remark-marked) (setq rtn (reftex-select-item - reftex-select-label-prompt - reftex-select-label-help - reftex-select-label-map + select-label-prompt + select-label-help + select-label-map offset - 'reftex-show-label-location follow)) + 'reftex-show-label-location reftex-select-follow-mode)) (setq key (car rtn) data (nth 1 rtn) last-data (nth 2 rtn) @@ -645,9 +733,25 @@ When called with 2 C-u prefix args, disa ;; toggle counter display (reftex-erase-buffer) (setq counter (not counter))) + ((eq key 'tab) + ;; enter pruning mode or redisplay after tab completion + (reftex-erase-buffer) + (when (not reftex-label-prune-mode) + (setq reftex-label-prune-mode t + cursor-in-echo-area t))) + ((eq key 'delete) + ;; toggle pruning mode (but only called when in pruning mode) + (reftex-erase-buffer) + (if reftex-label-prune-mode + (setq reftex-label-prune-mode nil + cursor-in-echo-area nil) + (setq reftex-label-prune-buffer t + cursor-in-echo-area t))) ((eq key ?%) ;; toggle display of commented labels (reftex-erase-buffer) + (when commented + (setq reftex-select-marked nil)) (setq commented (not commented))) ((eq key ?l) ;; reuse the last referenced label again @@ -690,6 +794,8 @@ When called with 2 C-u prefix args, disa (cdr (pop reftex-buffers-with-changed-invisibility))))) (mapc (lambda (buf) (and (buffer-live-p buf) (bury-buffer buf))) selection-buffers) + (setq cursor-in-echo-area nil) + (cancel-timer timer-canceler) (reftex-kill-temporary-buffers)) ;; Add the prefixes, put together the relevant information in the form ;; (LABEL TYPEKEY SEPARATOR) and return a list of those. @@ -711,7 +817,9 @@ When called with 2 C-u prefix args, disa (set-buffer buffer))) (let ((arg (if (eq key ?R) '(16) '(4))) (file (nth 3 data))) - (reftex-access-scan-info arg file))))) + (reftex-access-scan-info arg file) + ;; Need to add resolved labels again after regenerating the scan-info + (reftex-augment-scan-info))))) (defun reftex-query-label-type () ;; Ask for label type @@ -863,7 +971,417 @@ Optional prefix argument OTHER-WINDOW go (goto-char where)) (reftex-unhighlight 0))) +(defun reftex-label-get-pruned-list + (key typekey old-selection advance buf commented exact-only) + ;; Match either a resolved label or the actual label + (let* ((last-section "1") + (num-exact-labels 0) + matching-labels new-selection docstruct index is-exact label resolved + label-first label-first-exact label-next label-next-exact label-old) + + ;; This ensures that we we have access even on the first call + (save-excursion + (when buf + (set-buffer buf)) + (reftex-access-scan-info) + (setq docstruct (symbol-value reftex-docstruct-symbol))) + + ;; If key is nil, set it to an empty string + (when (not key) (setq key "")) + + (dolist (current-label docstruct) + ;; If the current item is a toc entry, update last-section + (when (eq (car current-label) 'toc) + (setq last-section (nth 6 current-label))) + ;; Check that this item is a label, the right type, and uncommented + (when (or (and (stringp (car current-label)) + (or commented (not (nth 4 current-label))) + (or (string= typekey " ") + (string= typekey (nth 1 current-label)))) + (reftex-label-is-it-marked current-label)) + ;; Check if we want this label + (setq label (car current-label) + resolved (nth 6 current-label)) + (when (or (and resolved + (<= (length key) (length resolved)) + (string= key (substring resolved 0 (length key)))) + (and (<= (length key) (length label)) + (string= key (substring label 0 (length key)))) + (reftex-label-is-it-marked current-label)) + ;; See if it is the first label found + (unless label-first + (setq label-first current-label)) + ;; See if it is the next label after the old selection + (when (and label-old (not label-next)) + (setq label-next current-label)) + ;; See if it is an exact match + (setq is-exact nil) + (when (or (and resolved (string= key resolved)) + (string= key label)) + (setq num-exact-labels (1+ num-exact-labels)) + (setq is-exact "EXACT MATCH") + ;; See if it is the first exact match + (when (not label-first-exact) + (setq label-first-exact current-label)) + ;; See if it is the next exact match after the old selection + (when (and label-old (not label-next-exact)) + (setq label-next-exact current-label))) + ;; See if it was the old selection + (when (and (not label-old) + old-selection + (stringp (car old-selection)) + (string= (car old-selection) label) + (or (and (not (nth 4 old-selection)) + (not (nth 4 current-label))) + (and (stringp (nth 6 old-selection)) + (stringp resolved) + (string= resolved (nth 6 old-selection))))) + (setq label-old current-label)) + ;; Add it to the list + (cond + ((and exact-only is-exact) + (push (list label last-section resolved nil) matching-labels)) + ((not exact-only) + (push (list label last-section resolved is-exact) + matching-labels)))))) + ;; Reverse the list since we built it in reverse. + (setq matching-labels (nreverse matching-labels)) + + ;; If no exact matches set num-exact-labels to nil instead of 0 + (when (= num-exact-labels 0) + (setq num-exact-labels nil)) + + ;; Add a count to the exact match note when more than one exact match + (when (and num-exact-labels + (> num-exact-labels 1)) + (setq index 0) + (dolist (current-label matching-labels) + ;; If it is an exact match add count + (when (nth 3 current-label) + (setq index (1+ index)) + (setcdr (cdr (cdr current-label)) + (list (format "EXACT MATCH %d of %d" + index num-exact-labels)))))) + + ;; Determine which new selection to use + (if advance + (cond + (label-next-exact + (setq new-selection label-next-exact)) + (label-first-exact + (setq new-selection label-first-exact)) + (label-next + (setq new-selection label-next)) + (t + (setq new-selection label-first))) + ;; not advancing + (if (and label-old + (not label-first-exact)) + (setq new-selection label-old) + (if label-first-exact + (setq new-selection label-first-exact) + (setq new-selection label-first)))) + + ;; Put num-exact-labels and new-selection at the head of the match list + (push new-selection matching-labels) + (push num-exact-labels matching-labels) + + ;; Return matching-labels + matching-labels)) + +(defun reftex-scan-aux-files () + ;; Return a list of all of the resolved labels in all the .aux files + ;; associated with this document. An empty list will be returned if + ;; there is a problem reading the main .aux file. Note that LaTeX + ;; places the .aux files relative to the master TeX file even if + ;; they are included from a path in TEXINPUTS, therefore we can + ;; ignore TEXINPUTS. The returned list will be in the order that + ;; they appear in the typeset document. The elements of the list + ;; consists of (LABEL INDEX RESOLVED) where: + ;; LABEL - the label name as it would be in a \label command + ;; INDEX - the index in the list (used to restore sorting order) + ;; RESOLVED - the resolved label as it appears in the typeset document + + ;; Get the full path to the master file using `reftex-TeX-master-file' + (let* ((master-aux-file (reftex-TeX-master-file)) + (label-count 0) + label-list basedir sub-aux-file) + ;; Verify that master file has a .tex extension + (if (and master-aux-file + (string= "tex" (file-name-extension master-aux-file))) + (progn + ;; Replace the .tex extension with an .aux extension + (setq master-aux-file + (concat (file-name-sans-extension master-aux-file) ".aux")) + ;; verify that the .aux file exists and is readable + (unless (file-readable-p master-aux-file) + (setq master-aux-file nil))) + ;; If reftex-TeX-master-file returns a non .tex file ignore it + (setq master-aux-file nil)) + + ;; If master .aux file looks good, parse it, otherwise return an empty list + (when master-aux-file + ;; Determine the directory where the master .aux file lives + (setq basedir (file-name-directory master-aux-file)) + ;; Look for either address@hidden or \newlabel statements in master + (with-temp-buffer + (insert-file-contents-literally master-aux-file) + (while (re-search-forward + (concat "^\\s-*\\\\\\(@input\\){\\([^}]*\\)}" "\\|" + "^\\s-*\\\\\\(newlabel\\){\\([^}]*\\)}{{\\([^}]*\\)}{") + nil t) + (setq sub-aux-file (concat basedir (match-string 2))) + (if (string= (match-string 1) "@input") + ;; we matched an address@hidden in master so parse that .aux file + ;; for \newlabel commands only + (if (file-readable-p sub-aux-file) + (with-temp-buffer + (insert-file-contents-literally sub-aux-file) + (while (re-search-forward + "^\\s-*\\\\newlabel{\\([^}]*\\)}{{\\([^}]*\\)}{" + nil t) + (setq label-count (1+ label-count)) + (push (list (match-string 1) label-count (match-string 2)) + label-list)))) + ;; we matched a \newlabel in master so add it to list + (progn + (setq label-count (1+ label-count)) + (push (list (match-string 4) label-count (match-string 5)) + label-list))))) + ;; Reverse the list since we built it in reverse + (setq label-list (nreverse label-list))) + + ;; Return the list of labels + label-list)) + +(defun reftex-augment-scan-info () + ;; This function will add or update the seventh element (nth 6) of + ;; scan info in reftex-docstruct-symbol with the label as resolved + ;; in the typeset document. After this function is called, all + ;; non-commented labels that did not resolve will have this field + ;; set to a question mark, and all commented labels will have it set + ;; to a unique identifier to make them unique. It is okay if the + ;; .aux files are not consistent with the .tex files, as long as the + ;; labels have not been reused for different things, as can happen + ;; with reftex-renumber-simple-labels. In that case, LaTeX should + ;; be run. As with LaTeX, duplicate labels are an error. + + ;; Ensure access to scanning info + (reftex-access-scan-info) + + (let* (;; Get the list of resolved labels from the .aux files + (aux-labels (reftex-scan-aux-files)) + (label-count 0) + (comment-count 0) + next-aux-a-dup next-ref-a-dup ref-labels + current-aux-label current-ref-label current-ds-label) + + ;; Construct a list similar to aux-labels using the RefTeX data. + (dolist (current-label (symbol-value reftex-docstruct-symbol)) + ;; Check if current item is a label + (when (stringp (car current-label)) + (if (nth 4 current-label) + ;; If it is a comment, set resolved to a unique value + (progn + (setq comment-count (1+ comment-count)) + (setcdr (cdr (cdr (cdr (cdr current-label)))) + (list (nth 5 current-label) + (format "?-%d" comment-count)))) + ;; If it is a normal label, add it to the list + (progn + (setq label-count (1+ label-count)) + (push (list (car current-label) label-count "?") ref-labels))))) + ;; Reverse the list since we built it in reverse. + (setq ref-labels (nreverse ref-labels)) + + ;; Sort lists by label name to allow efficient transfer of resolved labels. + (setq aux-labels + (sort aux-labels '(lambda (a b) (string< (car a) (car b))))) + (setq ref-labels + (sort ref-labels '(lambda (a b) (string< (car a) (car b))))) + + ;; Move the resolved label names to the new list. + (setq current-aux-label aux-labels + current-ref-label ref-labels) + (while (and current-aux-label current-ref-label) + ;; Check that the label names are the same. + (if (string= (car (car current-aux-label)) + (car (car current-ref-label))) + ;; Labels are the same so transfer label number + (progn + (setcar (cdr (cdr (car current-ref-label))) + (nth 2 (car current-aux-label))) + (setq next-ref-a-dup + (and (cdr current-ref-label) + (string= (car (car current-aux-label)) + (car (car (cdr current-ref-label)))))) + (setq next-aux-a-dup + (and (cdr current-aux-label) + (string= (car (car (cdr current-aux-label))) + (car (car current-ref-label))))) + (cond + ;; Advance either one or both lists based on duplicates + ((and next-ref-a-dup (not next-aux-a-dup)) + (setq current-ref-label (cdr current-ref-label))) + ((and (not next-ref-a-dup) next-aux-a-dup) + (setq current-aux-label (cdr current-aux-label))) + (t + (setq current-aux-label (cdr current-aux-label) + current-ref-label (cdr current-ref-label))))) + ;; Labels are different so only advance one list + (if (string< (car (car current-aux-label)) + (car (car current-ref-label))) + (setq current-aux-label (cdr current-aux-label)) + (setq current-ref-label (cdr current-ref-label))))) + + ;; Restore sorting order so we can move the data to docstruct + (setq ref-labels + (sort ref-labels '(lambda (a b) (< (nth 1 a) (nth 1 b))))) + + ;; Insert the resolved labels into the docstruct + (setq current-ds-label (symbol-value reftex-docstruct-symbol) + current-ref-label ref-labels) + ;; Iterate over the two lists + (while (and current-ds-label current-ref-label) + ;; Check that the docstruct entry is a label and that the label + ;; names are the same, and if so insert reference + (if (and (stringp (car (car current-ds-label))) + (not (nth 4 (car current-ds-label))) + (string= (car (car current-ds-label)) + (car (car current-ref-label)))) + (progn + (setcdr (cdr (cdr (cdr (cdr (car current-ds-label))))) + (list (nth 5 (car current-ds-label)) + (nth 2 (car current-ref-label)))) + ;; Advance to the next label in both lists. + (setq current-ds-label (cdr current-ds-label) + current-ref-label (cdr current-ref-label))) + ;; If there was not a match, we know it was docstruct. + (setq current-ds-label (cdr current-ds-label)))))) + +(defun reftex-redraw-echo-area-hook () + ;; This is installed when reftex-reference is in filter mode. + ;; Because the prompt in the minibuffer is not really in a + ;; minibuffer, but actually using the echo-area, it can get overwritten + ;; with messages and key prefixes. This will restore the prompt after + ;; two seconds. + (when (and reftex-label-prune-mode + (buffer-name) + (string= (buffer-name) "*RefTeX Select*") + (not (string= (current-message) + (concat reftex-select-prune-prompt + reftex-label-prune-buffer)))) + (message (format "%s" (concat reftex-select-prune-prompt + reftex-label-prune-buffer))))) + +;; To quiet the compiler +(defvar typekey) +(defvar data) +(defvar commented) +(defvar exact-only) +(defun reftex-label-read-label () + "Use minibuffer to filter labels or resolved labels, with completion." + (interactive) + ;; If not in prune mode, enter that mode + (unless reftex-label-prune-mode + (throw 'myexit 'tab)) + ;; see if there is a possible completion + (let* (completion-string num-exact-labels my-regexp + offset-cell offset-label combined-list) + ;; This is always safe to do + (unless reftex-label-prune-buffer + (setq reftex-label-prune-buffer "")) + ;; Attempt completion + (when (> (length reftex-label-pruned-labels) 0) + ;; Create the combined list of labels and resolved labels to search + (dolist (current-label reftex-label-pruned-labels) + (push (car current-label) combined-list) + (push (nth 2 current-label) combined-list)) + ;; Call try-completion to find any completions + (setq completion-string + (try-completion reftex-label-prune-buffer combined-list)) + ;; If it returns t, just set it to reftex-label-prune-buffer + (when (and (not (stringp completion-string)) completion-string) + (setq completion-string reftex-label-prune-buffer))) + ;;If we got a completion, add it and then redraw buffer + (when (and completion-string + (not (= (length completion-string) + (length reftex-label-prune-buffer)))) + (setq reftex-label-prune-buffer completion-string) + (throw 'myexit 'tab)) + ;; No completion so cycle to next preferred label (the most common case) + (setq reftex-label-pruned-labels + (reftex-label-get-pruned-list + reftex-label-prune-buffer typekey data t nil commented exact-only) + num-exact-labels (pop reftex-label-pruned-labels) + offset-cell (pop reftex-label-pruned-labels) + offset-label (car offset-cell)) + (setq reftex-callback-fwd t) + (or (eobp) (forward-char 1)) + (setq my-regexp + (if (nth 4 offset-cell) + ;; This matches a commented label + (concat "^>[\t ]+%[\t ]+" (regexp-quote offset-label) + "[\t ]+(" (regexp-quote (nth 6 offset-cell)) ")") + ;; This matches an uncommented label + (concat "^>[\t ]+" (regexp-quote offset-label)))) + (when (not (re-search-forward my-regexp nil t nil)) + ;; Forward search failed, so try again from beginning of buffer + (goto-char (point-min)) + (re-search-forward my-regexp nil t nil)) + (beginning-of-line 1))) + +(defun reftex-label-self-insert-command (N) + "Add N copies of the last typed character to the label/reference filter." + (interactive "p") + (setq reftex-label-prune-buffer + (concat reftex-label-prune-buffer + (make-string N last-command-char))) + ;; Send a "g" which means redraw window + (throw 'myexit ?g)) + +(defun reftex-label-delete-backward-char (N) + "Delete N characters from the label/reference filter." + (interactive "p") + (when (and (> (length reftex-label-prune-buffer) 0) + (>= N 1)) + (if (>= N (length reftex-label-prune-buffer)) + (setq reftex-label-prune-buffer nil) + (setq reftex-label-prune-buffer + (substring reftex-label-prune-buffer + 0 (- (length reftex-label-prune-buffer) N))))) + ;; Send a "g" which means redraw window + (throw 'myexit ?g)) + +(defun reftex-label-remark-marked () + ;; This will remark all of the marked items when the buffer is redrawn + (when reftex-select-marked + (let* ((select-marked (nreverse reftex-select-marked)) + marked-item) + (setq reftex-select-marked nil) + (while select-marked + (setq marked-item (pop select-marked)) + (reftex-find-start-point (point-min) (car marked-item)) + (reftex-select-mark (nth 2 marked-item)))))) + +(defun reftex-label-do-they-match (a b) + ;; Check if a and b are labels, and if so, do they match + ;; Both a and b should be a docstruct type entry + (and (stringp (car a)) (stringp (car b)) ; both are labels + (string= (car a) (car b)) ; labels are the same + (or (and (null (nth 4 a)) (null (nth 4 b))) ; both uncommented + (and (nth 4 a) (nth 4 b) ; both commented + (stringp (nth 6 a)) (stringp (nth 6 b)) + (string= (nth 6 a) (nth 6 b)))))) ; same resolved label + +(defun reftex-label-is-it-marked (current-label) + ;; This will check if current-label is in reftex-select-marked + (let* ((is-marked nil)) + (dolist (marked-item reftex-select-marked) + (when (reftex-label-do-they-match current-label (car marked-item)) + (setq is-marked t))) + is-marked)) ;;; arch-tag: 52f14032-fb76-4d31-954f-750c72415675 ;;; reftex-ref.el ends here Index: lisp/reftex-sel.el =================================================================== RCS file: /sources/auctex/reftex/lisp/reftex-sel.el,v retrieving revision 1.37 diff -u -u -p -r1.37 reftex-sel.el --- lisp/reftex-sel.el 15 Oct 2008 16:27:27 -0000 1.37 +++ lisp/reftex-sel.el 21 Oct 2008 19:21:48 -0000 @@ -37,6 +37,12 @@ This keymap can be used to configure the label selection process which is started with the command \\[reftex-reference].") +(defvar reftex-select-prune-map nil + "Keymap used for *RefTeX Select* buffer, when selecting a label +by filtering it through the resolved labels. +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. @@ -57,7 +63,7 @@ During a selection process, these are th (make-local-hook 'post-command-hook)) (setq major-mode 'reftex-select-label-mode mode-name "LSelect") - (set (make-local-variable 'reftex-select-marked) nil) +; (set (make-local-variable 'reftex-select-marked) nil) (when (syntax-table-p reftex-latex-syntax-table) (set-syntax-table reftex-latex-syntax-table)) ;; We do not set a local map - reftex-select-item does this. @@ -141,7 +147,8 @@ During a selection process, these are th (defun reftex-insert-docstruct (buf toc labels index-entries files context counter show-commented - here-I-am xr-prefix toc-buffer) + here-I-am xr-prefix toc-buffer + &optional prune-mode pruned-labels) ;; Insert an excerpt of the docstruct list. ;; Return the data property of the entry corresponding to HERE-I-AM. ;; BUF is the buffer which has the correct docstruct-symbol. @@ -149,12 +156,14 @@ During a selection process, these are th ;; When a string, indicates the label type to include ;; FILES non-nil means to display file boundaries. ;; CONTEXT non-nil means to include label context. - ;; COUNTER means to count the labels. + ;; COUNTER non-nil means to display the resolved label numbers. ;; SHOW-COMMENTED means to include also labels which are commented out. ;; HERE-I-AM is a member of the docstruct list. The function will return ;; a used member near to this one, as a possible starting point. ;; XR-PREFIX is the prefix to put in front of labels. ;; TOC-BUFFER means this is to fill the toc buffer. + ;; PRUNE-MODE non-nil means prune labels and sections based on PRUNED-LABELS. + ;; PRUNED-LABELS a list of the pruned labels that matched in PRUNE-MODE. (let* ((font (reftex-use-fonts)) (cnt 0) (index -1) @@ -176,7 +185,8 @@ During a selection process, these are th 'font-lock-constant-face 'font-lock-reference-face)) all cell text label typekey note comment master-dir-re - prev-inserted offset from to index-tag docstruct-symbol) + prev-inserted offset from to index-tag docstruct-symbol + resolved want-this exact-note) ;; Pop to buffer buf to get the correct buffer-local variables (save-excursion @@ -233,8 +243,19 @@ During a selection process, these are th ((eq (car cell) 'toc) ;; a table of contents entry + + ;; If pruning labels, it is important to prune sections that don't + ;; contain any labels because otherwise they can become overwhelming + (let* ((prev (nth 1 (car pruned-labels))) + (this (nth 6 cell))) + (setq want-this + (or (<= (length this) 1) + (and (<= (length this) (length prev)) + (string= this (substring prev 0 (length this))))))) + (when (and toc - (<= (nth 5 cell) reftex-toc-max-level)) + (<= (nth 5 cell) reftex-toc-max-level) + (or (not prune-mode) want-this)) (setq prev-inserted cell) ; (if (eq offset 'attention) (setq offset cell)) (setq reftex-active-toc cell) @@ -261,13 +282,24 @@ During a selection process, these are th typekey (nth 1 cell) text (nth 2 cell) comment (nth 4 cell) - note (nth 5 cell)) + note (nth 5 cell) + resolved (nth 6 cell)) + + ;; If pruning labels, determine if we want this one + (if (and prune-mode + (string= label (car (car pruned-labels))) + (string= resolved (nth 2 (car pruned-labels)))) + (setq want-this t + exact-note (nth 3 (car pruned-labels)) + pruned-labels (cdr pruned-labels)) + (setq want-this nil)) (when (and labels (or (eq labels t) (string= typekey labels) (string= labels " ")) - (or show-commented (null comment))) + (or show-commented (null comment)) + (or (not prune-mode) want-this)) ;; Yes we want this one (incf cnt) @@ -286,10 +318,14 @@ During a selection process, these are th label-face)) (goto-char to)) - (insert (if counter (format " (%d) " cnt) "") + (insert (if (or counter comment) (concat " (" resolved ") ") "") (if comment " LABEL IS COMMENTED OUT " "") - (if (stringp note) (concat " " note) "") - "\n") + (if (stringp note) (concat " " note) "")) + (when (stringp exact-note) + (insert (concat " " exact-note)) + (put-text-property + (- (point) (length exact-note)) (point) 'face 'bold)) + (insert "\n") (setq to (point)) (when context @@ -370,6 +406,9 @@ During a selection process, these are th (defvar reftex-last-data nil) (defvar reftex-last-line nil) (defvar reftex-select-marked nil) +(make-variable-buffer-local 'reftex-select-marked) +(defvar reftex-select-follow-mode nil) +(make-variable-buffer-local 'reftex-select-follow-mode) (defun reftex-select-item (prompt help-string keymap &optional offset @@ -388,7 +427,7 @@ During a selection process, these are th (let* (ev data last-data (selection-buffer (current-buffer))) - (setq reftex-select-marked nil) +; (setq reftex-select-marked nil) (setq ev (catch 'myexit @@ -406,7 +445,7 @@ During a selection process, these are th (use-local-map keymap) (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) + (message (format "%s" prompt)) (set-marker reftex-recursive-edit-marker (point)) ;; XEmacs does not run post-command-hook here (and (featurep 'xemacs) (run-hooks 'post-command-hook)) @@ -428,7 +467,7 @@ During a selection process, these are th (set (make-local-variable 'reftex-last-data) last-data) (reftex-kill-buffer "*RefTeX Help*") (setq reftex-callback-fwd (not reftex-callback-fwd)) ;; ;-))) - (message "") +; (message "") ; this makes the echo area flash when pruning labels (list ev data last-data))) ;; The following variables are all bound dynamically in `reftex-select-item'. @@ -531,6 +570,8 @@ Useful for large TOC's." (defun reftex-select-toggle-follow () "Toggle follow mode: Other window follows with full context." (interactive) + ;; Need this to know we were in follow mode when we prune buffer + (setq reftex-select-follow-mode (not reftex-select-follow-mode)) (setq reftex-last-follow-point -1) (setq cb-flag (not cb-flag))) @@ -676,7 +717,7 @@ Reverse list if optional argument REVERS (princ help-string)) (reftex-enlarge-to-fit "*RefTeX Help*" t)) -;; Common bindings in reftex-select-label-map and reftex-select-bib-map +;; Create reftex-select-bib-map (let ((map (make-sparse-keymap))) (substitute-key-definition 'next-line 'reftex-select-next map global-map) @@ -698,7 +739,11 @@ Reverse list if optional argument REVERS ([(return)] . reftex-select-accept) ("q" . reftex-select-quit) ("." . reftex-select-show-insertion-point) - ("?" . reftex-select-help)) + ("?" . reftex-select-help) + ("\C-i" . reftex-select-read-cite) + ([(tab)] . reftex-select-read-cite) + ("m" . reftex-select-mark) + ("u" . reftex-select-unmark)) do (define-key map (car x) (cdr x))) ;; The mouse-2 binding @@ -707,25 +752,97 @@ Reverse list if optional argument REVERS (define-key map [(mouse-2)] 'reftex-select-mouse-accept) (define-key map [follow-link] 'mouse-face)) - ;; Digit arguments (loop for key across "0123456789" do (define-key map (vector (list key)) 'digit-argument)) (define-key map "-" 'negative-argument) + ;; Keys handled by exception + (loop for key across "grRaAeE" do + (define-key map (vector (list key)) + (list 'lambda '() + "Press `?' during selection to find out about this key." + '(interactive) (list 'throw '(quote myexit) key)))) + + ;; Give map its real name + (setq reftex-select-bib-map map)) + +;; Common bindings in reftex-select-label-map and reftex-select-prune-map +(let ((map (make-sparse-keymap))) + (substitute-key-definition + 'next-line 'reftex-select-next map global-map) + (substitute-key-definition + 'previous-line 'reftex-select-previous map global-map) + (substitute-key-definition + 'keyboard-quit 'reftex-select-keyboard-quit map global-map) + (substitute-key-definition + 'newline 'reftex-select-accept map global-map) + + (loop for x in + '(([(down)] . reftex-select-next) + ([(up)] . reftex-select-previous) + ("\C-m" . reftex-select-accept) + ([(return)] . reftex-select-accept) + ("?" . reftex-select-help) + ([(tab)] . reftex-label-read-label) + ("\C-i" . reftex-label-read-label) + ("\C-c\C-n" . reftex-select-next-heading) + ("\C-c\C-p" . reftex-select-previous-heading)) + do (define-key map (car x) (cdr x))) + + ;; The mouse-2 binding + (if (featurep 'xemacs) + (define-key map [(button2)] 'reftex-select-mouse-accept) + (define-key map [(mouse-2)] 'reftex-select-mouse-accept) + (define-key map [follow-link] 'mouse-face)) + + ;; Remap function + (define-key map + (vector 'remap 'delete-backward-char) 'reftex-label-delete-backward-char) + ;; Make two maps (setq reftex-select-label-map map) - (setq reftex-select-bib-map (copy-keymap map))) + (setq reftex-select-prune-map (copy-keymap map))) ;; Specific bindings in reftex-select-label-map -(loop for key across "aAcgFlrRstx#%" do - (define-key reftex-select-label-map (vector (list key)) - (list 'lambda '() - "Press `?' during selection to find out about this key." - '(interactive) (list 'throw '(quote myexit) key)))) +(loop for key across "0123456789" do + (define-key reftex-select-label-map (vector (list key)) 'digit-argument)) +(define-key reftex-select-label-map "-" 'negative-argument) +(define-key reftex-select-label-map + (vector 'remap 'delete-char) 'reftex-label-read-label) + +;; Specific bindings in reftex-select-prune-map +(define-key reftex-select-prune-map "\C-q" 'reftex-select-quit) +(define-key reftex-select-prune-map "\C-c?" 'self-insert-command) +(define-key reftex-select-prune-map + (vector 'remap 'self-insert-command) 'reftex-label-self-insert-command) +(define-key reftex-select-prune-map + (vector 'remap 'delete-char) + (list 'lambda '(N) + "Exit label/reference filter mode." + '(interactive "p") (list 'throw '(quote myexit) '(quote delete)))) + +;; Common bindings in reftex-select-label-map and reftex-select-prune-map +;; that should be bound with a "C-c" prefix in both maps and +;; without the "C-c" prefix in reftex-select-label-map as well. +(defun reftex-add-key-to-maps (key &optional func) + (unless func + (setq func + (list 'lambda '() + "Press `?' during selection to find out about this key." + '(interactive) (list 'throw '(quote myexit) + (string-to-char key))))) + (define-key reftex-select-label-map key func) + (define-key reftex-select-label-map (concat "\C-c" key) func) + (define-key reftex-select-prune-map (concat "\C-c" key) func)) (loop for x in - '(("b" . reftex-select-jump-to-previous) + '((" " . reftex-select-callback) + ("n" . reftex-select-next) + ("p" . reftex-select-previous) + ("f" . reftex-select-toggle-follow) + ("." . reftex-select-show-insertion-point) + ("b" . reftex-select-jump-to-previous) ("z" . reftex-select-jump) ("v" . reftex-select-cycle-ref-style-forward) ("V" . reftex-select-cycle-ref-style-backward) @@ -734,27 +851,12 @@ Reverse list if optional argument REVERS ("," . reftex-select-mark-comma) ("-" . reftex-select-mark-to) ("+" . reftex-select-mark-and) - ([(tab)] . reftex-select-read-label) - ("\C-i" . reftex-select-read-label) - ("\C-c\C-n" . reftex-select-next-heading) - ("\C-c\C-p" . reftex-select-previous-heading)) - do - (define-key reftex-select-label-map (car x) (cdr x))) - -;; Specific bindings in reftex-select-bib-map -(loop for key across "grRaAeE" do - (define-key reftex-select-bib-map (vector (list key)) - (list 'lambda '() - "Press `?' during selection to find out about this key." - '(interactive) (list 'throw '(quote myexit) key)))) + ("q" . reftex-select-quit)) + do (reftex-add-key-to-maps (car x) (cdr x))) -(loop for x in - '(("\C-i" . reftex-select-read-cite) - ([(tab)] . reftex-select-read-cite) - ("m" . reftex-select-mark) - ("u" . reftex-select-unmark)) - do (define-key reftex-select-bib-map (car x) (cdr x))) - +;; Keys handled by exception +(loop for key across "aAcgFlrRstx#%" + do (reftex-add-key-to-maps (char-to-string key))) ;;; arch-tag: 842078ff-0586-4e0b-957e-536e08218464 ;;; reftex-sel.el ends here Index: lisp/reftex-vars.el =================================================================== RCS file: /sources/auctex/reftex/lisp/reftex-vars.el,v retrieving revision 1.50 diff -u -u -p -r1.50 reftex-vars.el --- lisp/reftex-vars.el 15 Oct 2008 16:27:08 -0000 1.50 +++ lisp/reftex-vars.el 21 Oct 2008 19:21:48 -0000 @@ -901,18 +901,19 @@ string to insert into the buffer." (const :tag "off" nil) (string :tag "Selected label types")))) -(defcustom reftex-label-menu-flags '(t t nil nil nil nil t nil) +(defcustom reftex-label-menu-flags '(t t nil nil nil nil t nil nil) "List of flags governing the label menu makeup. The flags are: TABLE-OF-CONTENTS Show the labels embedded in a table of context. SECTION-NUMBERS Include section numbers (like 4.1.3) in table of contents. -COUNTERS Show counters. This just numbers the labels in the menu. +COUNTERS Obsolete flag, use HIDE-RESOLVED flag instead. NO-CONTEXT Non-nil means do NOT show the short context. FOLLOW Follow full context in other window. SHOW-COMMENTED Show labels from regions which are commented out. MATCH-IN-TOC Obsolete flag. SHOW FILES Show begin and end of included files. +HIDE-RESOLVED Don't show labels as they appear in typeset document. 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 @@ -930,12 +931,23 @@ get one interactively during selection f `(list (choice :tag "Embed in table of contents " ,@reftex-tmp) (choice :tag "Show section numbers " ,@reftex-tmp) - (choice :tag "Show individual counters " ,@reftex-tmp) + (choice :tag "Obsolete flag, Don't use. " ,@reftex-tmp) (choice :tag "Hide short context " ,@reftex-tmp) (choice :tag "Follow context in other window " ,@reftex-tmp) (choice :tag "Show commented labels " ,@reftex-tmp) (choice :tag "Obsolete flag, Don't use. " ,@reftex-tmp) - (choice :tag "Show begin/end of included files" ,@reftex-tmp))) + (choice :tag "Show begin/end of included files" ,@reftex-tmp) + (choice :tag "Hide resolved label numbers " ,@reftex-tmp))) + +(defcustom reftex-ref-type-prompt nil + "If non-nil, `reftex-reference' prompts for the label types to display." + :group 'reftex-referencing-labels + :type 'boolean) + +(defcustom reftex-ref-start-in-filter-mode t + "If non-nil, `reftex-reference' starts in filter mode (like typing tab)." + :group 'reftex-referencing-labels + :type 'boolean) (defcustom reftex-multiref-punctuation '((?, . ", ") (?- . "--") (?+ . " and ")) "Punctuation strings for multiple references. @@ -973,7 +985,7 @@ represented as characters, have to be un (string :tag "Name")) (character :tag "Key")))) -(defcustom reftex-ref-macro-prompt t +(defcustom reftex-ref-macro-prompt nil "If non-nil, `reftex-reference' prompts for the reference macro." :group 'reftex-referencing-labels :type 'boolean)