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