Mercurial > emacs
annotate lisp/textmodes/reftex-sel.el @ 112441:2097405cdc11
Merge: Check return values of some library calls.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sat, 22 Jan 2011 23:32:08 -0800 |
parents | 6e613fbf73d7 |
children |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37998
diff
changeset
|
1 ;;; reftex-sel.el --- the selection modes for RefTeX |
74508
0b524ec529e1
Fix time-travelling copyright years.
Glenn Morris <rgm@gnu.org>
parents:
69177
diff
changeset
|
2 |
0b524ec529e1
Fix time-travelling copyright years.
Glenn Morris <rgm@gnu.org>
parents:
69177
diff
changeset
|
3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
4 ;; 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
27035 | 5 |
46612
7522419c4db0
Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents:
43352
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 |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
9 ;; Package: reftex |
27035 | 10 |
11 ;; This file is part of GNU Emacs. | |
12 | |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
27035 | 14 ;; it under the terms of the GNU General Public License as published by |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
16 ;; (at your option) any later version. |
27035 | 17 |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
25280 | 25 |
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37998
diff
changeset
|
26 ;;; Commentary: |
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37998
diff
changeset
|
27 |
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37998
diff
changeset
|
28 ;;; Code: |
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37998
diff
changeset
|
29 |
26910
489a5439b988
* reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents:
25806
diff
changeset
|
30 (eval-when-compile (require 'cl)) |
25280 | 31 (provide 'reftex-sel) |
32 (require 'reftex) | |
33 ;;; | |
34 | |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
35 ;; Common bindings in reftex-select-label-mode-map |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
36 ;; and reftex-select-bib-mode-map. |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
37 (defvar reftex-select-shared-map |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
38 (let ((map (make-sparse-keymap))) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
39 (substitute-key-definition |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
40 'next-line 'reftex-select-next map global-map) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
41 (substitute-key-definition |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
42 'previous-line 'reftex-select-previous map global-map) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
43 (substitute-key-definition |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
44 'keyboard-quit 'reftex-select-keyboard-quit map global-map) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
45 (substitute-key-definition |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
46 'newline 'reftex-select-accept map global-map) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
47 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
48 (loop for x in |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
49 '((" " . reftex-select-callback) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
50 ("n" . reftex-select-next) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
51 ([(down)] . reftex-select-next) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
52 ("p" . reftex-select-previous) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
53 ([(up)] . reftex-select-previous) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
54 ("f" . reftex-select-toggle-follow) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
55 ("\C-m" . reftex-select-accept) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
56 ([(return)] . reftex-select-accept) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
57 ("q" . reftex-select-quit) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
58 ("." . reftex-select-show-insertion-point) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
59 ("?" . reftex-select-help)) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
60 do (define-key map (car x) (cdr x))) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
61 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
62 ;; The mouse-2 binding |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
63 (if (featurep 'xemacs) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
64 (define-key map [(button2)] 'reftex-select-mouse-accept) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
65 (define-key map [(mouse-2)] 'reftex-select-mouse-accept) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
66 (define-key map [follow-link] 'mouse-face)) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
67 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
68 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
69 ;; Digit arguments |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
70 (loop for key across "0123456789" do |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
71 (define-key map (vector (list key)) 'digit-argument)) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
72 (define-key map "-" 'negative-argument) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
73 map)) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
74 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
75 (defvar reftex-select-label-mode-map |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
76 (let ((map (make-sparse-keymap))) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
77 (set-keymap-parent map reftex-select-shared-map) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
78 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
79 (loop for key across "aAcgFlrRstx#%" do |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
80 (define-key map (vector (list key)) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
81 (list 'lambda '() |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
82 "Press `?' during selection to find out about this key." |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
83 '(interactive) (list 'throw '(quote myexit) key)))) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
84 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
85 (loop for x in |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
86 '(("b" . reftex-select-jump-to-previous) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
87 ("z" . reftex-select-jump) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
88 ("v" . reftex-select-toggle-varioref) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
89 ("V" . reftex-select-toggle-fancyref) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
90 ("m" . reftex-select-mark) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
91 ("u" . reftex-select-unmark) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
92 ("," . reftex-select-mark-comma) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
93 ("-" . reftex-select-mark-to) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
94 ("+" . reftex-select-mark-and) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
95 ([(tab)] . reftex-select-read-label) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
96 ("\C-i" . reftex-select-read-label) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
97 ("\C-c\C-n" . reftex-select-next-heading) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
98 ("\C-c\C-p" . reftex-select-previous-heading)) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
99 do |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
100 (define-key map (car x) (cdr x))) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
101 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
102 map) |
25280 | 103 "Keymap used for *RefTeX Select* buffer, when selecting a label. |
104 This keymap can be used to configure the label selection process which is | |
105 started with the command \\[reftex-reference].") | |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
106 (define-obsolete-variable-alias |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
107 'reftex-select-label-map 'reftex-select-label-mode-map "24.1") |
25280 | 108 |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
109 (define-derived-mode reftex-select-label-mode fundamental-mode "LSelect" |
25280 | 110 "Major mode for selecting a label in a LaTeX document. |
111 This buffer was created with RefTeX. | |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
112 It only has a meaningful keymap when you are in the middle of a |
25280 | 113 selection process. |
114 To select a label, move the cursor to it and press RET. | |
115 Press `?' for a summary of important key bindings. | |
116 | |
117 During a selection process, these are the local bindings. | |
118 | |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
119 \\{reftex-select-label-mode-map}" |
46683
060f433ebf11
Updated to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46612
diff
changeset
|
120 (when (featurep 'xemacs) |
060f433ebf11
Updated to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46612
diff
changeset
|
121 ;; XEmacs needs the call to make-local-hook |
060f433ebf11
Updated to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46612
diff
changeset
|
122 (make-local-hook 'pre-command-hook) |
060f433ebf11
Updated to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46612
diff
changeset
|
123 (make-local-hook 'post-command-hook)) |
25280 | 124 (set (make-local-variable 'reftex-select-marked) nil) |
125 (when (syntax-table-p reftex-latex-syntax-table) | |
126 (set-syntax-table reftex-latex-syntax-table)) | |
127 ;; We do not set a local map - reftex-select-item does this. | |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
128 ) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
129 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
130 (defvar reftex-select-bib-mode-map |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
131 (let ((map (make-sparse-keymap))) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
132 (set-keymap-parent map reftex-select-shared-map) |
25280 | 133 |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
134 (loop for key across "grRaAeE" do |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
135 (define-key map (vector (list key)) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
136 (list 'lambda '() |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
137 "Press `?' during selection to find out about this key." |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
138 '(interactive) (list 'throw '(quote myexit) key)))) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
139 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
140 (loop for x in |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
141 '(("\C-i" . reftex-select-read-cite) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
142 ([(tab)] . reftex-select-read-cite) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
143 ("m" . reftex-select-mark) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
144 ("u" . reftex-select-unmark)) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
145 do (define-key map (car x) (cdr x))) |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
146 |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
147 map) |
25280 | 148 "Keymap used for *RefTeX Select* buffer, when selecting a BibTeX entry. |
149 This keymap can be used to configure the BibTeX selection process which is | |
150 started with the command \\[reftex-citation].") | |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
151 (define-obsolete-variable-alias |
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
152 'reftex-select-bib-map 'reftex-select-bib-mode-map "24.1") |
25280 | 153 |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
154 (define-derived-mode reftex-select-bib-mode fundamental-mode "BSelect" |
25280 | 155 "Major mode for selecting a citation key in a LaTeX document. |
156 This buffer was created with RefTeX. | |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
157 It only has a meaningful keymap when you are in the middle of a |
25280 | 158 selection process. |
159 In order to select a citation, move the cursor to it and press RET. | |
160 Press `?' for a summary of important key bindings. | |
161 | |
162 During a selection process, these are the local bindings. | |
163 | |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
164 \\{reftex-select-label-mode-map}" |
46683
060f433ebf11
Updated to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46612
diff
changeset
|
165 (when (featurep 'xemacs) |
060f433ebf11
Updated to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46612
diff
changeset
|
166 ;; XEmacs needs the call to make-local-hook |
060f433ebf11
Updated to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46612
diff
changeset
|
167 (make-local-hook 'pre-command-hook) |
060f433ebf11
Updated to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents:
46612
diff
changeset
|
168 (make-local-hook 'post-command-hook)) |
25280 | 169 (set (make-local-variable 'reftex-select-marked) nil) |
170 ;; We do not set a local map - reftex-select-item does this. | |
112213
6e613fbf73d7
Use run-mode-hooks for major mode hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111422
diff
changeset
|
171 ) |
25280 | 172 |
105813
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
173 ;; (defun reftex-get-offset (buf here-am-I &optional typekey toc index file) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
174 ;; ;; Find the correct offset data, like insert-docstruct would, but faster. |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
175 ;; ;; Buffer BUF knows the correct docstruct to use. |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
176 ;; ;; Basically this finds the first docstruct entry after HERE-I-AM which |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
177 ;; ;; is of allowed type. The optional arguments specify what is allowed. |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
178 ;; (catch 'exit |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
179 ;; (with-current-buffer buf |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
180 ;; (reftex-access-scan-info) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
181 ;; (let* ((rest (memq here-am-I (symbol-value reftex-docstruct-symbol))) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
182 ;; entry) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
183 ;; (while (setq entry (pop rest)) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
184 ;; (if (or (and typekey |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
185 ;; (stringp (car entry)) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
186 ;; (or (equal typekey " ") |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
187 ;; (equal typekey (nth 1 entry)))) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
188 ;; (and toc (eq (car entry) 'toc)) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
189 ;; (and index (eq (car entry) 'index)) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
190 ;; (and file |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
191 ;; (memq (car entry) '(bof eof file-error)))) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
192 ;; (throw 'exit entry))) |
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
193 ;; nil)))) |
47050
904fd28be439
Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
194 |
25280 | 195 (defun reftex-get-offset (buf here-am-I &optional typekey toc index file) |
196 ;; Find the correct offset data, like insert-docstruct would, but faster. | |
197 ;; Buffer BUF knows the correct docstruct to use. | |
47050
904fd28be439
Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
198 ;; Basically this finds the first docstruct entry before HERE-I-AM which |
25280 | 199 ;; is of allowed type. The optional arguments specify what is allowed. |
200 (catch 'exit | |
105813
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
201 (with-current-buffer buf |
25280 | 202 (reftex-access-scan-info) |
47050
904fd28be439
Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
203 (let* ((rest (symbol-value reftex-docstruct-symbol)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
204 lastentry entry) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
205 (while (setq entry (pop rest)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
206 (if (or (and typekey |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
207 (stringp (car entry)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
208 (or (equal typekey " ") |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
209 (equal typekey (nth 1 entry)))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
210 (and toc (eq (car entry) 'toc)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
211 (and index (eq (car entry) 'index)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
212 (and file |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
213 (memq (car entry) '(bof eof file-error)))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
214 (setq lastentry entry)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
215 (if (eq entry here-am-I) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
216 (throw 'exit (or lastentry entry)))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
217 nil)))) |
25280 | 218 |
219 (defun reftex-insert-docstruct | |
220 (buf toc labels index-entries files context counter show-commented | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
221 here-I-am xr-prefix toc-buffer) |
25280 | 222 ;; Insert an excerpt of the docstruct list. |
223 ;; Return the data property of the entry corresponding to HERE-I-AM. | |
224 ;; BUF is the buffer which has the correct docstruct-symbol. | |
225 ;; LABELS non-nil means to include labels into the list. | |
226 ;; When a string, indicates the label type to include | |
34402
5eec8d1d09f0
Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents:
29775
diff
changeset
|
227 ;; FILES non-nil means to display file boundaries. |
25280 | 228 ;; CONTEXT non-nil means to include label context. |
229 ;; COUNTER means to count the labels. | |
230 ;; SHOW-COMMENTED means to include also labels which are commented out. | |
231 ;; HERE-I-AM is a member of the docstruct list. The function will return | |
232 ;; a used member near to this one, as a possible starting point. | |
233 ;; XR-PREFIX is the prefix to put in front of labels. | |
234 ;; TOC-BUFFER means this is to fill the toc buffer. | |
235 (let* ((font (reftex-use-fonts)) | |
236 (cnt 0) | |
237 (index -1) | |
238 (toc-indent " ") | |
239 (label-indent | |
240 (concat "> " | |
241 (if toc (make-string (* 7 reftex-level-indent) ?\ ) ""))) | |
242 (context-indent | |
243 (concat ". " | |
244 (if toc (make-string (* 7 reftex-level-indent) ?\ ) ""))) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
245 (mouse-face |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
246 (if (memq reftex-highlight-selection '(mouse both)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
247 reftex-mouse-selected-face |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
248 nil)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
249 (label-face (reftex-verified-face reftex-label-face |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
250 'font-lock-constant-face |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
251 'font-lock-reference-face)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
252 (index-face (reftex-verified-face reftex-index-face |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
253 'font-lock-constant-face |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
254 'font-lock-reference-face)) |
25280 | 255 all cell text label typekey note comment master-dir-re |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
256 prev-inserted offset from to index-tag docstruct-symbol) |
25280 | 257 |
258 ;; Pop to buffer buf to get the correct buffer-local variables | |
105813
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
259 (with-current-buffer buf |
25280 | 260 |
261 ;; Ensure access to scanning info | |
262 (reftex-access-scan-info) | |
263 | |
264 (setq docstruct-symbol reftex-docstruct-symbol | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
265 all (symbol-value reftex-docstruct-symbol) |
25280 | 266 reftex-active-toc nil |
267 master-dir-re | |
268 (concat "\\`" (regexp-quote | |
269 (file-name-directory (reftex-TeX-master-file)))))) | |
270 | |
271 (set (make-local-variable 'reftex-docstruct-symbol) docstruct-symbol) | |
272 (set (make-local-variable 'reftex-prefix) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
273 (cdr (assoc labels reftex-typekey-to-prefix-alist))) |
25280 | 274 (if (equal reftex-prefix " ") (setq reftex-prefix nil)) |
275 | |
276 ;; Walk the docstruct and insert the appropriate stuff | |
277 (while (setq cell (pop all)) | |
278 | |
279 (incf index) | |
280 (setq from (point)) | |
281 | |
282 (cond | |
283 | |
284 ((memq (car cell) '(bib thebib label-numbers appendix | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
285 master-dir bibview-cache is-multi xr xr-doc))) |
25280 | 286 ;; These are currently ignored |
287 | |
288 ((memq (car cell) '(bof eof file-error)) | |
289 ;; Beginning or end of a file | |
290 (when files | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
291 (setq prev-inserted cell) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
292 ; (if (eq offset 'attention) (setq offset cell)) |
25280 | 293 (insert |
294 " File " (if (string-match master-dir-re (nth 1 cell)) | |
295 (substring (nth 1 cell) (match-end 0)) | |
296 (nth 1 cell)) | |
297 (cond ((eq (car cell) 'bof) " starts here\n") | |
298 ((eq (car cell) 'eof) " ends here\n") | |
299 ((eq (car cell) 'file-error) " was not found\n"))) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
300 (setq to (point)) |
25280 | 301 (when font |
302 (put-text-property from to | |
303 'face reftex-file-boundary-face)) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
304 (when toc-buffer |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
305 (if mouse-face |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
306 (put-text-property from (1- to) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
307 'mouse-face mouse-face)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
308 (put-text-property from to :data cell)))) |
25280 | 309 |
310 ((eq (car cell) 'toc) | |
311 ;; a table of contents entry | |
26910
489a5439b988
* reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents:
25806
diff
changeset
|
312 (when (and toc |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
313 (<= (nth 5 cell) reftex-toc-max-level)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
314 (setq prev-inserted cell) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
315 ; (if (eq offset 'attention) (setq offset cell)) |
25280 | 316 (setq reftex-active-toc cell) |
317 (insert (concat toc-indent (nth 2 cell) "\n")) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
318 (setq to (point)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
319 (when font |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
320 (put-text-property from to |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
321 'face reftex-section-heading-face)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
322 (when toc-buffer |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
323 (if mouse-face |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
324 (put-text-property from (1- to) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
325 'mouse-face mouse-face)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
326 (put-text-property from to :data cell)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
327 (goto-char to))) |
25280 | 328 |
329 ((stringp (car cell)) | |
330 ;; a label | |
331 (when (null (nth 2 cell)) | |
332 ;; No context yet. Quick update. | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
333 (setcdr cell (cdr (reftex-label-info-update cell))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
334 (put docstruct-symbol 'modified t)) |
25280 | 335 |
336 (setq label (car cell) | |
337 typekey (nth 1 cell) | |
338 text (nth 2 cell) | |
339 comment (nth 4 cell) | |
340 note (nth 5 cell)) | |
341 | |
342 (when (and labels | |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
343 (or (eq labels t) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
344 (string= typekey labels) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
345 (string= labels " ")) |
25280 | 346 (or show-commented (null comment))) |
347 | |
348 ;; Yes we want this one | |
349 (incf cnt) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
350 (setq prev-inserted cell) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
351 ; (if (eq offset 'attention) (setq offset cell)) |
25280 | 352 |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
353 (setq label (concat xr-prefix label)) |
25280 | 354 (when comment (setq label (concat "% " label))) |
355 (insert label-indent label) | |
356 (when font | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
357 (setq to (point)) |
25280 | 358 (put-text-property |
359 (- (point) (length label)) to | |
360 'face (if comment | |
361 'font-lock-comment-face | |
362 label-face)) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
363 (goto-char to)) |
25280 | 364 |
365 (insert (if counter (format " (%d) " cnt) "") | |
366 (if comment " LABEL IS COMMENTED OUT " "") | |
367 (if (stringp note) (concat " " note) "") | |
368 "\n") | |
369 (setq to (point)) | |
370 | |
371 (when context | |
372 (insert context-indent text "\n") | |
373 (setq to (point))) | |
374 (put-text-property from to :data cell) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
375 (when mouse-face |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
376 (put-text-property from (1- to) |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
377 'mouse-face mouse-face)) |
25280 | 378 (goto-char to))) |
379 | |
380 ((eq (car cell) 'index) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
381 ;; index entry |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
382 (when (and index-entries |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
383 (or (eq t index-entries) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
384 (string= index-entries (nth 1 cell)))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
385 (setq prev-inserted cell) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
386 ; (if (eq offset 'attention) (setq offset cell)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
387 (setq index-tag (format "<%s>" (nth 1 cell))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
388 (and font |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
389 (put-text-property 0 (length index-tag) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
390 'face reftex-index-tag-face index-tag)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
391 (insert label-indent index-tag " " (nth 7 cell)) |
25280 | 392 |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
393 (when font |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
394 (setq to (point)) |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
395 (put-text-property |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
396 (- (point) (length (nth 7 cell))) to |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
397 'face index-face) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
398 (goto-char to)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
399 (insert "\n") |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
400 (setq to (point)) |
25280 | 401 |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
402 (when context |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
403 (insert context-indent (nth 2 cell) "\n") |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
404 (setq to (point))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
405 (put-text-property from to :data cell) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
406 (when mouse-face |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
407 (put-text-property from (1- to) |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
408 'mouse-face mouse-face)) |
47050
904fd28be439
Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
409 (goto-char to)))) |
904fd28be439
Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
410 |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
411 (if (eq cell here-I-am) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
412 (setq offset 'attention)) |
47050
904fd28be439
Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
413 (if (and prev-inserted (eq offset 'attention)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
414 (setq offset prev-inserted)) |
47050
904fd28be439
Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents:
46683
diff
changeset
|
415 ) |
25280 | 416 |
417 (when (reftex-refontify) | |
418 ;; we need to fontify the buffer | |
419 (reftex-fontify-select-label-buffer buf)) | |
420 (run-hooks 'reftex-display-copied-context-hook) | |
421 offset)) | |
422 | |
423 (defun reftex-find-start-point (fallback &rest locations) | |
424 ;; Set point to the first available LOCATION. When a LOCATION is a list, | |
425 ;; search for such a :data text property. When it is an integer, | |
426 ;; use is as line number. FALLBACK is a buffer position used if everything | |
427 ;; else fails. | |
428 (catch 'exit | |
429 (goto-char (point-min)) | |
430 (let (loc pos) | |
431 (while locations | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
432 (setq loc (pop locations)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
433 (cond |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
434 ((null loc)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
435 ((listp loc) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
436 (setq pos (text-property-any (point-min) (point-max) :data loc)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
437 (when pos |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
438 (goto-char pos) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
439 (throw 'exit t))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
440 ((integerp loc) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
441 (when (<= loc (count-lines (point-min) (point-max))) |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
442 (goto-char (point-min)) |
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
443 (forward-line (1- loc)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
444 (throw 'exit t))))) |
25280 | 445 (goto-char fallback)))) |
446 | |
447 (defvar reftex-last-data nil) | |
448 (defvar reftex-last-line nil) | |
449 (defvar reftex-select-marked nil) | |
450 | |
111422 | 451 (defun reftex-select-item (reftex-select-prompt help-string keymap |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
452 &optional offset |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
453 call-back cb-flag) |
111422 | 454 ;; Select an item, using REFTEX-SELECT-PROMPT. |
455 ;; The function returns a key indicating an exit status, along with a | |
456 ;; data structure indicating which item was selected. | |
457 ;; HELP-STRING contains help. KEYMAP is a keymap with the available | |
458 ;; selection commands. | |
459 ;; OFFSET can be a label list item which will be selected at start. | |
460 ;; When it is t, point will start out at the beginning of the buffer. | |
461 ;; Any other value will cause restart where last selection left off. | |
462 ;; When CALL-BACK is given, it is a function which is called with the index | |
463 ;; of the element. | |
464 ;; CB-FLAG is the initial value of that flag. | |
465 (let (ev reftex-select-data last-data (selection-buffer (current-buffer))) | |
25280 | 466 |
467 (setq reftex-select-marked nil) | |
468 | |
469 (setq ev | |
470 (catch 'myexit | |
471 (save-window-excursion | |
472 (setq truncate-lines t) | |
473 | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
474 ;; Find a good starting point |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
475 (reftex-find-start-point |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
476 (point-min) offset reftex-last-data reftex-last-line) |
25280 | 477 (beginning-of-line 1) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
478 (set (make-local-variable 'reftex-last-follow-point) (point)) |
25280 | 479 |
480 (unwind-protect | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
481 (progn |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
482 (use-local-map keymap) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
483 (add-hook 'pre-command-hook 'reftex-select-pre-command-hook nil t) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
484 (add-hook 'post-command-hook 'reftex-select-post-command-hook nil t) |
111422 | 485 (princ reftex-select-prompt) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
486 (set-marker reftex-recursive-edit-marker (point)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
487 ;; XEmacs does not run post-command-hook here |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
488 (and (featurep 'xemacs) (run-hooks 'post-command-hook)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
489 (recursive-edit)) |
25280 | 490 |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
491 (set-marker reftex-recursive-edit-marker nil) |
105813
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104543
diff
changeset
|
492 (with-current-buffer selection-buffer |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
493 (use-local-map nil) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
494 (remove-hook 'pre-command-hook 'reftex-select-pre-command-hook t) |
85284
4e8918d06189
(reftex-select-item): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
85196
diff
changeset
|
495 (remove-hook 'post-command-hook |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
496 'reftex-select-post-command-hook t)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
497 ;; Kill the mark overlays |
85284
4e8918d06189
(reftex-select-item): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
85196
diff
changeset
|
498 (mapc (lambda (c) (reftex-delete-overlay (nth 1 c))) |
4e8918d06189
(reftex-select-item): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
85196
diff
changeset
|
499 reftex-select-marked))))) |
25280 | 500 |
501 (set (make-local-variable 'reftex-last-line) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
502 (+ (count-lines (point-min) (point)) (if (bolp) 1 0))) |
25280 | 503 (set (make-local-variable 'reftex-last-data) last-data) |
504 (reftex-kill-buffer "*RefTeX Help*") | |
505 (setq reftex-callback-fwd (not reftex-callback-fwd)) ;; ;-))) | |
506 (message "") | |
111422 | 507 (list ev reftex-select-data last-data))) |
25280 | 508 |
509 ;; The following variables are all bound dynamically in `reftex-select-item'. | |
510 ;; The defvars are here only to silence the byte compiler. | |
511 | |
512 (defvar found-list) | |
513 (defvar cb-flag) | |
111422 | 514 (defvar reftex-select-data) |
515 (defvar reftex-select-prompt) | |
25280 | 516 (defvar last-data) |
517 (defvar call-back) | |
518 (defvar help-string) | |
519 | |
520 ;; The selection commands | |
521 | |
522 (defun reftex-select-pre-command-hook () | |
523 (reftex-unhighlight 1) | |
524 (reftex-unhighlight 0)) | |
525 | |
526 (defun reftex-select-post-command-hook () | |
527 (let (b e) | |
111422 | 528 (setq reftex-select-data (get-text-property (point) :data)) |
529 (setq last-data (or reftex-select-data last-data)) | |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
530 |
111422 | 531 (when (and reftex-select-data cb-flag |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
532 (not (equal reftex-last-follow-point (point)))) |
25280 | 533 (setq reftex-last-follow-point (point)) |
111422 | 534 (funcall call-back reftex-select-data reftex-callback-fwd |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
535 (not reftex-revisit-to-follow))) |
111422 | 536 (if reftex-select-data |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
537 (setq b (or (previous-single-property-change |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
538 (1+ (point)) :data) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
539 (point-min)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
540 e (or (next-single-property-change |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
541 (point) :data) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
542 (point-max))) |
25280 | 543 (setq b (point) e (point))) |
544 (and (memq reftex-highlight-selection '(cursor both)) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
545 (reftex-highlight 1 b e)) |
25280 | 546 (if (or (not (pos-visible-in-window-p b)) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
547 (not (pos-visible-in-window-p e))) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
548 (recenter '(4))) |
25280 | 549 (unless (current-message) |
111422 | 550 (princ reftex-select-prompt)))) |
25280 | 551 |
552 (defun reftex-select-next (&optional arg) | |
553 "Move to next selectable item." | |
554 (interactive "p") | |
555 (setq reftex-callback-fwd t) | |
556 (or (eobp) (forward-char 1)) | |
557 (re-search-forward "^[^. \t\n\r]" nil t arg) | |
558 (beginning-of-line 1)) | |
559 (defun reftex-select-previous (&optional arg) | |
560 "Move to previous selectable item." | |
561 (interactive "p") | |
562 (setq reftex-callback-fwd nil) | |
563 (re-search-backward "^[^. \t\n\r]" nil t arg)) | |
37998
706af946b1e7
* reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents:
34402
diff
changeset
|
564 (defun reftex-select-jump (arg) |
706af946b1e7
* reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents:
34402
diff
changeset
|
565 "Jump to a specific section. E.g. '3 z' jumps to section 3. |
706af946b1e7
* reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents:
34402
diff
changeset
|
566 Useful for large TOC's." |
706af946b1e7
* reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents:
34402
diff
changeset
|
567 (interactive "P") |
706af946b1e7
* reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents:
34402
diff
changeset
|
568 (goto-char (point-min)) |
706af946b1e7
* reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents:
34402
diff
changeset
|
569 (re-search-forward |
706af946b1e7
* reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents:
34402
diff
changeset
|
570 (concat "^ *" (number-to-string (if (numberp arg) arg 1)) " ") |
706af946b1e7
* reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents:
34402
diff
changeset
|
571 nil t) |
706af946b1e7
* reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents:
34402
diff
changeset
|
572 (beginning-of-line)) |
25280 | 573 (defun reftex-select-next-heading (&optional arg) |
574 "Move to next table of contentes line." | |
575 (interactive "p") | |
576 (end-of-line) | |
577 (re-search-forward "^ " nil t arg) | |
578 (beginning-of-line)) | |
579 (defun reftex-select-previous-heading (&optional arg) | |
580 "Move to previous table of contentes line." | |
581 (interactive "p") | |
582 (re-search-backward "^ " nil t arg)) | |
583 (defun reftex-select-quit () | |
584 "Abort selection process." | |
585 (interactive) | |
586 (throw 'myexit nil)) | |
587 (defun reftex-select-keyboard-quit () | |
588 "Abort selection process." | |
589 (interactive) | |
590 (throw 'exit t)) | |
591 (defun reftex-select-jump-to-previous () | |
592 "Jump back to where previous selection process left off." | |
593 (interactive) | |
594 (let (pos) | |
595 (cond | |
596 ((and (local-variable-p 'reftex-last-data (current-buffer)) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
597 reftex-last-data |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
598 (setq pos (text-property-any (point-min) (point-max) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
599 :data reftex-last-data))) |
25280 | 600 (goto-char pos)) |
601 ((and (local-variable-p 'reftex-last-line (current-buffer)) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
602 (integerp reftex-last-line)) |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
603 (goto-char (point-min)) |
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
604 (forward-line (1- reftex-last-line))) |
25280 | 605 (t (ding))))) |
606 (defun reftex-select-toggle-follow () | |
607 "Toggle follow mode: Other window follows with full context." | |
608 (interactive) | |
609 (setq reftex-last-follow-point -1) | |
610 (setq cb-flag (not cb-flag))) | |
111422 | 611 |
612 (defvar reftex-refstyle) ; from reftex-reference | |
613 | |
25280 | 614 (defun reftex-select-toggle-varioref () |
615 "Toggle the macro used for referencing the label between \\ref and \\vref." | |
616 (interactive) | |
111422 | 617 (if (string= reftex-refstyle "\\ref") |
618 (setq reftex-refstyle "\\vref") | |
619 (setq reftex-refstyle "\\ref")) | |
25280 | 620 (force-mode-line-update)) |
621 (defun reftex-select-toggle-fancyref () | |
622 "Toggle the macro used for referencing the label between \\ref and \\vref." | |
623 (interactive) | |
111422 | 624 (setq reftex-refstyle |
625 (cond ((string= reftex-refstyle "\\ref") "\\fref") | |
626 ((string= reftex-refstyle "\\fref") "\\Fref") | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
627 (t "\\ref"))) |
25280 | 628 (force-mode-line-update)) |
629 (defun reftex-select-show-insertion-point () | |
630 "Show the point from where selection was started in another window." | |
631 (interactive) | |
632 (let ((this-window (selected-window))) | |
633 (unwind-protect | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
634 (progn |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
635 (switch-to-buffer-other-window |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
636 (marker-buffer reftex-select-return-marker)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
637 (goto-char (marker-position reftex-select-return-marker)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
638 (recenter '(4))) |
25280 | 639 (select-window this-window)))) |
640 (defun reftex-select-callback () | |
641 "Show full context in another window." | |
642 (interactive) | |
111422 | 643 (if reftex-select-data (funcall call-back reftex-select-data reftex-callback-fwd nil) (ding))) |
25280 | 644 (defun reftex-select-accept () |
645 "Accept the currently selected item." | |
646 (interactive) | |
647 (throw 'myexit 'return)) | |
648 (defun reftex-select-mouse-accept (ev) | |
649 "Accept the item at the mouse click." | |
650 (interactive "e") | |
651 (mouse-set-point ev) | |
111422 | 652 (setq reftex-select-data (get-text-property (point) :data)) |
653 (setq last-data (or reftex-select-data last-data)) | |
25280 | 654 (throw 'myexit 'return)) |
655 (defun reftex-select-read-label () | |
656 "Use minibuffer to read a label to reference, with completion." | |
657 (interactive) | |
104543
da8b3e61b182
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
658 (let ((label (completing-read |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
659 "Label: " (symbol-value reftex-docstruct-symbol) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
660 nil nil reftex-prefix))) |
25280 | 661 (unless (or (equal label "") (equal label reftex-prefix)) |
662 (throw 'myexit label)))) | |
663 (defun reftex-select-read-cite () | |
664 "Use minibuffer to read a citation key with completion." | |
665 (interactive) | |
666 (let* ((key (completing-read "Citation key: " found-list)) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
667 (entry (assoc key found-list))) |
25280 | 668 (cond |
669 ((or (null key) (equal key ""))) | |
670 (entry | |
111422 | 671 (setq reftex-select-data entry) |
672 (setq last-data reftex-select-data) | |
25280 | 673 (throw 'myexit 'return)) |
674 (t (throw 'myexit key))))) | |
675 | |
676 (defun reftex-select-mark (&optional separator) | |
677 "Mark the entry." | |
678 (interactive) | |
679 (let* ((data (get-text-property (point) :data)) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
680 boe eoe ovl) |
25280 | 681 (or data (error "No entry to mark at point")) |
682 (if (assq data reftex-select-marked) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
683 (error "Entry is already marked")) |
25280 | 684 (setq boe (or (previous-single-property-change (1+ (point)) :data) |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
685 (point-min)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
686 eoe (or (next-single-property-change (point) :data) (point-max))) |
62467
35f6599373fc
* textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents:
59534
diff
changeset
|
687 (setq ovl (reftex-make-overlay boe eoe)) |
25280 | 688 (push (list data ovl separator) reftex-select-marked) |
62467
35f6599373fc
* textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents:
59534
diff
changeset
|
689 (reftex-overlay-put ovl 'face reftex-select-mark-face) |
35f6599373fc
* textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents:
59534
diff
changeset
|
690 (reftex-overlay-put ovl 'before-string |
35f6599373fc
* textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents:
59534
diff
changeset
|
691 (if separator |
35f6599373fc
* textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents:
59534
diff
changeset
|
692 (format "*%c%d* " separator |
35f6599373fc
* textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents:
59534
diff
changeset
|
693 (length reftex-select-marked)) |
35f6599373fc
* textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents:
59534
diff
changeset
|
694 (format "*%d* " (length reftex-select-marked)))) |
25280 | 695 (message "Entry has mark no. %d" (length reftex-select-marked)))) |
696 | |
697 (defun reftex-select-mark-comma () | |
698 "Mark the entry and store the `comma' separator." | |
699 (interactive) | |
700 (reftex-select-mark ?,)) | |
701 (defun reftex-select-mark-to () | |
702 "Mark the entry and store the `to' separator." | |
703 (interactive) | |
704 (reftex-select-mark ?-)) | |
705 (defun reftex-select-mark-and () | |
706 "Mark the entry and store `and' to separator." | |
707 (interactive) | |
708 (reftex-select-mark ?+)) | |
709 | |
710 (defun reftex-select-unmark () | |
711 "Unmark the entry." | |
712 (interactive) | |
713 (let* ((data (get-text-property (point) :data)) | |
52170
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
714 (cell (assq data reftex-select-marked)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
715 (ovl (nth 1 cell)) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
716 (cnt 0) |
27340819ef07
Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents:
49599
diff
changeset
|
717 sep) |
25280 | 718 (unless cell |
719 (error "No marked entry at point")) | |
62467
35f6599373fc
* textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents:
59534
diff
changeset
|
720 (and ovl (reftex-delete-overlay ovl)) |
25280 | 721 (setq reftex-select-marked (delq cell reftex-select-marked)) |
62467
35f6599373fc
* textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents:
59534
diff
changeset
|
722 (setq cnt (1+ (length reftex-select-marked))) |
85196
5aad543561c0
(reftex-select-unmark): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78225
diff
changeset
|
723 (mapc (lambda (c) |
5aad543561c0
(reftex-select-unmark): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78225
diff
changeset
|
724 (setq sep (nth 2 c)) |
5aad543561c0
(reftex-select-unmark): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78225
diff
changeset
|
725 (reftex-overlay-put (nth 1 c) 'before-string |
5aad543561c0
(reftex-select-unmark): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78225
diff
changeset
|
726 (if sep |
5aad543561c0
(reftex-select-unmark): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78225
diff
changeset
|
727 (format "*%c%d* " sep (decf cnt)) |
5aad543561c0
(reftex-select-unmark): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78225
diff
changeset
|
728 (format "*%d* " (decf cnt))))) |
62467
35f6599373fc
* textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents:
59534
diff
changeset
|
729 reftex-select-marked) |
25280 | 730 (message "Entry no longer marked"))) |
731 | |
732 (defun reftex-select-help () | |
733 "Display a summary of the special key bindings." | |
734 (interactive) | |
735 (with-output-to-temp-buffer "*RefTeX Help*" | |
736 (princ help-string)) | |
737 (reftex-enlarge-to-fit "*RefTeX Help*" t)) | |
738 | |
739 ;;; reftex-sel.el ends here |