/[emacs]/emacs/lisp/textmodes/reftex-dcr.el
ViewVC logotype

Diff of /emacs/lisp/textmodes/reftex-dcr.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by pj, Mon Jul 16 07:46:48 2001 UTC revision 1.9.8.1 by miles, Fri Apr 4 06:20:39 2003 UTC
# Line 1  Line 1 
1  ;;; reftex-dcr.el --- viewing cross references and citations with RefTeX  ;;; reftex-dcr.el --- viewing cross references and citations with RefTeX
2  ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.  ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3    
4  ;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>  ;; Author: Carsten Dominik <dominik@science.uva.nl>
5  ;; Version: 4.16  ;; Version: 4.18
6  ;;  ;;
7    
8  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
# Line 86  to the functions `reftex-view-cr-cite' a Line 86  to the functions `reftex-view-cr-cite' a
86                  (format reftex-find-index-entry-regexp-format                  (format reftex-find-index-entry-regexp-format
87                          (regexp-quote key))                          (regexp-quote key))
88                  3 nil nil)))                  3 nil nil)))
89       (t       (t
90        (reftex-access-scan-info arg)        (reftex-access-scan-info arg)
91        (catch 'exit        (catch 'exit
92          (let ((list reftex-view-crossref-extra)          (let ((list reftex-view-crossref-extra)
# Line 96  to the functions `reftex-view-cr-cite' a Line 96  to the functions `reftex-view-cr-cite' a
96                    action (nth 1 entry)                    action (nth 1 entry)
97                    group (nth 2 entry))                    group (nth 2 entry))
98              (when (string-match mre macro)              (when (string-match mre macro)
99                (setq dw (reftex-view-regexp-match                (setq dw (reftex-view-regexp-match
100                          (format action key) group nil nil))                          (format action key) group nil nil))
101                (throw 'exit t))))                (throw 'exit t))))
102          (error "Not on a crossref macro argument"))))          (error "Not on a crossref macro argument"))))
103      (if (and (eq arg 2) (windowp dw)) (select-window dw))))      (if (and (eq arg 2) (windowp dw)) (select-window dw))))
104        
105  (defun reftex-view-cr-cite (arg key how)  (defun reftex-view-cr-cite (arg key how)
106    ;; View crossreference of a ref cite.  HOW can have the values    ;; View crossreference of a ref cite.  HOW can have the values
107    ;; nil:         Show in another window.    ;; nil:         Show in another window.
108    ;; echo:        Show one-line info in echo area.    ;; echo:        Show one-line info in echo area.
109    ;; tmp-window:  Show in small window and arrange for window to disappear.    ;; tmp-window:  Show in small window and arrange for window to disappear.
# Line 113  to the functions `reftex-view-cr-cite' a Line 113  to the functions `reftex-view-cr-cite' a
113    
114    (if (eq how 'tmp-window)    (if (eq how 'tmp-window)
115        ;; Remember the window configuration        ;; Remember the window configuration
116        (put 'reftex-auto-view-crossref 'last-window-conf        (put 'reftex-auto-view-crossref 'last-window-conf
117             (current-window-configuration)))             (current-window-configuration)))
118    
119    (let (files size item (pos (point)) (win (selected-window)) pop-win)    (let (files size item (pos (point)) (win (selected-window)) pop-win
120                  (bibtype (reftex-bib-or-thebib)))
121      ;; Find the citation mode and the file list      ;; Find the citation mode and the file list
122      (cond      (cond
123       ((assq 'bib (symbol-value reftex-docstruct-symbol))  ;     ((assq 'bib (symbol-value reftex-docstruct-symbol))
124         ((eq bibtype 'bib)
125        (setq item nil        (setq item nil
126              files (reftex-get-bibfile-list)))              files (reftex-get-bibfile-list)))
127       ((assq 'thebib (symbol-value reftex-docstruct-symbol))  ;     ((assq 'thebib (symbol-value reftex-docstruct-symbol))
128         ((eq bibtype 'thebib)
129        (setq item t        (setq item t
130              files (reftex-uniquify              files (reftex-uniquify
131                     (mapcar 'cdr                     (mapcar 'cdr
132                             (reftex-all-assq                             (reftex-all-assq
133                              'thebib (symbol-value reftex-docstruct-symbol))))))                              'thebib (symbol-value reftex-docstruct-symbol))))))
134       (reftex-default-bibliography       (reftex-default-bibliography
135        (setq item nil        (setq item nil
# Line 165  to the functions `reftex-view-cr-cite' a Line 168  to the functions `reftex-view-cr-cite' a
168          (select-window pop-win)))))          (select-window pop-win)))))
169    
170  (defun reftex-view-cr-ref (arg label how)  (defun reftex-view-cr-ref (arg label how)
171    ;; View crossreference of a ref macro.  HOW can have the values    ;; View crossreference of a ref macro.  HOW can have the values
172    ;; nil:         Show in another window.    ;; nil:         Show in another window.
173    ;; echo:        Show one-line info in echo area.    ;; echo:        Show one-line info in echo area.
174    ;; tmp-window:  Show in small window and arrange for window to disappear.    ;; tmp-window:  Show in small window and arrange for window to disappear.
175    
176    ;; Ensure access to scanning info    ;; Ensure access to scanning info
177    (reftex-access-scan-info (or arg current-prefix-arg))    (reftex-access-scan-info (or arg current-prefix-arg))
178      
179    (if (eq how 'tmp-window)    (if (eq how 'tmp-window)
180        ;; Remember the window configuration        ;; Remember the window configuration
181        (put 'reftex-auto-view-crossref 'last-window-conf        (put 'reftex-auto-view-crossref 'last-window-conf
182             (current-window-configuration)))             (current-window-configuration)))
183    
184    (let* ((xr-data (assoc 'xr (symbol-value reftex-docstruct-symbol)))    (let* ((xr-data (assoc 'xr (symbol-value reftex-docstruct-symbol)))
# Line 187  to the functions `reftex-view-cr-cite' a Line 190  to the functions `reftex-view-cr-cite' a
190          ;; Label is defined in external document          ;; Label is defined in external document
191          (save-excursion          (save-excursion
192            (save-match-data            (save-match-data
193              (set-buffer              (set-buffer
194               (or (reftex-get-file-buffer-force               (or (reftex-get-file-buffer-force
195                    (cdr (assoc (match-string 1 label) (nth 1                    (cdr (assoc (match-string 1 label) (nth 1
196                                                            xr-data))))                                                            xr-data))))
197                   (error "Problem with external label %s" label))))                   (error "Problem with external label %s" label))))
198            (setq label (substring label (match-end 1)))            (setq label (substring label (match-end 1)))
199            (reftex-access-scan-info)            (reftex-access-scan-info)
200            (setq entry            (setq entry
201                  (assoc label (symbol-value reftex-docstruct-symbol)))))                  (assoc label (symbol-value reftex-docstruct-symbol)))))
202      (if (eq how 'echo)      (if (eq how 'echo)
203          ;; Display in echo area          ;; Display in echo area
# Line 240  With argument, actually select the windo Line 243  With argument, actually select the windo
243                                   reftex-mouse-view-crossref)))                                   reftex-mouse-view-crossref)))
244         ;; Quick precheck if this might be a relevant spot         ;; Quick precheck if this might be a relevant spot
245         ;; FIXME: Can fail with backslash in comment         ;; FIXME: Can fail with backslash in comment
246         (save-excursion           (save-excursion
247           (search-backward "\\" nil t)           (search-backward "\\" nil t)
248           (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)"))           (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)"))
249    
# Line 258  With argument, actually select the windo Line 261  With argument, actually select the windo
261    (set-window-configuration (get 'reftex-auto-view-crossref 'last-window-conf))    (set-window-configuration (get 'reftex-auto-view-crossref 'last-window-conf))
262    (put 'reftex-auto-view-crossref 'last-window-conf nil)    (put 'reftex-auto-view-crossref 'last-window-conf nil)
263    (remove-hook 'pre-command-hook 'reftex-restore-window-conf))    (remove-hook 'pre-command-hook 'reftex-restore-window-conf))
264                      
265  (defun reftex-echo-ref (label entry docstruct)  (defun reftex-echo-ref (label entry docstruct)
266    ;; Display crossref info in echo area.    ;; Display crossref info in echo area.
267    (cond    (cond
# Line 289  With argument, actually select the windo Line 292  With argument, actually select the windo
292        (unless reftex-revisit-to-echo        (unless reftex-revisit-to-echo
293          (setq files (reftex-visited-files files)))          (setq files (reftex-visited-files files)))
294    
295        (setq entry        (setq entry
296              (condition-case nil              (condition-case nil
297                  (save-excursion                  (save-excursion
298                    (reftex-pop-to-bibtex-entry key files nil nil item t))                    (reftex-pop-to-bibtex-entry key files nil nil item t))
299                (error                (error
300                 (if (and files (= (length all-files) (length files)))                 (if (and files (= (length all-files) (length files)))
301                     (message "cite: no such database entry: %s" key)                     (message "cite: no such database entry: %s" key)
302                   (message (substitute-command-keys                   (message (substitute-command-keys
303                             (format reftex-no-info-message "cite"))))                             (format reftex-no-info-message "cite"))))
304                 nil)))                 nil)))
305        (when entry        (when entry
# Line 334  will display info in the echo area." Line 337  will display info in the echo area."
337            (if (featurep 'xemacs)            (if (featurep 'xemacs)
338                (if reftex-use-itimer-in-xemacs                (if reftex-use-itimer-in-xemacs
339                    (start-itimer "RefTeX Idle Timer"                    (start-itimer "RefTeX Idle Timer"
340                                  'reftex-view-crossref-when-idle                                  'reftex-view-crossref-when-idle
341                                  reftex-idle-time reftex-idle-time t)                                  reftex-idle-time reftex-idle-time t)
342                  (add-hook 'post-command-hook 'reftex-start-itimer-once)                  (add-hook 'post-command-hook 'reftex-start-itimer-once)
343                  t)                  t)
# Line 349  will display info in the echo area." Line 352  will display info in the echo area."
352          (not (itimer-live-p reftex-auto-view-crossref-timer))          (not (itimer-live-p reftex-auto-view-crossref-timer))
353          (setq reftex-auto-view-crossref-timer          (setq reftex-auto-view-crossref-timer
354                (start-itimer "RefTeX Idle Timer"                (start-itimer "RefTeX Idle Timer"
355                              'reftex-view-crossref-when-idle                              'reftex-view-crossref-when-idle
356                              reftex-idle-time nil t))))                              reftex-idle-time nil t))))
357    
358  (defun reftex-view-crossref-from-bibtex (&optional arg)  (defun reftex-view-crossref-from-bibtex (&optional arg)
# Line 359  prompts upon first use for a buffer in R Line 362  prompts upon first use for a buffer in R
362  link to a document, call the function with with a prefix arg.  link to a document, call the function with with a prefix arg.
363  Calling this function several times find successive citation locations."  Calling this function several times find successive citation locations."
364    (interactive "P")    (interactive "P")
365    (when arg    (when arg
366      ;; Break connection to reference buffer      ;; Break connection to reference buffer
367      (put 'reftex-bibtex-view-cite-locations :ref-buffer nil))      (put 'reftex-bibtex-view-cite-locations :ref-buffer nil))
368    (let ((ref-buffer (get 'reftex-bibtex-view-cite-locations :ref-buffer)))    (let ((ref-buffer (get 'reftex-bibtex-view-cite-locations :ref-buffer)))
# Line 367  Calling this function several times find Line 370  Calling this function several times find
370      (unless ref-buffer      (unless ref-buffer
371        (setq ref-buffer        (setq ref-buffer
372              (save-excursion              (save-excursion
373                (completing-read                (completing-read
374                 "Reference buffer: "                 "Reference buffer: "
375                 (delq nil                 (delq nil
376                       (mapcar                       (mapcar
377                        (lambda (b)                        (lambda (b)
378                          (set-buffer b)                          (set-buffer b)
379                          (if reftex-mode (list (buffer-name b)) nil))                          (if reftex-mode (list (buffer-name b)) nil))

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.9.8.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26