Mercurial > emacs
annotate lisp/textmodes/reftex-dcr.el @ 83619:5da6a46ddbd6
* s/darwin.h (SYSTEM_PURESIZE_EXTRA): Define here.
* termhooks.h (union display_info): Add mac_display_info.
* term.c (init_tty): Only use terminal->kboard when MULTI_KBOARD
is defined.
* macterm.h (struct mac_display_info): Add terminal.
* w32term.c (w32_initialize): Make static.
* macterm.c (XTset_terminal_modes): Add a terminal parameter.
(XTreset_terminal_modes): Likewise.
(x_clear_frame): Add a frame parameter.
(note_mouse_movement): Get rif from the frame.
(mac_term_init): Initialize the terminal.
(mac_initialize): Make static and move terminal initialization ...
(mac_create_terminal): ... in this new function.
* macmenu.c: Reorder includes.
(Fx_popup_menu): Use terminal specific mouse_position_hook.
* macfns.c (x_set_mouse_color): Get rif from the frame.
(x_set_tool_bar_lines): Don't use updating_frame.
(mac_window): Add 2 new parameters for consistency with other
systems.
(Fx_create_frame): Fix doc string. Rename the parameter.
(Fx_create_frame): Set the frame parameters following what is done
in X11 and w32.
(Fx_open_connection): Remove window-system check.
(start_hourglass): Likewise.
(x_create_tip_frame): Get the keyboard from the terminal.
* w32fns.c (Fx_create_frame): Use kboard from the terminal.
* term/mac-win.el: Provide mac-win.
(mac-initialized): New variable.
(mac-initialize-window-system): New function. Move global setup
here.
(handle-args-function-alist, frame-creation-function-alist):
(window-system-initialization-alist): Add mac entries.
* loadup.el: Load mac-win on a Mac.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sat, 19 May 2007 19:08:02 +0000 |
parents | 690423f53b08 |
children | b6d25790aab2 4ef881a120fe |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37998
diff
changeset
|
1 ;;; reftex-dcr.el --- viewing cross references and citations with RefTeX |
74506 | 2 |
74507 | 3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
75347 | 4 ;; 2006, 2007 Free Software Foundation, Inc. |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5 |
46612
7522419c4db0
Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents:
38422
diff
changeset
|
6 ;; Author: Carsten Dominik <dominik@science.uva.nl> |
76672
690423f53b08
* textmodes/reftex.el: Add maintainer address.
David Kastrup <dak@gnu.org>
parents:
75347
diff
changeset
|
7 ;; Maintainer: auctex-devel@gnu.org |
69094
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
8 ;; Version: 4.31 |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14 ;; the Free Software Foundation; either version 2, or (at your option) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
15 ;; any later version. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
16 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
21 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
65638
e274642bf5d5
Update FSF street address; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
65583
diff
changeset
|
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
e274642bf5d5
Update FSF street address; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
65583
diff
changeset
|
25 ;; Boston, MA 02110-1301, USA. |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
26 |
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37998
diff
changeset
|
27 ;;; Commentary: |
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37998
diff
changeset
|
28 |
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37998
diff
changeset
|
29 ;;; Code: |
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37998
diff
changeset
|
30 |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
31 (eval-when-compile (require 'cl)) |
27192
f70a80cecdd3
New version number.
Carsten Dominik <dominik@science.uva.nl>
parents:
27170
diff
changeset
|
32 (provide 'reftex-dcr) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
33 (provide 'reftex-vcr) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
34 (require 'reftex) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
35 ;;; |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
36 |
69094
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
37 (defun reftex-view-crossref (&optional arg auto-how fail-quietly) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
38 "View cross reference of macro at point. Point must be on the KEY |
36877
701567828afa
(reftex-view-crossref): Doc fix.
Andreas Schwab <schwab@suse.de>
parents:
34707
diff
changeset
|
39 argument. When at at `\\ref' macro, show corresponding `\\label' |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
40 definition, also in external documents (`xr'). When on a label, show |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
41 a locations where KEY is referenced. Subsequent calls find additional |
36877
701567828afa
(reftex-view-crossref): Doc fix.
Andreas Schwab <schwab@suse.de>
parents:
34707
diff
changeset
|
42 locations. When on a `\\cite', show the associated `\\bibitem' macro or |
701567828afa
(reftex-view-crossref): Doc fix.
Andreas Schwab <schwab@suse.de>
parents:
34707
diff
changeset
|
43 the BibTeX database entry. When on a `\\bibitem', show a `\\cite' macro |
701567828afa
(reftex-view-crossref): Doc fix.
Andreas Schwab <schwab@suse.de>
parents:
34707
diff
changeset
|
44 which uses this KEY. When on an `\\index', show other locations marked |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
45 by the same index entry. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
46 To define additional cross referencing items, use the option |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
47 `reftex-view-crossref-extra'. See also `reftex-view-crossref-from-bibtex'. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
48 With one or two C-u prefixes, enforce rescanning of the document. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
49 With argument 2, select the window showing the cross reference. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
50 AUTO-HOW is only for the automatic crossref display and is handed through |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
51 to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
52 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
53 (interactive "P") |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
54 ;; See where we are. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
55 (let* ((macro (car (reftex-what-macro-safe 1))) |
34707
315a42c87d8d
(reftex-view-crossref): added SPACE and TAB as key separators.
Carsten Dominik <dominik@science.uva.nl>
parents:
34402
diff
changeset
|
56 (key (reftex-this-word "^{}%\n\r, \t")) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
57 dw) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
58 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
59 (if (or (null macro) (reftex-in-comment)) |
69094
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
60 (or fail-quietly |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
61 (error "Not on a crossref macro argument")) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
62 |
69094
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
63 (setq reftex-call-back-to-this-buffer (current-buffer)) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
64 |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
65 (cond |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
66 ((string-match "\\`\\\\cite\\|cite\\*?\\'\\|bibentry" macro) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
67 ;; A citation macro: search for bibitems or BibTeX entries |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
68 (setq dw (reftex-view-cr-cite arg key auto-how))) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
69 ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
70 ;; A reference macro: search for labels |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
71 (setq dw (reftex-view-cr-ref arg key auto-how))) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
72 (auto-how nil) ;; No further action for automatic display (speed) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
73 ((or (equal macro "\\label") |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
74 (member macro reftex-macros-with-labels)) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
75 ;; A label macro: search for reference macros |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
76 (reftex-access-scan-info arg) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
77 (setq dw (reftex-view-regexp-match |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
78 (format reftex-find-reference-format (regexp-quote key)) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
79 4 nil nil))) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
80 ((equal macro "\\bibitem") |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
81 ;; A bibitem macro: search for citations |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
82 (reftex-access-scan-info arg) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
83 (setq dw (reftex-view-regexp-match |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
84 (format reftex-find-citation-regexp-format (regexp-quote key)) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
85 4 nil nil))) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
86 ((member macro reftex-macros-with-index) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
87 (reftex-access-scan-info arg) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
88 (setq dw (reftex-view-regexp-match |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
89 (format reftex-find-index-entry-regexp-format |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
90 (regexp-quote key)) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
91 3 nil nil))) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
92 (t |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
93 (reftex-access-scan-info arg) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
94 (catch 'exit |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
95 (let ((list reftex-view-crossref-extra) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
96 entry mre action group) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
97 (while (setq entry (pop list)) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
98 (setq mre (car entry) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
99 action (nth 1 entry) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
100 group (nth 2 entry)) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
101 (when (string-match mre macro) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
102 (setq dw (reftex-view-regexp-match |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
103 (format action key) group nil nil)) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
104 (throw 'exit t)))) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
105 (error "Not on a crossref macro argument")))) |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
106 (if (and (eq arg 2) (windowp dw)) (select-window dw))))) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
107 |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
108 (defun reftex-view-cr-cite (arg key how) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
109 ;; View crossreference of a ref cite. HOW can have the values |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
110 ;; nil: Show in another window. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
111 ;; echo: Show one-line info in echo area. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
112 ;; tmp-window: Show in small window and arrange for window to disappear. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
113 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
114 ;; Ensure access to scanning info |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
115 (reftex-access-scan-info (or arg current-prefix-arg)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
116 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
117 (if (eq how 'tmp-window) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
118 ;; Remember the window configuration |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
119 (put 'reftex-auto-view-crossref 'last-window-conf |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
120 (current-window-configuration))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
121 |
46973
11e08f9901ea
Update to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
122 (let (files size item (pos (point)) (win (selected-window)) pop-win |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
123 (bibtype (reftex-bib-or-thebib))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
124 ;; Find the citation mode and the file list |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
125 (cond |
46973
11e08f9901ea
Update to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
126 ; ((assq 'bib (symbol-value reftex-docstruct-symbol)) |
11e08f9901ea
Update to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
127 ((eq bibtype 'bib) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
128 (setq item nil |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
129 files (reftex-get-bibfile-list))) |
46973
11e08f9901ea
Update to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
130 ; ((assq 'thebib (symbol-value reftex-docstruct-symbol)) |
11e08f9901ea
Update to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
131 ((eq bibtype 'thebib) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
132 (setq item t |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
133 files (reftex-uniquify |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
134 (mapcar 'cdr |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
135 (reftex-all-assq |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
136 'thebib (symbol-value reftex-docstruct-symbol)))))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
137 (reftex-default-bibliography |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
138 (setq item nil |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
139 files (reftex-default-bibliography))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
140 (how) ;; don't throw for special display |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
141 (t (error "Cannot display crossref"))) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
142 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
143 (if (eq how 'echo) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
144 ;; Display in Echo area |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
145 (reftex-echo-cite key files item) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
146 ;; Display in a window |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
147 (if (not (eq how 'tmp-window)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
148 ;; Normal display |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
149 (reftex-pop-to-bibtex-entry key files nil t item) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
150 ;; A temporary window |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
151 (condition-case nil |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
152 (reftex-pop-to-bibtex-entry key files nil t item) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
153 (error (goto-char pos) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
154 (message "cite: no such citation key %s" key) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
155 (error ""))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
156 ;; Resize the window |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
157 (setq size (max 1 (count-lines (point) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
158 (reftex-end-of-bib-entry item)))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
159 (let ((window-min-height 2)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
160 (shrink-window (1- (- (window-height) size))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
161 (recenter 0)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
162 ;; Arrange restoration |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
163 (add-hook 'pre-command-hook 'reftex-restore-window-conf)) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
164 |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
165 ;; Normal display in other window |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
166 (add-hook 'pre-command-hook 'reftex-highlight-shall-die) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
167 (setq pop-win (selected-window)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
168 (select-window win) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
169 (goto-char pos) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
170 (when (equal arg 2) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
171 (select-window pop-win))))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
172 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
173 (defun reftex-view-cr-ref (arg label how) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
174 ;; View crossreference of a ref macro. HOW can have the values |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
175 ;; nil: Show in another window. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
176 ;; echo: Show one-line info in echo area. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
177 ;; tmp-window: Show in small window and arrange for window to disappear. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
178 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
179 ;; Ensure access to scanning info |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
180 (reftex-access-scan-info (or arg current-prefix-arg)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
181 |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
182 (if (eq how 'tmp-window) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
183 ;; Remember the window configuration |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
184 (put 'reftex-auto-view-crossref 'last-window-conf |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
185 (current-window-configuration))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
186 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
187 (let* ((xr-data (assoc 'xr (symbol-value reftex-docstruct-symbol))) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
188 (xr-re (nth 2 xr-data)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
189 (entry (assoc label (symbol-value reftex-docstruct-symbol))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
190 (win (selected-window)) pop-win (pos (point))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
191 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
192 (if (and (not entry) (stringp label) xr-re (string-match xr-re label)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
193 ;; Label is defined in external document |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
194 (save-excursion |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
195 (save-match-data |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
196 (set-buffer |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
197 (or (reftex-get-file-buffer-force |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
198 (cdr (assoc (match-string 1 label) (nth 1 |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
199 xr-data)))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
200 (error "Problem with external label %s" label)))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
201 (setq label (substring label (match-end 1))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
202 (reftex-access-scan-info) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
203 (setq entry |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
204 (assoc label (symbol-value reftex-docstruct-symbol))))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
205 (if (eq how 'echo) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
206 ;; Display in echo area |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
207 (reftex-echo-ref label entry (symbol-value reftex-docstruct-symbol)) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
208 (let ((window-conf (current-window-configuration))) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
209 (condition-case nil |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
210 (reftex-show-label-location entry t nil t t) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
211 (error (set-window-configuration window-conf) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
212 (message "ref: Label %s not found" label) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
213 (error "ref: Label %s not found" label)))) ;; 2nd is line OK |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
214 (add-hook 'pre-command-hook 'reftex-highlight-shall-die) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
215 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
216 (when (eq how 'tmp-window) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
217 ;; Resize window and arrange restauration |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
218 (shrink-window (1- (- (window-height) 9))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
219 (recenter '(4)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
220 (add-hook 'pre-command-hook 'reftex-restore-window-conf)) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
221 (setq pop-win (selected-window)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
222 (select-window win) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
223 (goto-char pos) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
224 (when (equal arg 2) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
225 (select-window pop-win))))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
226 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
227 (defun reftex-mouse-view-crossref (ev) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
228 "View cross reference of \\ref or \\cite macro where you click. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
229 If the macro at point is a \\ref, show the corresponding label definition. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
230 If it is a \\cite, show the BibTeX database entry. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
231 If there is no such macro at point, search forward to find one. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
232 With argument, actually select the window showing the cross reference." |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
233 (interactive "e") |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
234 (mouse-set-point ev) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
235 (reftex-view-crossref current-prefix-arg)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
236 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
237 (defun reftex-view-crossref-when-idle () |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
238 ;; Display info about crossref at point in echo area or a window. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
239 ;; This function was desigend to work with an idle timer. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
240 ;; We try to get out of here as quickly as possible if the call is useless. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
241 (and reftex-mode |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
242 ;; Make sure message area is free if we need it. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
243 (or (eq reftex-auto-view-crossref 'window) (not (current-message))) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
244 ;; Make sure we are not already displaying this one |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
245 (not (memq last-command '(reftex-view-crossref |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
246 reftex-mouse-view-crossref))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
247 ;; Quick precheck if this might be a relevant spot |
69094
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
248 ;; `reftex-view-crossref' will do a more thorough check. |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
249 (save-excursion |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
250 (search-backward "\\" nil t) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
251 (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)")) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
252 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
253 (condition-case nil |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
254 (let ((current-prefix-arg nil)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
255 (cond |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
256 ((eq reftex-auto-view-crossref t) |
69094
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
257 (reftex-view-crossref -1 'echo 'quiet)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
258 ((eq reftex-auto-view-crossref 'window) |
69094
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
259 (reftex-view-crossref -1 'tmp-window 'quiet)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
260 (t nil))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
261 (error nil)))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
262 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
263 (defun reftex-restore-window-conf () |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
264 (set-window-configuration (get 'reftex-auto-view-crossref 'last-window-conf)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
265 (put 'reftex-auto-view-crossref 'last-window-conf nil) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
266 (remove-hook 'pre-command-hook 'reftex-restore-window-conf)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
267 |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
268 (defun reftex-echo-ref (label entry docstruct) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
269 ;; Display crossref info in echo area. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
270 (cond |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
271 ((null docstruct) |
69094
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
272 (message "%s" |
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
273 (substitute-command-keys (format reftex-no-info-message "ref")))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
274 ((null entry) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
275 (message "ref: unknown label: %s" label)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
276 (t |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
277 (when (stringp (nth 2 entry)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
278 (message "ref(%s): %s" (nth 1 entry) (nth 2 entry))) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
279 (let ((buf (get-buffer " *Echo Area*"))) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
280 (when buf |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
281 (save-excursion |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
282 (set-buffer buf) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
283 (run-hooks 'reftex-display-copied-context-hook))))))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
284 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
285 (defun reftex-echo-cite (key files item) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
286 ;; Display citation info in echo area. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
287 (let* ((cache (assq 'bibview-cache (symbol-value reftex-docstruct-symbol))) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
288 (cache-entry (assoc key (cdr cache))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
289 entry string buf (all-files files)) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
290 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
291 (if (and reftex-cache-cite-echo cache-entry) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
292 ;; We can just use the cache |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
293 (setq string (cdr cache-entry)) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
294 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
295 ;; Need to look in the database |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
296 (unless reftex-revisit-to-echo |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
297 (setq files (reftex-visited-files files))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
298 |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
299 (setq entry |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
300 (condition-case nil |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
301 (save-excursion |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
302 (reftex-pop-to-bibtex-entry key files nil nil item t)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
303 (error |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
304 (if (and files (= (length all-files) (length files))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
305 (message "cite: no such database entry: %s" key) |
65583
703495630901
Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents:
65548
diff
changeset
|
306 (message "%s" (substitute-command-keys |
69094
bfd5c5e60410
Version number change only
Carsten Dominik <dominik@science.uva.nl>
parents:
68648
diff
changeset
|
307 (format reftex-no-info-message "cite")))) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
308 nil))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
309 (when entry |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
310 (if item |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
311 (setq string (reftex-nicify-text entry)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
312 (setq string (reftex-make-cite-echo-string |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
313 (reftex-parse-bibtex-entry entry) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
314 reftex-docstruct-symbol))))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
315 (unless (or (null string) (equal string "")) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
316 (message "cite: %s" string)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
317 (when (setq buf (get-buffer " *Echo Area*")) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
318 (save-excursion |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
319 (set-buffer buf) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
320 (run-hooks 'reftex-display-copied-context-hook))))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
321 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
322 (defvar reftex-use-itimer-in-xemacs nil |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
323 "*Non-nil means use the idle timers in XEmacs for crossref display. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
324 Currently, idle timer restart is broken and we use the post-command-hook.") |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
325 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
326 (defun reftex-toggle-auto-view-crossref () |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
327 "Toggle the automatic display of crossref information in the echo area. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
328 When active, leaving point idle in the argument of a \\ref or \\cite macro |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
329 will display info in the echo area." |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
330 (interactive) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
331 (if reftex-auto-view-crossref-timer |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
332 (progn |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
333 (if (featurep 'xemacs) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
334 (if reftex-use-itimer-in-xemacs |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
335 (delete-itimer reftex-auto-view-crossref-timer) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
336 (remove-hook 'post-command-hook 'reftex-start-itimer-once)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
337 (cancel-timer reftex-auto-view-crossref-timer)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
338 (setq reftex-auto-view-crossref-timer nil) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
339 (message "Automatic display of crossref information was turned off")) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
340 (setq reftex-auto-view-crossref-timer |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
341 (if (featurep 'xemacs) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
342 (if reftex-use-itimer-in-xemacs |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
343 (start-itimer "RefTeX Idle Timer" |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
344 'reftex-view-crossref-when-idle |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
345 reftex-idle-time reftex-idle-time t) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
346 (add-hook 'post-command-hook 'reftex-start-itimer-once) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
347 t) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
348 (run-with-idle-timer |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
349 reftex-idle-time t 'reftex-view-crossref-when-idle))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
350 (unless reftex-auto-view-crossref |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
351 (setq reftex-auto-view-crossref t)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
352 (message "Automatic display of crossref information was turned on"))) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
353 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
354 (defun reftex-start-itimer-once () |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
355 (and reftex-mode |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
356 (not (itimer-live-p reftex-auto-view-crossref-timer)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
357 (setq reftex-auto-view-crossref-timer |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
358 (start-itimer "RefTeX Idle Timer" |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
359 'reftex-view-crossref-when-idle |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
360 reftex-idle-time nil t)))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
361 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
362 (defun reftex-view-crossref-from-bibtex (&optional arg) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
363 "View location in a LaTeX document which cites the BibTeX entry at point. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
364 Since BibTeX files can be used by many LaTeX documents, this function |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
365 prompts upon first use for a buffer in RefTeX mode. To reset this |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
366 link to a document, call the function with with a prefix arg. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
367 Calling this function several times find successive citation locations." |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
368 (interactive "P") |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
369 (when arg |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
370 ;; Break connection to reference buffer |
29775
31536c6cf2e3
* textmodes/reftex.el (reftex-find-citation-regexp-format):
Carsten Dominik <dominik@science.uva.nl>
parents:
27604
diff
changeset
|
371 (put 'reftex-bibtex-view-cite-locations :ref-buffer nil)) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
372 (let ((ref-buffer (get 'reftex-bibtex-view-cite-locations :ref-buffer))) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
373 ;; Establish connection to reference buffer |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
374 (unless ref-buffer |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
375 (setq ref-buffer |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
376 (save-excursion |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
377 (completing-read |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
378 "Reference buffer: " |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
379 (delq nil |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
380 (mapcar |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
381 (lambda (b) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
382 (set-buffer b) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
383 (if reftex-mode (list (buffer-name b)) nil)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
384 (buffer-list))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
385 nil t))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
386 (put 'reftex-bibtex-view-cite-locations :ref-buffer ref-buffer)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
387 ;; Search for citations |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
388 (bibtex-beginning-of-entry) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
389 (if (looking-at |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
390 "@[a-zA-Z]+[ \t\n\r]*[{(][ \t\n\r]*\\([^, \t\r\n}]+\\)") |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
391 (progn |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
392 (goto-char (match-beginning 1)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
393 (reftex-view-regexp-match |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
394 (format reftex-find-citation-regexp-format |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
395 (regexp-quote (match-string 1))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
396 4 arg ref-buffer)) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
397 (error "Cannot find citation key in BibTeX entry")))) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
398 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
399 (defun reftex-view-regexp-match (re &optional highlight-group new ref-buffer) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
400 ;; Search for RE in current document or in the document of REF-BUFFER. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
401 ;; Continue the search, if the same re was searched last. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
402 ;; Highlight the group HIGHLIGHT-GROUP of the match. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
403 ;; When NEW is non-nil, start a new search regardless. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
404 ;; Match point is displayed in another window. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
405 ;; Upon success, returns the window which displays the match. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
406 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
407 ;;; Decide if new search or continued search |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
408 (let* ((oldprop (get 'reftex-view-regexp-match :props)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
409 (newprop (list (current-buffer) re)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
410 (cont (and (not new) (equal oldprop newprop))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
411 (cnt (if cont (get 'reftex-view-regexp-match :cnt) 0)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
412 (current-window (selected-window)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
413 (window-conf (current-window-configuration)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
414 match pop-window) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
415 (switch-to-buffer-other-window (or ref-buffer (current-buffer))) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
416 ;; Search |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
417 (condition-case nil |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
418 (if cont |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
419 (setq match (reftex-global-search-continue)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
420 (reftex-access-scan-info) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
421 (setq match (reftex-global-search re (reftex-all-document-files)))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
422 (error nil)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
423 ;; Evaluate the match. |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
424 (if match |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
425 (progn |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
426 (put 'reftex-view-regexp-match :props newprop) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
427 (put 'reftex-view-regexp-match :cnt (incf cnt)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
428 (reftex-highlight 0 (match-beginning highlight-group) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
429 (match-end highlight-group)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
430 (add-hook 'pre-command-hook 'reftex-highlight-shall-die) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
431 (setq pop-window (selected-window))) |
29775
31536c6cf2e3
* textmodes/reftex.el (reftex-find-citation-regexp-format):
Carsten Dominik <dominik@science.uva.nl>
parents:
27604
diff
changeset
|
432 (put 'reftex-view-regexp-match :props nil) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
433 (or cont (set-window-configuration window-conf))) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
434 (select-window current-window) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
435 (if match |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
436 (progn |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
437 (message "Match Nr. %s" cnt) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
438 pop-window) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
439 (if cont |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
440 (error "No further matches (total number of matches: %d)" cnt) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
441 (error "No matches"))))) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
442 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
443 (defvar reftex-global-search-marker (make-marker)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
444 (defun reftex-global-search (regexp file-list) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
445 ;; Start a search for REGEXP in all files of FILE-LIST |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
446 (put 'reftex-global-search :file-list file-list) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
447 (put 'reftex-global-search :regexp regexp) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
448 (move-marker reftex-global-search-marker nil) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
449 (reftex-global-search-continue)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
450 |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
451 (defun reftex-global-search-continue () |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
452 ;; Continue a global search started with `reftex-global-search' |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
453 (unless (get 'reftex-global-search :file-list) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
454 (error "No global search to continue")) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
455 (let* ((file-list (get 'reftex-global-search :file-list)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
456 (regexp (get 'reftex-global-search :regexp)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
457 (buf (or (marker-buffer reftex-global-search-marker) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
458 (reftex-get-file-buffer-force (car file-list)))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
459 (pos (or (marker-position reftex-global-search-marker) 1)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
460 file) |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
461 ;; Take up starting position |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
462 (unless buf (error "No such buffer %s" buf)) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
463 (switch-to-buffer buf) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
464 (widen) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
465 (goto-char pos) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
466 ;; Search and switch file if necessary |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
467 (if (catch 'exit |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
468 (while t |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
469 (when (re-search-forward regexp nil t) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
470 (move-marker reftex-global-search-marker (point)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
471 (throw 'exit t)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
472 ;; No match - goto next file |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
473 (pop file-list) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
474 (or file-list (throw 'exit nil)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
475 (setq file (car file-list) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
476 buf (reftex-get-file-buffer-force file)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
477 (unless buf (error "Cannot access file %s" file)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
478 (put 'reftex-global-search :file-list file-list) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
479 (switch-to-buffer buf) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
480 (widen) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
481 (goto-char 1))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
482 t |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
483 (move-marker reftex-global-search-marker nil) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
484 (error "All files processed")))) |
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
485 |
52401 | 486 ;;; arch-tag: d2f52b56-744e-44ad-830d-1fc193b90eda |
27170
3cba3e588544
renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
487 ;;; reftex-dcr.el ends here |