Mercurial > emacs
annotate lisp/textmodes/bibtex.el @ 18914:f9d2d84a004c
Initial revision
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 23 Jul 1997 02:34:54 +0000 |
parents | 708870732e5d |
children | f15d80b084d8 |
rev | line source |
---|---|
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
1 ;;; bibtex.el --- BibTeX mode for GNU Emacs |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
2 |
18248 | 3 ;; Copyright (C) 1992, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. |
845 | 4 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
5 ;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de> |
14410 | 6 ;; Bengt Martensson <bengt@mathematik.uni-Bremen.de> |
810
80303373daae
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
7 ;; Mark Shapiro <shapiro@corto.inria.fr> |
80303373daae
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
8 ;; Mike Newton <newton@gumby.cs.caltech.edu> |
80303373daae
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
9 ;; Aaron Larson <alarson@src.honeywell.com> |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
10 ;; Maintainer: Stefan Schoef <schoef@offis.uni-oldenburg.de> |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
11 ;; Keywords: BibTeX, LaTeX, TeX |
810
80303373daae
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
12 |
257 | 13 ;; This file is part of GNU Emacs. |
14 | |
15 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
16 ;; it under the terms of the GNU General Public License as published by | |
1851 | 17 ;; the Free Software Foundation; either version 2, or (at your option) |
257 | 18 ;; any later version. |
19 | |
20 ;; GNU Emacs is distributed in the hope that it will be useful, | |
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 ;; GNU General Public License for more details. | |
24 | |
25 ;; You should have received a copy of the GNU General Public License | |
14169 | 26 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
28 ;; Boston, MA 02111-1307, USA. | |
257 | 29 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
30 ;;; Commentary: |
14169 | 31 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
32 ;; Major mode for editing and validating BibTeX files. |
257 | 33 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
34 ;; Usage: |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
35 ;; See documentation for function bibtex-mode (or type "\M-x describe-mode" |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
36 ;; when you are in bibtex-mode). |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
37 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
38 ;; Todo: |
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
39 ;; Distribute texinfo file. |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
40 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
41 ;;; Code: |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
42 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
43 (eval-when-compile |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
44 (require 'compile)) |
14169 | 45 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
46 ;; User Options: |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
47 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
48 (defvar bibtex-mode-hook nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
49 "List of functions to call on entry to BibTeX mode.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
50 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
51 (defvar bibtex-field-delimiters 'braces |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
52 "*Controls type of field delimiters used. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
53 Set this to 'braces or 'double-quotes according to your personal |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
54 preferences. This variable is buffer local.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
55 (make-variable-buffer-local 'bibtex-field-delimiters) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
56 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
57 (defvar bibtex-entry-delimiters 'braces |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
58 "*Controls type of entry delimiters used. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
59 Set this to 'braces or 'parentheses according to your personal |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
60 preferences. This variable is buffer local.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
61 (make-variable-buffer-local 'bibtex-entry-delimiters) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
62 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
63 (defvar bibtex-include-OPTcrossref '("InProceedings" "InCollection") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
64 "*All entries listed here will have an OPTcrossref field.") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
65 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
66 (defvar bibtex-include-OPTkey t |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
67 "*If non-nil, all entries will have an OPTkey field. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
68 If this is a string, it will be used as the initial field text. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
69 If this is a function, it will be called to generate the initial field text.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
70 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
71 (defvar bibtex-user-optional-fields |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
72 '(("annote" "Personal annotation (ignored)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
73 "*List of optional fields the user wants to have always present. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
74 Entries should be of the same form as the OPTIONAL and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
75 CROSSREF-OPTIONAL lists in bibtex-entry-field-alist (see documentation |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
76 of this variable for details).") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
77 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
78 (defvar bibtex-entry-format '(opts-or-alts numerical-fields) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
79 "*Controls type of formatting performed by bibtex-clean-entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
80 It may be t, nil, or a list of symbols out of the following: |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
81 'opts-or-alts (delete empty optional and alternative fields and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
82 remove OPT and ALT prefixes from used fields) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
83 'numerical-fields (delete delimiters around numeral fields) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
84 'page-dashes (change double dashes in page field to single dash |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
85 (for scribe compatibility)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
86 'inherit-booktitle (if entry contains a crossref field and booktitle |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
87 field is empty, it is set to the contents of the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
88 title field of the crossreferenced entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
89 (caution: this will work only if buffer is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
90 correctly sorted)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
91 'realign (realign entries, so that field texts and perhaps equal |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
92 signs (depending on the value of |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
93 bibtex-align-at-equal-sign) begin in the same column) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
94 'last-comma (add or delete comma on end of last field in entry, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
95 depending on the value of bibtex-comma-after-last-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
96 'delimiters (change delimiters according to variables |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
97 bibtex-field-delimiters and bibtex-entry-delimiters) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
98 'unify-case (change case of entry and field names) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
99 Value t means do all of the above formatting actions, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
100 value nil means do no formatting at all.") |
257 | 101 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
102 (defvar bibtex-clean-entry-hook nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
103 "*List of functions to call when entry has been cleaned. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
104 Functions are called with point inside the cleaned entry, buffer is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
105 narrowed to just the entry.") |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
106 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
107 (defvar bibtex-sort-ignore-string-entries t |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
108 "*If non-nil, BibTeX @String entries are not sort-significant. |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
109 That means they are ignored when determining ordering of the buffer |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
110 (e.g. sorting, locating alphabetical position for new entries, etc.). |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
111 This variable is buffer local.") |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
112 (make-variable-buffer-local 'bibtex-sort-ignore-string-entries) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
113 |
12770
5488d9efa7de
(bibtex-maintain-sorted-entries): Make nil the default.
Richard M. Stallman <rms@gnu.org>
parents:
12700
diff
changeset
|
114 (defvar bibtex-maintain-sorted-entries nil |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
115 "*If non-nil, bibtex-mode maintains all BibTeX entries in sorted order. |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
116 Setting this variable to nil will strip off some comfort (e.g. TAB |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
117 completion for reference keys in minibuffer, automatic detection of |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
118 duplicates) from bibtex-mode. See also bibtex-sort-ignore-string-entries. |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
119 This variable is buffer local.") |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
120 (make-variable-buffer-local 'bibtex-maintain-sorted-entries) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
121 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
122 (defvar bibtex-field-kill-ring-max 20 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
123 "*Maximum length of bibtex-field-kill-ring before oldest elements are deleted.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
124 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
125 (defvar bibtex-entry-kill-ring-max 20 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
126 "*Maximum length of bibtex-entry-kill-ring before oldest elements are deleted.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
127 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
128 (defvar bibtex-parse-keys-timeout 60 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
129 "*Specifies interval for parsing buffers. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
130 All BibTeX buffers in emacs are parsed if emacs has been idle |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
131 `bibtex-parse-keys-timeout' seconds. Only buffers which were modified |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
132 after last parsing and which are maintained in sorted order are parsed.") |
15637
405b1ecbf8ba
(bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents:
15565
diff
changeset
|
133 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
134 (defvar bibtex-entry-field-alist |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
135 '( |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
136 ("Article" . (((("author" "Author1 [and Author2 ...] [and others]") |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
137 ("title" "Title of the article (BibTeX converts it to lowercase)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
138 ("journal" "Name of the journal (use string, remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
139 ("year" "Year of publication")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
140 (("volume" "Volume of the journal") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
141 ("number" "Number of the journal (only allowed if entry contains volume)") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
142 ("pages" "Pages in the journal") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
143 ("month" "Month of the publication as a string (remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
144 ("note" "Remarks to be put at the end of the \\bibitem"))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
145 ((("author" "Author1 [and Author2 ...] [and others]") |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
146 ("title" "Title of the article (BibTeX converts it to lowercase)")) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
147 (("pages" "Pages in the journal") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
148 ("journal" "Name of the journal (use string, remove braces)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
149 ("year" "Year of publication") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
150 ("volume" "Volume of the journal") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
151 ("number" "Number of the journal") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
152 ("month" "Month of the publication as a string (remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
153 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
154 ("Book" . (((("author" "Author1 [and Author2 ...] [and others]" "" t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
155 ("editor" "Editor1 [and Editor2 ...] [and others]" "" t) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
156 ("title" "Title of the book") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
157 ("publisher" "Publishing company") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
158 ("year" "Year of publication")) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
159 (("volume" "Volume of the book in the series") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
160 ("number" "Number of the book in a small series (overwritten by volume)") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
161 ("series" "Series in which the book appeared") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
162 ("address" "Address of the publisher") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
163 ("edition" "Edition of the book as a capitalized English word") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
164 ("month" "Month of the publication as a string (remove braces)") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
165 ("note" "Remarks to be put at the end of the \\bibitem"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
166 ((("author" "Author1 [and Author2 ...] [and others]" "" t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
167 ("editor" "Editor1 [and Editor2 ...] [and others]" "" t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
168 ("title" "Title of the book")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
169 (("publisher" "Publishing company") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
170 ("year" "Year of publication") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
171 ("volume" "Volume of the book in the series") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
172 ("number" "Number of the book in a small series (overwritten by volume)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
173 ("series" "Series in which the book appeared") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
174 ("address" "Address of the publisher") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
175 ("edition" "Edition of the book as a capitalized English word") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
176 ("month" "Month of the publication as a string (remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
177 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
178 ("Booklet" . (((("title" "Title of the booklet (BibTeX converts it to lowercase)")) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
179 (("author" "Author1 [and Author2 ...] [and others]") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
180 ("howpublished" "The way in which the booklet was published") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
181 ("address" "Address of the publisher") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
182 ("month" "Month of the publication as a string (remove braces)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
183 ("year" "Year of publication") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
184 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
185 ("InBook" . (((("author" "Author1 [and Author2 ...] [and others]" "" t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
186 ("editor" "Editor1 [and Editor2 ...] [and others]" "" t) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
187 ("title" "Title of the book") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
188 ("chapter" "Chapter in the book") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
189 ("publisher" "Publishing company") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
190 ("year" "Year of publication")) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
191 (("volume" "Volume of the book in the series") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
192 ("number" "Number of the book in a small series (overwritten by volume)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
193 ("series" "Series in which the book appeared") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
194 ("type" "Word to use instead of \"chapter\"") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
195 ("address" "Address of the publisher") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
196 ("edition" "Edition of the book as a capitalized English word") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
197 ("month" "Month of the publication as a string (remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
198 ("pages" "Pages in the book") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
199 ("note" "Remarks to be put at the end of the \\bibitem"))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
200 ((("author" "Author1 [and Author2 ...] [and others]" "" t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
201 ("editor" "Editor1 [and Editor2 ...] [and others]" "" t) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
202 ("title" "Title of the book") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
203 ("chapter" "Chapter in the book")) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
204 (("pages" "Pages in the book") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
205 ("publisher" "Publishing company") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
206 ("year" "Year of publication") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
207 ("volume" "Volume of the book in the series") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
208 ("number" "Number of the book in a small series (overwritten by volume)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
209 ("series" "Series in which the book appeared") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
210 ("type" "Word to use instead of \"chapter\"") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
211 ("address" "Address of the publisher") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
212 ("edition" "Edition of the book as a capitalized English word") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
213 ("month" "Month of the publication as a string (remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
214 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
215 ("InCollection" . (((("author" "Author1 [and Author2 ...] [and others]") |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
216 ("title" "Title of the article in book (BibTeX converts it to lowercase)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
217 ("booktitle" "Name of the book") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
218 ("publisher" "Publishing company") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
219 ("year" "Year of publication")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
220 (("editor" "Editor1 [and Editor2 ...] [and others]") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
221 ("volume" "Volume of the book in the series") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
222 ("number" "Number of the book in a small series (overwritten by volume)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
223 ("series" "Series in which the book appeared") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
224 ("type" "Word to use instead of \"chapter\"") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
225 ("chapter" "Chapter in the book") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
226 ("pages" "Pages in the book") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
227 ("address" "Address of the publisher") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
228 ("edition" "Edition of the book as a capitalized English word") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
229 ("month" "Month of the publication as a string (remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
230 ("note" "Remarks to be put at the end of the \\bibitem"))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
231 ((("author" "Author1 [and Author2 ...] [and others]") |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
232 ("title" "Title of the article in book (BibTeX converts it to lowercase)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
233 ("booktitle" "Name of the book")) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
234 (("pages" "Pages in the book") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
235 ("publisher" "Publishing company") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
236 ("year" "Year of publication") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
237 ("editor" "Editor1 [and Editor2 ...] [and others]") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
238 ("volume" "Volume of the book in the series") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
239 ("number" "Number of the book in a small series (overwritten by volume)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
240 ("series" "Series in which the book appeared") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
241 ("type" "Word to use instead of \"chapter\"") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
242 ("chapter" "Chapter in the book") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
243 ("address" "Address of the publisher") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
244 ("edition" "Edition of the book as a capitalized English word") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
245 ("month" "Month of the publication as a string (remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
246 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
247 ("InProceedings" . (((("author" "Author1 [and Author2 ...] [and others]") |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
248 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
249 ("booktitle" "Name of the conference proceedings") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
250 ("year" "Year of publication")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
251 (("editor" "Editor1 [and Editor2 ...] [and others]") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
252 ("volume" "Volume of the conference proceedings in the series") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
253 ("number" "Number of the conference proceedings in a small series (overwritten by volume)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
254 ("series" "Series in which the conference proceedings appeared") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
255 ("pages" "Pages in the conference proceedings") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
256 ("address" "Location of the Proceedings") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
257 ("month" "Month of the publication as a string (remove braces)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
258 ("organization" "Sponsoring organization of the conference") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
259 ("publisher" "Publishing company, its location") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
260 ("note" "Remarks to be put at the end of the \\bibitem"))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
261 ((("author" "Author1 [and Author2 ...] [and others]") |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
262 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
263 ("booktitle" "Name of the conference proceedings")) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
264 (("pages" "Pages in the conference proceedings") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
265 ("year" "Year of publication") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
266 ("editor" "Editor1 [and Editor2 ...] [and others]") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
267 ("volume" "Volume of the conference proceedings in the series") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
268 ("number" "Number of the conference proceedings in a small series (overwritten by volume)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
269 ("series" "Series in which the conference proceedings appeared") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
270 ("address" "Location of the Proceedings") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
271 ("month" "Month of the publication as a string (remove braces)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
272 ("organization" "Sponsoring organization of the conference") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
273 ("publisher" "Publishing company, its location") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
274 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
275 ("Manual" . (((("title" "Title of the manual")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
276 (("author" "Author1 [and Author2 ...] [and others]") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
277 ("organization" "Publishing organization of the manual") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
278 ("address" "Address of the organization") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
279 ("edition" "Edition of the manual as a capitalized English word") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
280 ("month" "Month of the publication as a string (remove braces)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
281 ("year" "Year of publication") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
282 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
283 ("MastersThesis" . (((("author" "Author1 [and Author2 ...] [and others]") |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
284 ("title" "Title of the master\'s thesis (BibTeX converts it to lowercase)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
285 ("school" "School where the master\'s thesis was written") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
286 ("year" "Year of publication")) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
287 (("type" "Type of the master\'s thesis (if other than \"Master\'s thesis\")") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
288 ("address" "Address of the school (if not part of field \"school\") or country") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
289 ("month" "Month of the publication as a string (remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
290 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
291 ("Misc" . ((() |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
292 (("author" "Author1 [and Author2 ...] [and others]") |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
293 ("title" "Title of the reference (BibTeX converts it to lowercase)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
294 ("howpublished" "The way in which the reference was published") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
295 ("month" "Month of the publication as a string (remove braces)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
296 ("year" "Year of publication") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
297 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
298 ("PhdThesis" . (((("author" "Author1 [and Author2 ...] [and others]") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
299 ("title" "Title of the PhD. thesis") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
300 ("school" "School where the PhD. thesis was written") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
301 ("year" "Year of publication")) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
302 (("type" "Type of the PhD. thesis") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
303 ("address" "Address of the school (if not part of field \"school\") or country") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
304 ("month" "Month of the publication as a string (remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
305 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
306 ("Proceedings" . (((("title" "Title of the conference proceedings") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
307 ("year" "Year of publication")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
308 (("editor" "Editor1 [and Editor2 ...] [and others]") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
309 ("volume" "Volume of the conference proceedings in the series") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
310 ("number" "Number of the conference proceedings in a small series (overwritten by volume)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
311 ("series" "Series in which the conference proceedings appeared") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
312 ("address" "Location of the Proceedings") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
313 ("month" "Month of the publication as a string (remove braces)") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
314 ("organization" "Sponsoring organization of the conference") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
315 ("publisher" "Publishing company, its location") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
316 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
317 ("TechReport" . (((("author" "Author1 [and Author2 ...] [and others]") |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
318 ("title" "Title of the technical report (BibTeX converts it to lowercase)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
319 ("institution" "Sponsoring institution of the report") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
320 ("year" "Year of publication")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
321 (("type" "Type of the report (if other than \"technical report\")") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
322 ("number" "Number of the technical report") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
323 ("address" "Address of the institution (if not part of field \"institution\") or country") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
324 ("month" "Month of the publication as a string (remove braces)") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
325 ("note" "Remarks to be put at the end of the \\bibitem"))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
326 ("Unpublished" . (((("author" "Author1 [and Author2 ...] [and others]") |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
327 ("title" "Title of the unpublished reference (BibTeX converts it to lowercase)") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
328 ("note" "Remarks to be put at the end of the \\bibitem")) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
329 (("month" "Month of the publication as a string (remove braces)") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
330 ("year" "Year of publication"))))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
331 ) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
332 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
333 "Defines reference types and their associated fields. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
334 List of |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
335 (ENTRY-NAME (REQUIRED OPTIONAL) (CROSSREF-REQUIRED CROSSREF-OPTIONAL)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
336 triples. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
337 If the third element is nil, the first pair is always used. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
338 If not, the second pair is used in the case of presence of a crossref |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
339 field and the third in the case of absence. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
340 REQUIRED, OPTIONAL, CROSSREF-REQUIRED and CROSSREF-OPTIONAL are lists. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
341 Each element of these lists is a list of the form |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
342 (FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG). |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
343 COMMENT-STRING, INIT, and ALTERNATIVE-FLAG are optional. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
344 FIELD-NAME is the name of the field, COMMENT-STRING the comment to |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
345 appear in the echo area, INIT is either the initial content of the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
346 field or a function, which is called to determine the initial content |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
347 of the field, and ALTERNATIVE-FLAG (either nil or t) marks if the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
348 field is an alternative. ALTERNATIVE-FLAG may be t only in the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
349 REQUIRED or CROSSREF-REQUIRED lists.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
350 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
351 (defvar bibtex-add-entry-hook nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
352 "List of functions to call when entry has been inserted.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
353 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
354 (defvar bibtex-predefined-month-strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
355 '( |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
356 ("jan") ("feb") ("mar") ("apr") ("may") ("jun") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
357 ("jul") ("aug") ("sep") ("oct") ("nov") ("dec") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
358 ) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
359 "Alist of month string definitions. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
360 Should contain all strings used for months in the BibTeX style files. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
361 Each element is a list with just one element: the string.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
362 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
363 (defvar bibtex-predefined-strings |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
364 (append |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
365 bibtex-predefined-month-strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
366 '( |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
367 ("acmcs") ("acta") ("cacm") ("ibmjrd") ("ibmsj") ("ieeese") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
368 ("ieeetc") ("ieeetcad") ("ipl") ("jacm") ("jcss") ("scp") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
369 ("sicomp") ("tcs") ("tocs") ("tods") ("tog") ("toms") ("toois") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
370 ("toplas") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
371 )) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
372 "Alist of string definitions. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
373 Should contain the strings defined in the BibTeX style files. Each |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
374 element is a list with just one element: the string.") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
375 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
376 (defvar bibtex-string-files nil |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
377 "*List of BibTeX files containing string definitions. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
378 Those files must be specified using pathnames relative to the |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
379 directories specified in bibtex-string-file-path. This variable is only |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
380 evaluated when bibtex-mode is entered (i. e. when loading the BibTeX |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
381 file).") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
382 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
383 (defvar bibtex-string-file-path (getenv "BIBINPUTS") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
384 "*Colon separated list of pathes to search for bibtex-string-files.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
385 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
386 (defvar bibtex-help-message t |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
387 "*If not nil print help messages in the echo area on entering a new field.") |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
388 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
389 (defvar bibtex-autokey-prefix-string "" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
390 "*String to use as a prefix for all generated keys. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
391 See the documentation of function bibtex-generate-autokey for further detail.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
392 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
393 (defvar bibtex-autokey-names 1 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
394 "*Number of names to use for the automatically generated reference key. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
395 If this is set to anything but a number, all names are used. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
396 Possibly more names are used according to bibtex-autokey-names-stretch. |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
397 See the documentation of function bibtex-generate-autokey for further detail.") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
398 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
399 (defvar bibtex-autokey-names-stretch 0 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
400 "*Number of names that can additionally be used. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
401 These names are used only, if all names are used then. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
402 See the documentation of function bibtex-generate-autokey for details.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
403 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
404 (defvar bibtex-autokey-additional-names "" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
405 "*String to prepend to the generated key if not all names could be used. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
406 See the documentation of function bibtex-generate-autokey for details.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
407 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
408 (defvar bibtex-autokey-transcriptions |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
409 '( |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
410 ;; language specific characters |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
411 ("\\\\aa" "a") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
412 ("\\\\AA" "A") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
413 ("\\\"a\\|\\\\\\\"a\\|\\\\ae" "ae") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
414 ("\\\"A\\|\\\\\\\"A\\|\\\\AE" "Ae") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
415 ("\\\\i" "i") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
416 ("\\\\j" "j") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
417 ("\\\\l" "l") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
418 ("\\\\L" "L") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
419 ("\\\"o\\|\\\\\\\"o\\|\\\\o\\|\\\\oe" "oe") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
420 ("\\\"O\\|\\\\\\\"O\\|\\\\O\\|\\\\OE" "Oe") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
421 ("\\\"s\\|\\\\\\\"s" "ss") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
422 ("\\\"u\\|\\\\\\\"u" "ue") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
423 ("\\\"U\\|\\\\\\\"U" "Ue") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
424 ;; accents |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
425 ("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" "") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
426 ;; braces |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
427 ("{" "") ("}" "")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
428 "Alist of (old-regexp new-string) pairs. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
429 Used by the default values of bibtex-autokey-name-change-strings and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
430 bibtex-autokey-titleword-change-strings. Defaults to translating some |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
431 language specific characters to their ascii transcriptions and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
432 removing any character accents.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
433 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
434 (defvar bibtex-autokey-name-change-strings |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
435 bibtex-autokey-transcriptions |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
436 "Alist of (old-regexp new-string) pairs. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
437 Any part of name matching a old-regexp is replaced by new-string. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
438 Case of the old-regexp is significant. All regexps are tried in the |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
439 order in which they appear in the list, so be sure to avoid inifinite |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
440 loops here. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
441 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
442 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
443 (defvar bibtex-autokey-name-length 'infty |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
444 "*Number of characters from name to incorporate into key. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
445 If this is set to anything but a number, all characters are used. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
446 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
447 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
448 (defvar bibtex-autokey-name-separator "" |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
449 "*String that comes between any two names in the key. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
450 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
451 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
452 (defvar bibtex-autokey-year-length 2 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
453 "*Number of rightmost digits from the year field yo incorporate into key. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
454 See the documentation of function bibtex-generate-autokey for details.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
455 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
456 (defvar bibtex-autokey-year-use-crossref-entry t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
457 "*If non-nil use year field from crossreferenced entry if necessary. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
458 If this variable is non-nil and the current entry has no year, but a |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
459 valid crossref entry, the year field from the crossreferenced entry is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
460 used. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
461 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
462 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
463 (defvar bibtex-autokey-titlewords 5 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
464 "*Number of title words to use for the automatically generated reference key. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
465 If this is set to anything but a number, all title words are used. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
466 Possibly more words from the title are used according to |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
467 bibtex-autokey-titlewords-stretch. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
468 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
469 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
470 (defvar bibtex-autokey-title-terminators |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
471 '("\\." "!" "\\?" ":" ";" "--") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
472 "*Regexp list defining the termination of the main part of the title. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
473 Case of the regexps is ignored. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
474 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
475 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
476 (defvar bibtex-autokey-titlewords-stretch 2 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
477 "*Number of words that can additionally be used from the title. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
478 These words are used only, if a sentence from the title can be ended then. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
479 See the documentation of function bibtex-generate-autokey for details.") |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
480 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
481 (defvar bibtex-autokey-titleword-first-ignore |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
482 '("a" "an" "on" "the" "eine?" "der" "die" "das") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
483 "*Determines words that may begin a title but are not to be used in the key. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
484 Each item of the list is a regexp. If the first word of the title matchs a |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
485 regexp from that list, it is not included in the title, even if it is |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
486 capitalized. Case of regexps in this list doesn't matter. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
487 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
488 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
489 (defvar bibtex-autokey-titleword-abbrevs nil |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
490 "*Determines exceptions to the usual abbreviation mechanism. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
491 An alist of (old-regexp new-string) pairs. Case of old-regexp ignored. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
492 The first matching pair is used. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
493 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
494 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
495 (defvar bibtex-autokey-titleword-change-strings |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
496 bibtex-autokey-transcriptions |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
497 "Alist of (old-regexp new-string) pairs. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
498 Any part of title word matching a old-regexp is replaced by new-string. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
499 Case of the old-regexp is significant. All regexps are tried in the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
500 order in which they appear in the list, so be sure to avoid inifinite |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
501 loops here. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
502 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
503 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
504 (defvar bibtex-autokey-titleword-length 5 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
505 "*Number of characters from title words to incorporate into key. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
506 If this is set to anything but a number, all characters are used. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
507 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
508 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
509 (defvar bibtex-autokey-titleword-separator "_" |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
510 "*String to be put between the title words. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
511 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
512 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
513 (defvar bibtex-autokey-name-year-separator "" |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
514 "*String to be put between name part and year part of key. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
515 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
516 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
517 (defvar bibtex-autokey-year-title-separator ":_" |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
518 "*String to be put between name part and year part of key. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
519 See the documentation of function bibtex-generate-autokey for details.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
520 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
521 (defvar bibtex-autokey-preserve-case nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
522 "*If non-nil, names and titlewords used aren't converted to lowercase. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
523 See the documentation of function bibtex-generate-autokey for details.") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
524 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
525 (defvar bibtex-autokey-edit-before-use t |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
526 "*If non-nil, user is allowed to edit the generated key before it is used.") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
527 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
528 (defvar bibtex-autokey-before-presentation-hook nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
529 "Function to call before the generated key is presented. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
530 If non-nil this should be a single function, which is called before |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
531 the generated key is presented (in entry or, if |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
532 `bibtex-autokey-edit-before-use' is t, in minibuffer). This function |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
533 must take one argument (the automatically generated key), and must |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
534 return with a string (the key to use).") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
535 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
536 (defvar bibtex-entry-offset 0 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
537 "*Offset for BibTeX entries. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
538 Added to the value of all other variables which determine colums.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
539 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
540 (defvar bibtex-field-indentation 2 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
541 "*Starting column for the name part in BibTeX fields.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
542 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
543 (defvar bibtex-text-indentation |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
544 (+ |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
545 bibtex-field-indentation |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
546 (length "organization = ")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
547 "*Starting column for the text part in BibTeX fields. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
548 Should be equal to the space needed for the longest name part.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
549 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
550 (defvar bibtex-contline-indentation |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
551 (+ bibtex-text-indentation 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
552 "*Starting column for continuation lines of BibTeX fields.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
553 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
554 (defvar bibtex-align-at-equal-sign nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
555 "*If non-nil, align fields at equal sign instead of field text. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
556 If non nil, column of equal sign is bibtex-text-indentation - 2.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
557 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
558 (defvar bibtex-comma-after-last-field nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
559 "*If non-nil, a comma is put at end of last field in the entry template.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
560 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
561 ;; bibtex-font-lock-keywords is a user option as well, but since the |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
562 ;; patterns used to define this variable are defined in a later |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
563 ;; section of this file, it is defined later. |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
564 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
565 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
566 ;; Syntax Table, Keybindings and BibTeX Entry List |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
567 (defvar bibtex-mode-syntax-table |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
568 (let ((st (make-syntax-table))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
569 (modify-syntax-entry ?\" "\"" st) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
570 (modify-syntax-entry ?$ "$$ " st) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
571 (modify-syntax-entry ?% "< " st) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
572 (modify-syntax-entry ?' "w " st) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
573 (modify-syntax-entry ?@ "w " st) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
574 (modify-syntax-entry ?\\ "\\" st) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
575 (modify-syntax-entry ?\f "> " st) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
576 (modify-syntax-entry ?\n "> " st) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
577 (modify-syntax-entry ?~ " " st) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
578 st)) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
579 |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
580 (defvar bibtex-mode-map |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
581 (let ((km (make-sparse-keymap))) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
582 (define-key km "\t" 'bibtex-find-text) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
583 (define-key km "\n" 'bibtex-next-field) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
584 (define-key km "\M-\t" 'bibtex-complete-string) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
585 (define-key km [(control tab)] 'bibtex-complete-key) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
586 (define-key km "\C-c\"" 'bibtex-remove-delimiters) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
587 (define-key km "\C-c{" 'bibtex-remove-delimiters) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
588 (define-key km "\C-c}" 'bibtex-remove-delimiters) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
589 (define-key km "\C-c\C-c" 'bibtex-clean-entry) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
590 (define-key km "\C-c\C-q" 'bibtex-fill-entry) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
591 (define-key km "\C-c?" 'bibtex-print-help-message) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
592 (define-key km "\C-c\C-p" 'bibtex-pop-previous) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
593 (define-key km "\C-c\C-n" 'bibtex-pop-next) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
594 (define-key km "\C-c\C-k" 'bibtex-kill-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
595 (define-key km "\C-c\M-k" 'bibtex-copy-field-as-kill) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
596 (define-key km "\C-c\C-w" 'bibtex-kill-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
597 (define-key km "\C-c\M-w" 'bibtex-copy-entry-as-kill) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
598 (define-key km "\C-c\C-y" 'bibtex-yank) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
599 (define-key km "\C-c\M-y" 'bibtex-yank-pop) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
600 (define-key km "\C-c\C-d" 'bibtex-empty-field) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
601 (define-key km "\C-c\C-f" 'bibtex-make-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
602 (define-key km "\C-c$" 'bibtex-ispell-abstract) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
603 (define-key km "\M-\C-a" 'bibtex-beginning-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
604 (define-key km "\M-\C-e" 'bibtex-end-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
605 (define-key km "\C-\M-l" 'bibtex-reposition-window) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
606 (define-key km "\C-\M-h" 'bibtex-mark-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
607 (define-key km "\C-c\C-b" 'bibtex-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
608 (define-key km "\C-c\C-t" 'bibtex-hide-entry-bodies) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
609 (define-key km "\C-c\C-rn" 'bibtex-narrow-to-entry) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
610 (define-key km "\C-c\C-rw" 'widen) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
611 (define-key km "\C-c\C-o" 'bibtex-remove-OPT-or-ALT) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
612 (define-key km "\C-c\C-e\C-i" 'bibtex-InProceedings) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
613 (define-key km "\C-c\C-ei" 'bibtex-InCollection) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
614 (define-key km "\C-c\C-eI" 'bibtex-InBook) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
615 (define-key km "\C-c\C-e\C-a" 'bibtex-Article) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
616 (define-key km "\C-c\C-e\C-b" 'bibtex-InBook) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
617 (define-key km "\C-c\C-eb" 'bibtex-Book) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
618 (define-key km "\C-c\C-eB" 'bibtex-Booklet) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
619 (define-key km "\C-c\C-e\C-c" 'bibtex-InCollection) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
620 (define-key km "\C-c\C-e\C-m" 'bibtex-Manual) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
621 (define-key km "\C-c\C-em" 'bibtex-MastersThesis) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
622 (define-key km "\C-c\C-eM" 'bibtex-Misc) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
623 (define-key km "\C-c\C-e\C-p" 'bibtex-InProceedings) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
624 (define-key km "\C-c\C-ep" 'bibtex-Proceedings) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
625 (define-key km "\C-c\C-eP" 'bibtex-PhdThesis) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
626 (define-key km "\C-c\C-e\M-p" 'bibtex-Preamble) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
627 (define-key km "\C-c\C-e\C-s" 'bibtex-String) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
628 (define-key km "\C-c\C-e\C-t" 'bibtex-TechReport) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
629 (define-key km "\C-c\C-e\C-u" 'bibtex-Unpublished) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
630 km)) |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
631 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
632 (easy-menu-define |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
633 bibtex-edit-menu bibtex-mode-map "BibTeX-Edit Menu in BibTeX mode" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
634 '("BibTeX-Edit" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
635 ("Moving inside an Entry" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
636 ["End of Field" bibtex-find-text t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
637 ["Next Field" bibtex-next-field t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
638 ["Beginning of Entry" bibtex-beginning-of-entry t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
639 ["End of Entry" bibtex-end-of-entry t]) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
640 ("Operating on Current Entry" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
641 ["Fill Entry" bibtex-fill-entry t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
642 ["Clean Entry" bibtex-clean-entry t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
643 "--" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
644 ["Kill Entry" bibtex-kill-entry t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
645 ["Copy Entry to Kill Ring" bibtex-copy-entry-as-kill t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
646 ["Paste Most Recently Killed Entry" bibtex-yank t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
647 ["Paste Previously Killed Entry" bibtex-yank-pop t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
648 "--" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
649 ["Ispell Entry" bibtex-ispell-entry t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
650 ["Ispell Entry Abstract" bibtex-ispell-abstract t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
651 ["Narrow to Entry" bibtex-narrow-to-entry t]) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
652 ("Operating on Current Field" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
653 ["Remove Delimiters" bibtex-remove-delimiters t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
654 ["Remove OPT or ALT Prefix" bibtex-remove-OPT-or-ALT t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
655 ["Clear Field" bibtex-empty-field t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
656 "--" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
657 ["Kill Field" bibtex-kill-field t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
658 ["Copy Field to Kill Ring" bibtex-copy-field-as-kill t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
659 ["Paste Most Recently Killed Field" bibtex-yank t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
660 ["Paste Previously Killed Field" bibtex-yank-pop t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
661 "--" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
662 ["Make New Field" bibtex-make-field t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
663 "--" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
664 ["Snatch from Similar Following Field" bibtex-pop-next t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
665 ["Snatch from Similar Preceding Field" bibtex-pop-previous t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
666 "--" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
667 ["String Complete" bibtex-complete-string t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
668 ["Key Complete" bibtex-complete-key t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
669 "--" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
670 ["Help about Current Field" bibtex-print-help-message t]) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
671 ("Operating on Buffer or Region" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
672 ["Validate Entries" bibtex-validate t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
673 ["Sort Entries" bibtex-sort-buffer t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
674 ["Reformat Entries" bibtex-reformat t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
675 ["Hide Entry Bodies" bibtex-hide-entry-bodies t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
676 ["Count Entries" bibtex-count-entries t]) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
677 ("Miscellaneous" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
678 ["Convert Alien Buffer" bibtex-convert-alien t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
679 ["Submit Bug Report" bibtex-submit-bug-report t]))) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
680 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
681 (easy-menu-define |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
682 bibtex-entry-menu bibtex-mode-map "Entry-Types Menu in BibTeX mode" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
683 (list "Entry-Types" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
684 ["Article in Journal" bibtex-Article t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
685 ["Article in Conference Proceedings" bibtex-InProceedings t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
686 ["Article in a Collection" bibtex-InCollection t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
687 ["Chapter or Pages in a Book" bibtex-InBook t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
688 ["Conference Proceedings" bibtex-Proceedings t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
689 ["Book" bibtex-Book t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
690 ["Booklet (Bound, but no Publisher/Institution)" bibtex-Booklet t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
691 ["PhD. Thesis" bibtex-PhdThesis t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
692 ["Master's Thesis" bibtex-MastersThesis t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
693 ["Technical Report" bibtex-TechReport t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
694 ["Technical Manual" bibtex-Manual t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
695 ["Unpublished" bibtex-Unpublished t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
696 ["Miscellaneous" bibtex-Misc t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
697 ["String" bibtex-String t] |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
698 ["Preamble" bibtex-Preamble t])) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
699 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
700 |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
701 ;; Bug Reporting |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
702 |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
703 (defconst |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
704 bibtex-maintainer-address "Stefan Schoef <schoef@offis.uni-oldenburg.de>") |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
705 ;; current maintainer |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
706 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
707 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
708 ;; Internal Variables |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
709 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
710 (defvar bibtex-pop-previous-search-point nil) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
711 ;; Next point where bibtex-pop-previous starts looking for a similar |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
712 ;; entry. |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
713 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
714 (defvar bibtex-pop-next-search-point nil) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
715 ;; Next point where bibtex-pop-next starts looking for a similar entry. |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
716 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
717 (defvar bibtex-field-kill-ring nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
718 ;; Ring of least recently killed fields. At most |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
719 ;; bibtex-field-kill-ring-max items are kept here. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
720 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
721 (defvar bibtex-field-kill-ring-yank-pointer nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
722 ;; The tail of bibtex-field-kill-ring whose car is the last item yanked. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
723 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
724 (defvar bibtex-entry-kill-ring nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
725 ;; Ring of least recently killed entries. At most |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
726 ;; bibtex-entry-kill-ring-max items are kept here. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
727 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
728 (defvar bibtex-entry-kill-ring-yank-pointer nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
729 ;; The tail of bibtex-entry-kill-ring whose car is the last item yanked. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
730 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
731 (defvar bibtex-last-kill-command nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
732 ;; Holds the type of the last kill command (either 'field or 'entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
733 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
734 (defvar bibtex-strings nil) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
735 ;; Candidates for bibtex-complete-string. Initialized from |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
736 ;; bibtex-predefined-strings and bibtex-string-files. This variable is |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
737 ;; buffer-local. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
738 (make-variable-buffer-local 'bibtex-strings) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
739 |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
740 (defvar bibtex-keys nil) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
741 ;; Candidates for TAB completion when entering a reference key using |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
742 ;; the minibuffer. Also used for bibtex-complete-key. Initialized in |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
743 ;; bibtex-mode and updated for each new entry. This variable is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
744 ;; buffer-local. |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
745 (make-variable-buffer-local 'bibtex-keys) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
746 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
747 (defvar bibtex-buffer-last-parsed-tick nil) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
748 ;; Remembers the value returned by buffer-modified-tick when buffer |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
749 ;; was parsed for keys the last time. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
750 (make-variable-buffer-local 'bibtex-buffer-last-parsed-tick) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
751 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
752 (defvar bibtex-parse-idle-timer nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
753 ;; Stores if timer is already installed |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
754 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
755 (defvar bibtex-progress-lastperc nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
756 ;; Holds the last reported percentage for the progress message |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
757 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
758 (defvar bibtex-progress-lastmes nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
759 ;; Holds the last reported progress message |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
760 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
761 (defvar bibtex-progress-interval nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
762 ;; Holds the chosen interval |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
763 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
764 (defvar bibtex-key-history nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
765 ;; Used to store the history list for reading keys |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
766 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
767 (defvar bibtex-entry-type-history nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
768 ;; Used to store the history list for reading entry types |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
769 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
770 (defvar bibtex-field-history nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
771 ;; Used to store the history list for reading field names |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
772 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
773 (defvar bibtex-reformat-previous-options nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
774 ;; Used to store the last reformat options given |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
775 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
776 (defvar bibtex-reformat-previous-labels nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
777 ;; Used to store the last reformat label option given |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
778 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
779 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
780 ;; Functions to Parse the BibTeX Entries |
257 | 781 |
782 (defun bibtex-cfield (name text) | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
783 ;; Create a regexp for a BibTeX field of name NAME and text TEXT. |
257 | 784 (concat ",[ \t\n]*\\(" |
785 name | |
786 "\\)[ \t\n]*=[ \t\n]*\\(" | |
787 text | |
788 "\\)")) | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
789 (defconst bibtex-name-in-cfield 1) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
790 ;; The regexp subexpression number of the name part in bibtex-cfield. |
257 | 791 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
792 (defconst bibtex-text-in-cfield 2) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
793 ;; The regexp subexpression number of the text part in bibtex-cfield. |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
794 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
795 (defconst bibtex-reference-type "@[^\"#%'(),={} \t\n0-9][^\"#%'(),={} \t\n]*") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
796 ;; Regexp defining the type part of a BibTeX reference entry (almost |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
797 ;; the same as bibtex-field-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
798 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
799 (defconst bibtex-reference-key "[][a-z0-9.:;?!`'/*@+=|()<>&_^$-]+") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
800 ;; Regexp defining the label part of a BibTeX reference entry |
257 | 801 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
802 (defconst bibtex-field-name "[^\"#%'(),={} \t\n0-9][^\"#%'(),={} \t\n]*") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
803 ;; Regexp defining the name part of a BibTeX field (almost the same as |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
804 ;; bibtex-reference-type) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
805 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
806 (defconst bibtex-field-const "[][a-z0-9.:;?!`'/*@+=|<>&_^$-]+") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
807 ;; Regexp defining a bibtex field constant |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
808 |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
809 (defconst bibtex-field-string-part-not-braced |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
810 "[^{}]") |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
811 ;; Match field string part without braces |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
812 |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
813 (defconst bibtex-field-string-part-no-inner-braces |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
814 (concat |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
815 "{" |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
816 bibtex-field-string-part-not-braced "*" |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
817 "}")) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
818 ;; Match field string part with no inner braces |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
819 |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
820 (defconst bibtex-field-string-part-1-inner-brace |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
821 (concat |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
822 "{" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
823 "\\(" |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
824 bibtex-field-string-part-not-braced |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
825 "\\|" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
826 "\\(" bibtex-field-string-part-no-inner-braces "\\)" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
827 "\\)*" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
828 "}")) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
829 ;; Match field string part with at most 1 inner brace |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
830 |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
831 (defconst bibtex-field-string-part-2-inner-braces |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
832 (concat |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
833 "{" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
834 "\\(" |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
835 bibtex-field-string-part-not-braced |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
836 "\\|" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
837 "\\(" bibtex-field-string-part-1-inner-brace "\\)" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
838 "\\)*" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
839 "}")) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
840 ;; Match field string part with at most 2 inner braces |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
841 |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
842 (defconst bibtex-field-string-part-3-inner-braces |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
843 (concat |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
844 "{" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
845 "\\(" |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
846 bibtex-field-string-part-not-braced |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
847 "\\|" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
848 "\\(" bibtex-field-string-part-2-inner-braces "\\)" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
849 "\\)*" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
850 "}")) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
851 ;; Match field string part with at most 3 inner braces |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
852 |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
853 (defconst bibtex-field-string-braced |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
854 bibtex-field-string-part-3-inner-braces) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
855 ;; Match braced field string with inner nesting level of braces at most 3 |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
856 |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
857 (defconst bibtex-field-string-quoted |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
858 (concat |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
859 "\"" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
860 "\\(" |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
861 "[^\"\\]" ;; every character except quote or backslash |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
862 "\\|" |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
863 ;; "\\(" "\"[a-z-]" "\\)" ;; a quote followed by a letter or dash |
15637
405b1ecbf8ba
(bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents:
15565
diff
changeset
|
864 ;; "\\|" |
405b1ecbf8ba
(bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents:
15565
diff
changeset
|
865 ;; last two lines commented out until lines like |
405b1ecbf8ba
(bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents:
15565
diff
changeset
|
866 ;; author = "Stefan Sch"of" |
405b1ecbf8ba
(bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents:
15565
diff
changeset
|
867 ;; are supported by BibTeX |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
868 "\\(" "\\\\\\(.\\|\n\\)" "\\)" ;; a backslash followed by any character |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
869 "\\)*" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
870 "\"")) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
871 ;; Match quoted field string |
561 | 872 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
873 (defconst bibtex-field-string |
257 | 874 (concat |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
875 "\\(" bibtex-field-string-braced "\\)" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
876 "\\|" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
877 "\\(" bibtex-field-string-quoted "\\)")) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
878 ;; Match a braced or quoted string |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
879 |
257 | 880 (defconst bibtex-field-string-or-const |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
881 (concat bibtex-field-const "\\|" bibtex-field-string)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
882 ;; Match either bibtex-field-string or bibtex-field-const. |
257 | 883 |
884 (defconst bibtex-field-text | |
885 (concat | |
886 "\\(" bibtex-field-string-or-const "\\)" | |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
887 "\\([ \t\n]+#[ \t\n]+\\(" bibtex-field-string-or-const "\\)\\)*")) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
888 ;; Regexp defining the text part of a BibTeX field: either a string, |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
889 ;; or an empty string, or a constant followed by one or more # / |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
890 ;; constant pairs. |
257 | 891 |
892 (defconst bibtex-field | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
893 (bibtex-cfield bibtex-field-name bibtex-field-text)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
894 ;; Regexp defining the format of a BibTeX field. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
895 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
896 (defconst bibtex-name-in-field bibtex-name-in-cfield) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
897 ;; The regexp subexpression number of the name part in BibTeX-field. |
257 | 898 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
899 (defconst bibtex-text-in-field bibtex-text-in-cfield) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
900 ;; The regexp subexpression number of the text part in BibTeX-field. |
257 | 901 |
902 (defconst bibtex-reference-head | |
15637
405b1ecbf8ba
(bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents:
15565
diff
changeset
|
903 (concat "^[ \t]*\\(" |
257 | 904 bibtex-reference-type |
15565
2a0d1c1d2746
(bibtex-reference-head): Allow whitespace after the open paren.
Richard M. Stallman <rms@gnu.org>
parents:
14789
diff
changeset
|
905 "\\)[ \t]*[({][ \t]*\\(" |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
906 bibtex-reference-key |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
907 "\\)")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
908 ;; Regexp defining format of the header line of a BibTeX reference |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
909 ;; entry. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
910 |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
911 (defconst bibtex-reference-maybe-empty-head |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
912 (concat bibtex-reference-head "?")) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
913 ;; Regexp defining format of the header line of a maybe empty |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
914 ;; BibTeX reference entry (without reference key). |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
915 |
15637
405b1ecbf8ba
(bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents:
15565
diff
changeset
|
916 (defconst bibtex-type-in-head 1) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
917 ;; The regexp subexpression number of the type part in |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
918 ;; bibtex-reference-head. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
919 |
15637
405b1ecbf8ba
(bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents:
15565
diff
changeset
|
920 (defconst bibtex-key-in-head 2) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
921 ;; The regexp subexpression number of the key part in |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
922 ;; bibtex-reference-head. |
257 | 923 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
924 (defconst bibtex-reference-infix (concat "[ \t\n]*" bibtex-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
925 ;; Regexp defining the (repeatable) infix of a bibtex reference |
257 | 926 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
927 (defconst bibtex-reference-postfix "[ \t\n]*,?[ \t\n]*[})]") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
928 ;; Regexp defining the postfix of a bibtex reference |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
929 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
930 (defconst bibtex-key-in-reference bibtex-key-in-head) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
931 ;; The regexp subexpression number of the key part in |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
932 ;; bibtex-reference. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
933 |
257 | 934 (defconst bibtex-string |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
935 (concat "^[ \t]*@string[ \t\n]*[({][ \t\n]*\\(" |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
936 bibtex-reference-key |
257 | 937 "\\)[ \t\n]*=[ \t\n]*\\(" |
938 bibtex-field-text | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
939 "\\)[ \t\n]*[})]")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
940 ;; Regexp defining the format of a BibTeX string entry. |
257 | 941 |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
942 (defconst bibtex-key-in-string 1) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
943 ;; The regexp subexpression of the name part in bibtex-string. |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
944 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
945 (defconst bibtex-text-in-string 2) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
946 ;; The regexp subexpression of the text part in bibtex-string. |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
947 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
948 (defvar bibtex-font-lock-keywords |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
949 (list |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
950 (list bibtex-reference-maybe-empty-head |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
951 (list bibtex-type-in-head 'font-lock-function-name-face) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
952 (list bibtex-key-in-head 'font-lock-reference-face nil t)) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
953 ;; reference type and reference label |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
954 (list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
955 (concat "^[ \t]*\\(OPT" bibtex-field-name "\\)[ \t]*=") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
956 1 'font-lock-comment-face) |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
957 ;; optional field names (treated as comments) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
958 (list (concat "^[ \t]*\\(" bibtex-field-name "\\)[ \t]*=") |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
959 1 'font-lock-variable-name-face) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
960 ;; field names |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
961 "*Default expressions to highlight in BibTeX mode.")) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
962 ;; now all needed patterns are defined |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
963 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
964 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
965 ;; Helper Functions |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
966 |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
967 (defun bibtex-delete-whitespace () |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
968 ;; Delete all whitespace starting at point |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
969 (if (looking-at "[ \t\n]+") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
970 (delete-region (point) (match-end 0)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
971 |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
972 (defun bibtex-current-line () |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
973 ;; this computes line number of point regardless whether the buffer |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
974 ;; is narrowed |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
975 (+ (count-lines 1 (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
976 (if (equal (current-column) 0) 1 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
977 |
17700
d28dbbfabfb1
(assoc-ignore-case): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
15852
diff
changeset
|
978 (defun bibtex-member-of-regexp (string list) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
979 ;; Return non-nil if STRING is exactly matched by an element of |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
980 ;; LIST (case ignored). The value is actually the tail of LIST whose |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
981 ;; car matches STRING. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
982 (let ((case-fold-search t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
983 (while |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
984 (and list (not (string-match (concat "^" (car list) "$") string))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
985 (setq list (cdr list))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
986 list)) |
257 | 987 |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
988 (defun bibtex-assoc-of-regexp (string alist) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
989 ;; Return non-nil if STRING is exactly matched by the car of an |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
990 ;; element of LIST (case ignored). The value is actually the element |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
991 ;; of LIST whose car matches STRING. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
992 (let ((case-fold-search t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
993 (while |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
994 (and alist |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
995 (not (string-match (concat "^" (car (car alist)) "$") string))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
996 (setq alist (cdr alist))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
997 (car alist))) |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
998 |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
999 (defun bibtex-skip-to-valid-entry (&optional backward) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1000 ;; If not at beginning of valid BibTeX entry, move to beginning of |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1001 ;; the next valid one. With argument backward non-nil, move backward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1002 ;; to beginning of previous valid one. A valid entry is a |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1003 ;; syntactical correct one with type contained in |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1004 ;; bibtex-entry-field-alist or, if bibtex-sort-ignore-string-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1005 ;; is nil, a syntactical correct string entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1006 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1007 (valid-bibtex-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1008 (concat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1009 "@[ \t]*\\(" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1010 (mapconcat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1011 (lambda (type) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1012 (concat "\\(" (car type) "\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1013 bibtex-entry-field-alist |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1014 "\\|") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1015 "\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1016 found) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1017 (while (and (not found) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1018 (not (if backward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1019 (bobp) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1020 (eobp)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1021 (let ((pnt (point))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1022 (cond |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1023 ((looking-at valid-bibtex-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1024 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1025 (bibtex-search-reference nil nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1026 (equal (match-beginning 0) pnt)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1027 (setq found t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1028 ((and (not bibtex-sort-ignore-string-entries) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1029 (looking-at bibtex-string)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1030 (setq found t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1031 (if found |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1032 (goto-char pnt) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1033 (if backward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1034 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1035 (goto-char (1- pnt)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1036 (if (re-search-backward "^[ \t]*\\(@\\)" nil 'move) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1037 (goto-char (match-beginning 1)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1038 (goto-char (1+ pnt)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1039 (if (re-search-forward "^[ \t]*@" nil 'move) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1040 (forward-char -1)))))))) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
1041 |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
1042 (defun bibtex-map-entries (fun) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1043 ;; Call FUN for each BibTeX entry starting with the current. Do this |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1044 ;; to the end of the file. FUN is called with one argument, the key |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1045 ;; of the entry, and with point inside the entry. If |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1046 ;; bibtex-sort-ignore-string-entries is non-nil, FUN will not be |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1047 ;; called for @String entries. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1048 (let ((case-fold-search t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1049 (bibtex-beginning-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1050 (while (re-search-forward bibtex-reference-maybe-empty-head nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1051 (let ((pnt (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1052 (reference-type |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1053 (downcase (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1054 (1+ (match-beginning bibtex-type-in-head)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1055 (match-end bibtex-type-in-head)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1056 (reference-key |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1057 (if (match-beginning bibtex-key-in-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1058 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1059 (match-beginning bibtex-key-in-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1060 (match-end bibtex-key-in-head)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1061 ""))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1062 (if (or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1063 (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1064 (not bibtex-sort-ignore-string-entries) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1065 (string-equal "string" (downcase reference-type))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1066 (assoc-ignore-case reference-type bibtex-entry-field-alist)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1067 (funcall fun reference-key)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1068 (goto-char pnt) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1069 (bibtex-end-of-entry))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1070 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1071 (defun bibtex-progress-message (&optional flag interval) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1072 ;; echos a message about progress of current buffer |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1073 ;; if flag is a string, the message is initialized (in this case a |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1074 ;; value for INTERVAL may be given as well (if not this is set to 5)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1075 ;; if flag is done, the message is deinitialized |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1076 ;; if flag is absent, a message is echoed if point was incremented |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1077 ;; at least INTERVAL percent since last message was echoed |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1078 (let* ((size (- (point-max) (point-min))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1079 (perc (if (= size 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1080 100 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1081 (/ (* 100 (- (point) (point-min))) size)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1082 (if (or (and (not flag) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1083 (>= perc |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1084 (+ bibtex-progress-interval bibtex-progress-lastperc))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1085 (stringp flag)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1086 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1087 (if (stringp flag) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1088 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1089 (setq bibtex-progress-lastmes flag) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1090 (if interval |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1091 (setq bibtex-progress-interval interval) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1092 (setq bibtex-progress-interval 5)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1093 (setq bibtex-progress-lastperc perc) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1094 (message (concat bibtex-progress-lastmes " (%d%%)") perc)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1095 (if (equal flag 'done) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1096 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1097 (message (concat bibtex-progress-lastmes " (done)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1098 (setq bibtex-progress-lastmes nil)))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1099 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1100 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1101 (defun bibtex-field-left-delimiter () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1102 ;; returns a string dependent on bibtex-field-delimiters |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1103 (if (equal bibtex-field-delimiters 'braces) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1104 "{" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1105 "\"")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1106 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1107 (defun bibtex-field-right-delimiter () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1108 ;; returns a string dependent on bibtex-field-delimiters |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1109 (if (equal bibtex-field-delimiters 'braces) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1110 "}" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1111 "\"")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1112 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1113 (defun bibtex-entry-left-delimiter () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1114 ;; returns a string dependent on bibtex-field-delimiters |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1115 (if (equal bibtex-entry-delimiters 'braces) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1116 "{" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1117 "(")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1118 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1119 (defun bibtex-entry-right-delimiter () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1120 ;; returns a string dependent on bibtex-field-delimiters |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1121 (if (equal bibtex-entry-delimiters 'braces) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1122 "}" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1123 ")")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1124 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1125 (defun bibtex-search-reference |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1126 (empty-head &optional bound noerror backward) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1127 ;; A helper function necessary since the failure stack size limit for |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1128 ;; regexps was reduced in emacs 19.32. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1129 ;; It searches for a BibTeX reference (maybe with an empty head if |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1130 ;; EMPTY-HEAD is t). |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1131 ;; BOUND and NOERROR are exactly as in re-search-forward. If |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1132 ;; BACKWARD is non-nil, search is done in reverse direction. After |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1133 ;; call to this function MATCH-BEGINNING and MATCH-END functions are |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1134 ;; defined, but only for the head part of the reference (especially |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1135 ;; (match-end 0) just gives the end of the head part). |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1136 (let ((pnt (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1137 (prefix (if empty-head |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1138 bibtex-reference-maybe-empty-head |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1139 bibtex-reference-head)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1140 (infix bibtex-reference-infix) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1141 (postfix bibtex-reference-postfix)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1142 (if backward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1143 (let (found) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1144 (while (and (not found) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1145 (re-search-backward prefix bound noerror)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1146 (setq found (bibtex-search-reference empty-head pnt t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1147 (if found |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1148 (goto-char (match-beginning 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1149 (if (equal noerror nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1150 ;; yell |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1151 (error "Search of BibTeX reference failed.")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1152 (if (equal noerror t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1153 ;; don't move |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1154 (goto-char pnt)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1155 nil)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1156 (let ((limit (if bound bound (point-max))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1157 md |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1158 found) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1159 (while (and (not found) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1160 (re-search-forward prefix bound noerror)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1161 (setq md (match-data)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1162 ;; save match-data of prefix regexp |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1163 (let ((entry-closer |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1164 (if (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1165 (goto-char (match-end bibtex-type-in-head)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1166 (looking-at "[ \t]*(")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1167 ;; entry opened with parenthesis |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1168 ")" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1169 "}"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1170 (while (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1171 (looking-at infix) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1172 (<= (match-end 0) limit)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1173 (goto-char (match-end 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1174 ;; This matches the infix* part. The AND construction assures |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1175 ;; that BOUND is respected. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1176 (if (and (looking-at postfix) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1177 (string-equal |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1178 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1179 (1- (match-end 0)) (match-end 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1180 entry-closer) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1181 (<= (match-end 0) limit)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1182 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1183 (re-search-forward postfix) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1184 (setq found t))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1185 (if found |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1186 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1187 (store-match-data md) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1188 ;; to set match-beginning/end again |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1189 (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1190 (if (equal noerror nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1191 ;; yell |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1192 (error "Search of BibTeX reference failed.")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1193 (if (equal noerror t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1194 ;; don't move |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1195 (goto-char pnt)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1196 nil))))) |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
1197 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1198 (defun bibtex-flash-head () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1199 ;; Flash at BibTeX reference head before point, if exists. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1200 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1201 flash) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1202 (cond ((re-search-backward bibtex-reference-head nil t) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1203 (goto-char (match-beginning bibtex-type-in-head)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1204 (setq flash (match-end bibtex-key-in-reference))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1205 (t |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1206 (end-of-line) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1207 (skip-chars-backward " \t") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1208 (setq flash (point)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1209 (beginning-of-line) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1210 (skip-chars-forward " \t"))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1211 (if (pos-visible-in-window-p (point)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1212 (sit-for 1) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1213 (message "From: %s" |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1214 (buffer-substring (point) flash))))) |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
1215 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1216 (defun bibtex-make-optional-field (e-t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1217 "Makes an optional field named E-T in current BibTeX entry." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1218 (if (consp e-t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1219 (bibtex-make-field (cons (concat "OPT" (car e-t)) (cdr e-t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1220 (bibtex-make-field (concat "OPT" e-t)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1221 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1222 (defun bibtex-move-outside-of-entry () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1223 ;; Make sure we are outside of a BibTeX entry. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1224 (bibtex-end-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1225 (skip-chars-forward " \t\n")) |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
1226 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1227 (defun bibtex-beginning-of-first-entry () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1228 ;; Go to the beginning of the first BibTeX entry in buffer. Return |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1229 ;; point. |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
1230 (goto-char (point-min)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1231 (if (re-search-forward "^[ \t]*@" nil 'move) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1232 (beginning-of-line)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1233 (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1234 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1235 (defun bibtex-beginning-of-last-entry () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1236 ;; Go to the beginning of the last BibTeX entry in buffer. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1237 (goto-char (point-max)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1238 (if (re-search-backward "^[ \t]*@" nil 'move) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1239 (beginning-of-line)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1240 (point)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1241 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1242 (defun bibtex-inside-field () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1243 ;; Try to avoid point being at end of a BibTeX field. |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1244 (end-of-line) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1245 (skip-chars-backward " \t") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1246 (cond ((= (preceding-char) ?,) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1247 (forward-char -2))) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1248 (cond ((or |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1249 (= (preceding-char) ?}) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1250 (= (preceding-char) ?\")) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1251 (forward-char -1)))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1252 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1253 (defun bibtex-enclosing-field (&optional noerr) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1254 ;; Search for BibTeX field enclosing point. Point moves to end of |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1255 ;; field. Use match-beginning and match-end to parse the field. If |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1256 ;; NOERR is non-nil, no error is signalled. In this case, t is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1257 ;; returned on success, nil otherwise. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1258 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1259 (old-point (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1260 (boe (bibtex-beginning-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1261 (success t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1262 (goto-char old-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1263 (if (not (re-search-backward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1264 (bibtex-cfield bibtex-field-name "") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1265 boe t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1266 ;; Search possible beginning of field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1267 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1268 (goto-char old-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1269 (if noerr |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1270 (setq success nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1271 (error "Can't find enclosing BibTeX field."))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1272 (if (or (not (re-search-forward bibtex-field nil t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1273 (< (match-end 0) old-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1274 (> (match-beginning 0) old-point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1275 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1276 (goto-char old-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1277 (if noerr |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1278 (setq success nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1279 (error "Can't find enclosing BibTeX field."))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1280 success)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1281 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1282 (defun bibtex-enclosing-reference-maybe-empty-head () |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1283 ;; Search for BibTeX reference enclosing point. Point moves to |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1284 ;; end of reference. Beginning (but not end) of reference is given |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1285 ;; by (match-beginning 0). |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1286 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1287 (old-point (point))) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1288 (if (not |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1289 (re-search-backward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1290 bibtex-reference-maybe-empty-head nil t)) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1291 (progn |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1292 (error "Can't find enclosing BibTeX reference.") |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1293 (goto-char old-point))) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1294 (goto-char (match-beginning bibtex-type-in-head)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1295 (if (not |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1296 (bibtex-search-reference t nil t)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1297 (progn |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1298 (error "Can't find enclosing BibTeX reference.") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1299 (goto-char old-point))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1300 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1301 (defun bibtex-insert-current-kill (n) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1302 (if (not bibtex-last-kill-command) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1303 (error "BibTeX kill ring is empty.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1304 (let* ((kr (if (equal bibtex-last-kill-command 'field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1305 'bibtex-field-kill-ring |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1306 'bibtex-entry-kill-ring)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1307 (kryp (if (equal bibtex-last-kill-command 'field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1308 'bibtex-field-kill-ring-yank-pointer |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1309 'bibtex-entry-kill-ring-yank-pointer)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1310 (ARGth-kill-element |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1311 (nthcdr |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1312 (mod (- n (length (eval kryp))) (length (eval kr))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1313 (eval kr))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1314 (current (car (set kryp ARGth-kill-element)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1315 (cond |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1316 ((equal bibtex-last-kill-command 'field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1317 (let (bibtex-help-message) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1318 (bibtex-find-text nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1319 (if (looking-at "[}\"]") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1320 (forward-char))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1321 (set-mark (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1322 (message "Mark set") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1323 (bibtex-make-field (list (elt current 1) nil (elt current 2)) t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1324 ((equal bibtex-last-kill-command 'entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1325 (if (not (eobp)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1326 (bibtex-beginning-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1327 (set-mark (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1328 (message "Mark set") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1329 (insert (elt current 1))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1330 (t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1331 (error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1332 "Unknown tag field: %s. Please submit a bug report." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1333 bibtex-last-kill-command)))))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1334 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1335 (defun bibtex-format-entry () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1336 ;; Helper function for bibtex-clean-entry. Formats current entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1337 ;; according to variable bibtex-entry-format. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1338 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1339 (beg (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1340 (start (bibtex-beginning-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1341 crossref-there |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1342 alternatives-there |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1343 non-empty-alternative) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1344 (let ((end (copy-marker (bibtex-end-of-entry)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1345 (if (equal start (marker-position end)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1346 (error "Not on a known BibTeX entry.") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1347 (goto-char start) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1348 (while (re-search-forward bibtex-field end t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1349 ;; determine if reference has crossref entry and if at least |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1350 ;; one alternative is non-empty |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1351 (let ((begin-name (match-beginning bibtex-name-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1352 (end-name (match-end bibtex-name-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1353 (begin-text (match-beginning bibtex-text-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1354 (end-text (match-end bibtex-text-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1355 (goto-char begin-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1356 (if (looking-at "ALT") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1357 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1358 (setq alternatives-there t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1359 (goto-char begin-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1360 (if (not (looking-at "\\(\"\"\\)\\|\\({}\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1361 (setq non-empty-alternative t)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1362 (if (string-match |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1363 "\\(OPT\\)?crossref" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1364 (buffer-substring-no-properties begin-name end-name)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1365 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1366 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1367 crossref-there |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1368 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1369 (1+ begin-text) (1- end-text))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1370 (if (equal crossref-there "") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1371 (setq crossref-there nil)))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1372 (if (and alternatives-there |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1373 (not non-empty-alternative)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1374 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1375 (goto-char beg) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1376 (error "All alternatives are empty."))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1377 (goto-char start) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1378 (re-search-forward bibtex-reference-type end) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1379 (let* ((begin-type (1+ (match-beginning 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1380 (end-type (match-end 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1381 (reference-type |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1382 (downcase |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1383 (buffer-substring-no-properties begin-type end-type))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1384 (entry-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1385 (assoc-ignore-case reference-type bibtex-entry-field-alist)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1386 (req (elt (elt entry-list 1) 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1387 (creq (elt (elt entry-list 2) 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1388 (format (if (equal bibtex-entry-format t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1389 '(realign opts-or-alts numerical-fields |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1390 last-comma page-dashes delimiters |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1391 unify-case inherit-booktitle) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1392 bibtex-entry-format)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1393 field-done) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1394 (if (memq 'unify-case format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1395 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1396 (delete-region begin-type end-type) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1397 (insert (car entry-list)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1398 (if (memq 'delimiters format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1399 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1400 (goto-char end-type) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1401 (skip-chars-forward " \t\n") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1402 (delete-char 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1403 (insert (bibtex-entry-left-delimiter)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1404 (goto-char start) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1405 (while (re-search-forward bibtex-field end t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1406 (let* ((begin-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1407 (copy-marker (match-beginning 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1408 (end-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1409 (copy-marker (match-end 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1410 (begin-name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1411 (copy-marker (match-beginning bibtex-name-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1412 (end-name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1413 (copy-marker (match-end bibtex-name-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1414 (begin-text |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1415 (copy-marker (match-beginning bibtex-text-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1416 (end-text |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1417 (copy-marker (match-end bibtex-text-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1418 (field-name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1419 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1420 (if (string-match |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1421 "^OPT\\|ALT$" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1422 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1423 begin-name (+ begin-name 3))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1424 (+ begin-name 3) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1425 begin-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1426 end-name))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1427 (cond |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1428 ((and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1429 (memq 'opts-or-alts format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1430 (progn (goto-char begin-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1431 (looking-at "OPT\\|ALT"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1432 (goto-char begin-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1433 (if (looking-at "\\(\"\"\\)\\|\\({}\\)") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1434 ;; empty: delete whole field if really optional |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1435 ;; (missing crossref handled) or complain |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1436 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1437 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1438 (goto-char begin-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1439 (looking-at "OPT")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1440 (not crossref-there) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1441 (assoc-ignore-case field-name req)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1442 ;; field is not really optional |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1443 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1444 (goto-char begin-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1445 (bibtex-remove-OPT-or-ALT) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1446 (error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1447 "Mandatory field ``%s'' is empty." field-name)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1448 ;; field is optional |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1449 (delete-region begin-field end-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1450 ;; otherwise: not empty, delete "OPT" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1451 (goto-char begin-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1452 (bibtex-remove-OPT-or-ALT))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1453 ((and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1454 (memq 'numerical-fields format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1455 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1456 (goto-char begin-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1457 (looking-at "\\(\"[0-9]+\"\\)\\|\\({[0-9]+}\\)"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1458 (goto-char end-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1459 (delete-char -1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1460 (goto-char begin-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1461 (delete-char 1)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1462 (t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1463 (if (memq 'delimiters format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1464 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1465 (goto-char begin-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1466 (while (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1467 (<= (point) end-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1468 (re-search-forward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1469 bibtex-field-string-or-const end-text t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1470 (let ((end (point))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1471 (goto-char (match-beginning 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1472 (if (or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1473 (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1474 (equal bibtex-field-delimiters 'double-quotes) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1475 (looking-at bibtex-field-string-braced)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1476 (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1477 (equal bibtex-field-delimiters 'braces) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1478 (looking-at bibtex-field-string-quoted))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1479 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1480 (goto-char (match-end 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1481 (delete-backward-char 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1482 (insert (bibtex-field-right-delimiter)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1483 (goto-char (match-beginning 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1484 (delete-char 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1485 (insert (bibtex-field-left-delimiter)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1486 (goto-char end))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1487 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1488 (memq 'page-dashes format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1489 (string-match "^\\(OPT\\)?pages$" (downcase field-name)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1490 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1491 (goto-char begin-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1492 (looking-at |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1493 "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1494 (replace-match "\\1-\\2")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1495 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1496 (memq 'inherit-booktitle format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1497 (equal (downcase field-name) "booktitle") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1498 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1499 (goto-char begin-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1500 (looking-at "\\(\"\"\\)\\|\\({}\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1501 crossref-there |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1502 (not (bibtex-find-entry-location crossref-there t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1503 ;; booktitle field empty and crossref entry found |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1504 ;; --> insert title field of crossreferenced entry if there |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1505 (let ((end-of-crefd-entry (bibtex-end-of-entry))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1506 (bibtex-beginning-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1507 (if (re-search-forward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1508 (bibtex-cfield "title" bibtex-field-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1509 end-of-crefd-entry t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1510 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1511 (goto-char begin-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1512 (forward-char) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1513 (insert |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1514 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1515 (1+ (match-beginning bibtex-text-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1516 (1- (match-end bibtex-text-in-field)))))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1517 (if (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1518 (goto-char begin-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1519 (looking-at "\\(\"\"\\)\\|\\({}\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1520 ;; if empty field, complain |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1521 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1522 (forward-char) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1523 (if (or (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1524 crossref-there |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1525 (assoc-ignore-case |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1526 field-name creq)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1527 (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1528 (not crossref-there) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1529 (assoc-ignore-case |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1530 field-name req))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1531 (error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1532 "Mandatory field ``%s'' is empty." field-name)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1533 (if (memq 'unify-case format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1534 (let* ((fl |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1535 (car (cdr (assoc-ignore-case |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1536 reference-type |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1537 bibtex-entry-field-alist)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1538 (field-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1539 (append |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1540 (elt fl 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1541 (elt fl 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1542 bibtex-user-optional-fields)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1543 (new-field-name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1544 (car |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1545 (assoc-ignore-case field-name field-list)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1546 (goto-char begin-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1547 (if new-field-name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1548 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1549 (delete-region begin-name end-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1550 (insert new-field-name)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1551 (downcase-region begin-name end-name)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1552 (setq field-done t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1553 (if (not field-done) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1554 (goto-char begin-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1555 (setq field-done nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1556 (goto-char end-field)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1557 (if (looking-at (bibtex-field-right-delimiter)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1558 (forward-char)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1559 (if (memq 'last-comma format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1560 (cond ((and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1561 bibtex-comma-after-last-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1562 (not (looking-at ","))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1563 (insert ",")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1564 ((and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1565 (not bibtex-comma-after-last-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1566 (looking-at ",")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1567 (delete-char 1)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1568 (if (looking-at ",") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1569 (forward-char)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1570 (if (memq 'delimiters format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1571 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1572 (skip-chars-forward " \t\n") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1573 (delete-char 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1574 (insert (bibtex-entry-right-delimiter)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1575 (if (memq 'realign format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1576 (bibtex-fill-entry))))))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1577 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1578 (defun bibtex-autokey-change (string change-list) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1579 ;; Returns a string where some regexps are changed according to |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1580 ;; change-list. Every item of change-list is an (old-regexp |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1581 ;; new-string) pair. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1582 (let (case-fold-search |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1583 (return-string string) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1584 (index 0) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1585 (len (length change-list)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1586 change-item) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1587 (while (< index len) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1588 (setq change-item (elt change-list index)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1589 (while (string-match (car change-item) return-string) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1590 (setq |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1591 return-string |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1592 (concat (substring return-string 0 (match-beginning 0)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1593 (elt change-item 1) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1594 (substring return-string (match-end 0))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1595 (setq index (1+ index))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1596 return-string)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1597 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1598 (defun bibtex-autokey-abbrev (string len) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1599 ;; Returns an abbreviation of string with at least len |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1600 ;; characters. String is aborted only after a consonant or at the |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1601 ;; word end. If len is not a number, string is returned unchanged. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1602 (cond ((or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1603 (not (numberp len)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1604 (<= (length string) len)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1605 string) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1606 ((equal len 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1607 "") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1608 (t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1609 (let* ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1610 (abort-char |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1611 (string-match "[^aeiou]" string (1- len)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1612 (if abort-char |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1613 (substring string 0 (1+ abort-char)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1614 string))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1615 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1616 (defun bibtex-autokey-get-namefield (min max) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1617 ;; returns the contents of the name field of the current entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1618 ;; does some modifications based on |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1619 ;; `bibtex-autokey-name-change-strings' |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1620 (goto-char min) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1621 (let ((case-fold-search t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1622 (if (re-search-forward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1623 (bibtex-cfield "\\(author\\)\\|\\(editor\\)" bibtex-field-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1624 max t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1625 (bibtex-autokey-change |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1626 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1627 (1+ (match-beginning (+ bibtex-text-in-cfield 2))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1628 (1- (match-end (+ bibtex-text-in-cfield 2)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1629 bibtex-autokey-name-change-strings) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1630 ""))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1631 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1632 (defun bibtex-autokey-get-names (namefield) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1633 ;; gathers all names in namefield into a list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1634 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1635 names) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1636 (while (not (equal namefield "")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1637 (let (name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1638 (if (string-match "[ \t\n]and[ \t\n]" namefield) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1639 (setq name (substring namefield 0 (match-beginning 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1640 namefield (substring namefield (match-end 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1641 (setq name namefield |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1642 namefield "")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1643 (setq names (append names (list name))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1644 names)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1645 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1646 (defun bibtex-autokey-demangle-name (fullname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1647 ;; gets the `last' part from a well-formed name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1648 (let* (case-fold-search |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1649 (lastname |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1650 (if (string-match "," fullname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1651 ;; name is of the form "von Last, First" or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1652 ;; "von Last, Jr, First" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1653 ;; --> take only the part before the comma |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1654 (let ((von-last |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1655 (substring fullname 0 (match-beginning 0)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1656 (if (string-match "^[a-z]" von-last) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1657 ;; von-last has a "von" part --> take the "last" part |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1658 (if (string-match "[ \t][A-Z]" von-last) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1659 (substring von-last (1+ (match-beginning 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1660 (error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1661 "Name %s is incorrectly formed" fullname)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1662 ;; von-last has no "von" part --> take all |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1663 von-last)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1664 ;; name is of the form "First von Last" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1665 (if (string-match "[ \t]" fullname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1666 ;; more than one token |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1667 (if (string-match "[ \t][a-z]" fullname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1668 ;; there is a "von" part |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1669 ;; --> take everything after that |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1670 (if (string-match |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1671 "[ \t][A-Z]" fullname (match-end 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1672 (substring fullname (1+ (match-beginning 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1673 (error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1674 "Name %s is incorrectly formed" fullname)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1675 ;; there is no "von" part --> take only the last token |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1676 (if (string-match " [^ ]*$" fullname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1677 (substring fullname (1+ (match-beginning 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1678 (error "Name %s is incorrectly formed" fullname))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1679 ;; only one token --> take it |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1680 fullname))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1681 (usename |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1682 (if (string-match "[ \t]+" lastname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1683 ;; lastname consists of two or more tokens |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1684 ;; --> take only the first one |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1685 (substring lastname 0 (match-beginning 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1686 lastname))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1687 (if bibtex-autokey-preserve-case |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1688 usename |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1689 (downcase usename)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1690 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1691 (defun bibtex-autokey-get-namelist (namefield) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1692 ;; gets namefield, performs abbreviations on the last parts, and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1693 ;; return results as a list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1694 (mapcar |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1695 (lambda (fullname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1696 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1697 fullname (substring fullname (string-match "[^ \t]" fullname))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1698 (bibtex-autokey-abbrev |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1699 (bibtex-autokey-demangle-name fullname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1700 bibtex-autokey-name-length)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1701 (bibtex-autokey-get-names namefield))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1702 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1703 (defun bibtex-autokey-get-yearfield (min max) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1704 ;; get year field from current or maybe crossreferenced entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1705 (let ((case-fold-search t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1706 (goto-char min) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1707 (if (re-search-forward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1708 (bibtex-cfield "year" "[0-9]+") max t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1709 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1710 (match-beginning bibtex-text-in-cfield) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1711 (match-end bibtex-text-in-cfield)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1712 (if bibtex-autokey-year-use-crossref-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1713 (let ((crossref-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1714 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1715 (goto-char min) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1716 (if (re-search-forward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1717 (bibtex-cfield |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1718 "\\(OPT\\)?crossref" bibtex-field-text) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1719 max t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1720 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1721 (1+ |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1722 (match-beginning (+ bibtex-text-in-cfield 1))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1723 (1- |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1724 (match-end (+ bibtex-text-in-cfield 1)))))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1725 (if (not (bibtex-find-entry-location crossref-field t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1726 (let ((end-of-crefd-entry (bibtex-end-of-entry))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1727 (bibtex-beginning-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1728 (if (re-search-forward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1729 (bibtex-cfield "year" "[0-9]+") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1730 end-of-crefd-entry t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1731 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1732 (match-beginning bibtex-text-in-cfield) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1733 (match-end bibtex-text-in-cfield)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1734 "")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1735 "")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1736 "")))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1737 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1738 (defun bibtex-autokey-get-titlestring (min max) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1739 ;; get title field contents up to a terminator |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1740 (let ((case-fold-search t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1741 (let ((titlefield |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1742 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1743 (goto-char min) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1744 (if (re-search-forward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1745 (bibtex-cfield "title" bibtex-field-text) max t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1746 (bibtex-autokey-change |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1747 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1748 (match-beginning bibtex-text-in-cfield) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1749 (match-end bibtex-text-in-cfield)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1750 bibtex-autokey-titleword-change-strings) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1751 ""))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1752 (index 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1753 (numberofitems |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1754 (length bibtex-autokey-title-terminators))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1755 (while (< index numberofitems) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1756 (if (string-match |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1757 (elt bibtex-autokey-title-terminators index) titlefield) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1758 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1759 titlefield (substring titlefield 0 (match-beginning 0)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1760 (setq index (1+ index))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1761 titlefield))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1762 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1763 (defun bibtex-autokey-get-titles (titlestring) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1764 ;; gathers capitalized words from titlestring into a list. Ignores |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1765 ;; specific words at the beginning and use only a specific amount of |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1766 ;; words |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1767 (let (case-fold-search |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1768 titlewords |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1769 titlewords-extra |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1770 (counter 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1771 (first t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1772 (while (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1773 (not (equal titlestring "")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1774 (or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1775 (not (numberp bibtex-autokey-titlewords)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1776 (< counter |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1777 (+ bibtex-autokey-titlewords |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1778 bibtex-autokey-titlewords-stretch)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1779 (if (string-match "\\b[A-Z][A-Za-z0-9]*" titlestring) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1780 (let* ((end-match (match-end 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1781 (titleword |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1782 (if bibtex-autokey-preserve-case |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1783 (substring |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1784 titlestring (match-beginning 0) end-match) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1785 (downcase |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1786 (substring |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1787 titlestring (match-beginning 0) end-match))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1788 (if (or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1789 (not (numberp bibtex-autokey-titlewords)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1790 (< counter bibtex-autokey-titlewords)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1791 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1792 first |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1793 (bibtex-member-of-regexp |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1794 titleword |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1795 bibtex-autokey-titleword-first-ignore)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1796 (setq counter -1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1797 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1798 titlewords (append titlewords (list titleword)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1799 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1800 titlewords-extra |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1801 (append titlewords-extra (list titleword)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1802 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1803 titlestring (substring titlestring end-match))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1804 (setq titlestring "")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1805 (setq first nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1806 counter (1+ counter))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1807 (if (string-match "\\b[A-Z][^ ]*\\b" titlestring) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1808 titlewords |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1809 (append titlewords titlewords-extra)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1810 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1811 (defun bibtex-autokey-get-titlelist (titlestring) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1812 ;; returns all capitalized words in titlestring as a list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1813 ;; does some abbreviation on the found words |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1814 (mapcar |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1815 (lambda (titleword) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1816 (let ((abbrev |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
1817 (bibtex-assoc-of-regexp |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1818 titleword bibtex-autokey-titleword-abbrevs))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1819 (if abbrev |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1820 (elt abbrev 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1821 (bibtex-autokey-abbrev |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1822 titleword |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1823 bibtex-autokey-titleword-length)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1824 (bibtex-autokey-get-titles titlestring))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1825 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1826 (defun bibtex-generate-autokey () |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1827 ;; Generates automatically a key from the author/editor and the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1828 ;; title field. This will only work for entries where each field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1829 ;; begins on a separate line. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1830 ;; The generation algorithm works as follows: |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1831 ;; 1. Use the value of `bibtex-autokey-prefix-string' as a prefix. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1832 ;; 2. If there is a non-empty author (preferred) or editor field, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1833 ;; use it as the name part of the key. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1834 ;; 3. Change any substring found in |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1835 ;; `bibtex-autokey-name-change-strings' to the corresponding new |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1836 ;; one (see documentation of this variable for further detail). |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1837 ;; 4. For every of at least first `bibtex-autokey-names' names in |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1838 ;; the name field, determine the last name. If there are maximal |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1839 ;; `bibtex-autokey-names' + `bibtex-autokey-names-stretch' |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1840 ;; names, all names are used. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1841 ;; 5. From every last name, take at least |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1842 ;; `bibtex-autokey-name-length' characters (abort only after a |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1843 ;; consonant or at a word end). |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1844 ;; 6. Unless `bibtex-autokey-preserve-case' is non-nil, convert all |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1845 ;; last names to lowercase letters. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1846 ;; 7. Build the name part of the key by concatenating all |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1847 ;; abbreviated last names with the string |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1848 ;; `bibtex-autokey-name-separator' between any two. If there are |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1849 ;; more names than are used in the name part, prepend the string |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1850 ;; contained in `bibtex-autokey-additional-names'. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1851 ;; 8. Build the year part of the key by truncating the contents of |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1852 ;; the year field to the rightmost `bibtex-autokey-year-length' |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1853 ;; digits (useful values are 2 and 4). If the year field is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1854 ;; absent, but the entry has a valid crossref field and the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1855 ;; variable `bibtex-autokey-year-use-crossref-entry' is non-nil, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1856 ;; use the year field of the crossreferenced entry instead. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1857 ;; 9. For the title part of the key change the contents of the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1858 ;; title field of the reference according to |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1859 ;; `bibtex-autokey-titleword-change-strings' to the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1860 ;; corresponding new one (see documentation of this variable for |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1861 ;; further detail). |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1862 ;; 10. Abbreviate the result to the string up to (but not including) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1863 ;; the first occurrence of a regexp matched by the items of |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1864 ;; `bibtex-autokey-title-terminators' and delete the first |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1865 ;; word if it appears in |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1866 ;; `bibtex-autokey-titleword-first-ignore'. Build the title part |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1867 ;; of the key by using at least the first |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1868 ;; `bibtex-autokey-titlewords' capitalized words from this |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1869 ;; abbreviated title. If the abbreviated title ends after |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1870 ;; maximal `bibtex-autokey-titlewords' + |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1871 ;; `bibtex-autokey-titlewords-stretch' capitalized words, all |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1872 ;; capitalized words from the abbreviated title are used. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1873 ;; 11. Unless `bibtex-autokey-preserve-case' is non-nil, convert all |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1874 ;; used titlewords to lowercase letters. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1875 ;; 12. For every used title word that appears in |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1876 ;; `bibtex-autokey-titleword-abbrevs' use the corresponding |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1877 ;; abbreviation (see documentation of this variable for further |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1878 ;; detail). |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1879 ;; 13. From every title word not generated by an abbreviation, take |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1880 ;; at least `bibtex-autokey-titleword-length' characters (abort |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1881 ;; only after a consonant or at a word end). |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1882 ;; 14. Build the title part of the key by concatenating all |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1883 ;; abbreviated title words with the string |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1884 ;; `bibtex-autokey-titleword-separator' between any two. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1885 ;; 15. At least, to get the key, concatenate |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1886 ;; `bibtex-autokey-prefix-string', the name part, the year part |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1887 ;; and the title part with `bibtex-autokey-name-year-separator' |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1888 ;; between the name part and the year part if both are non-empty |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1889 ;; and `bibtex-autokey-year-title-separator' between the year |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1890 ;; part and the title part if both are non-empty. If the year |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1891 ;; part is empty, but not the other two parts, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1892 ;; `bibtex-autokey-year-title-separator' is used as well. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1893 ;; 16. If the value of `bibtex-autokey-before-presentation-hook' is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1894 ;; non-nil, it must be a function taking one argument. This |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1895 ;; function is then called with the generated key as the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1896 ;; argument. The return value of this function (a string) is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1897 ;; used as the key. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1898 ;; 17. If the value of `bibtex-autokey-edit-before-use' is non-nil, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1899 ;; the key is then presented in the minibuffer to the user, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1900 ;; where it can be edited. The key given by the user is then |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1901 ;; used. |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
1902 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1903 (let* ((pnt (point)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1904 (min (bibtex-beginning-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1905 (max (bibtex-end-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1906 (namefield (bibtex-autokey-get-namefield min max)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1907 (name-etal "") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1908 (namelist |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1909 (let ((nl (bibtex-autokey-get-namelist namefield))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1910 (if (or (not (numberp bibtex-autokey-names)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1911 (<= (length nl) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1912 (+ bibtex-autokey-names |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1913 bibtex-autokey-names-stretch))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1914 nl |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1915 (setq name-etal bibtex-autokey-additional-names) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1916 (let (nnl) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1917 (while (< (length nnl) bibtex-autokey-names) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1918 (setq nnl (append nnl (list (car nl))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1919 nl (cdr nl))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1920 nnl)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1921 (namepart |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1922 (concat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1923 (mapconcat (lambda (name) name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1924 namelist |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1925 bibtex-autokey-name-separator) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1926 name-etal)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1927 (yearfield (bibtex-autokey-get-yearfield min max)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1928 (yearpart |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1929 (if (equal yearfield "") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1930 "" |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1931 (substring |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1932 yearfield |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1933 (- (length yearfield) bibtex-autokey-year-length)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1934 (titlestring (bibtex-autokey-get-titlestring min max)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1935 (titlelist (bibtex-autokey-get-titlelist titlestring)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1936 (titlepart |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1937 (mapconcat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1938 (lambda (name) name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1939 titlelist |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1940 bibtex-autokey-titleword-separator)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1941 (autokey |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1942 (concat |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1943 bibtex-autokey-prefix-string |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1944 namepart |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1945 (if (not |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1946 (or |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1947 (equal namepart "") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1948 (equal yearpart ""))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1949 bibtex-autokey-name-year-separator) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1950 yearpart |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1951 (if (not |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1952 (or |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1953 (and |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1954 (equal namepart "") |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1955 (equal yearpart "")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1956 (equal titlepart ""))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1957 bibtex-autokey-year-title-separator) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1958 titlepart))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1959 (if bibtex-autokey-before-presentation-hook |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1960 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1961 autokey |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1962 (funcall bibtex-autokey-before-presentation-hook autokey))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1963 (goto-char pnt) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1964 autokey)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1965 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1966 (defun bibtex-parse-keys (add verbose &optional abortable) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1967 ;; Sets bibtex-keys to the keys used in the whole (possibly |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1968 ;; restricted) buffer (either as entry keys or as crossref entries). |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1969 ;; If ADD is non-nil adds the new keys to bibtex-keys instead of |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1970 ;; simply resetting it. If VERBOSE is non-nil gives messages about |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1971 ;; progress. If ABORTABLE is non-nil abort on user input. |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1972 (if bibtex-maintain-sorted-entries |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1973 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1974 (crossref-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1975 (bibtex-cfield |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1976 "crossref" (concat "[{\"]" bibtex-reference-key "[}\"]"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1977 (labels (if add |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1978 bibtex-keys))) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1979 (save-excursion |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1980 (goto-char (point-min)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1981 (if verbose |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1982 (bibtex-progress-message |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1983 (concat (buffer-name) ": parsing reference keys"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1984 (if (catch 'userkey |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
1985 (bibtex-skip-to-valid-entry) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1986 (while (not (eobp)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1987 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1988 abortable |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1989 (input-pending-p)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1990 (throw 'userkey t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1991 (if verbose |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1992 (bibtex-progress-message)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1993 (let (label |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1994 label2) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1995 (cond |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1996 ((looking-at bibtex-reference-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1997 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1998 label |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1999 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2000 (match-beginning bibtex-key-in-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2001 (match-end bibtex-key-in-head))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2002 (let ((p (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2003 (m (bibtex-end-of-entry))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2004 (goto-char p) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2005 (if (re-search-forward crossref-field m t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2006 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2007 label2 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2008 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2009 (1+ (match-beginning bibtex-text-in-cfield)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2010 (1- (match-end bibtex-text-in-cfield))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2011 (goto-char p))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2012 ((looking-at bibtex-string) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2013 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2014 label |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2015 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2016 (match-beginning bibtex-key-in-string) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2017 (match-end bibtex-key-in-string))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2018 (forward-char) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
2019 (bibtex-skip-to-valid-entry) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2020 (if (not (assoc label labels)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2021 (setq labels |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2022 (cons (list label) labels))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2023 (if (and label2 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2024 (not (assoc label2 labels))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2025 (setq labels |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2026 (cons (list label2) labels)))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2027 ;; user has aborted by typing a key --> return nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2028 nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2029 ;; successful operation --> return t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2030 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2031 bibtex-buffer-last-parsed-tick (buffer-modified-tick) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2032 bibtex-keys labels) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2033 (if verbose |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2034 (bibtex-progress-message 'done)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2035 t))))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
2036 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2037 (defun bibtex-parse-buffers-stealthily () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2038 ;; Called by run-with-idle-timer. Whenever emacs has been idle for |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2039 ;; bibtex-parse-keys-timeout seconds, all BibTeX buffers (starting |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2040 ;; with the current) are parsed. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2041 (let ((buffers (buffer-list))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
2042 (save-excursion |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2043 (while (and buffers (not (input-pending-p))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2044 (set-buffer (car buffers)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2045 (save-restriction |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2046 (widen) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
2047 (if (and |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2048 (eq major-mode 'bibtex-mode) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2049 bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2050 (not |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2051 (eq (buffer-modified-tick) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2052 bibtex-buffer-last-parsed-tick))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2053 (if (bibtex-parse-keys nil t t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2054 ;; successful operation --> remove buffer from list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2055 (setq buffers (cdr buffers))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2056 ;; buffer is no BibTeX buffer or needs no parsing |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2057 (setq buffers (cdr buffers)))))))) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
2058 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2059 (defun bibtex-complete (string-list &optional complete-strings) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2060 ;; Complete word fragment before point to longest prefix of one |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2061 ;; string defined in STRING-LIST. If point is not after the part of |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2062 ;; a word, all strings are listed. If COMPLETE-STRINGS is non-nil, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2063 ;; add the strings defined in this buffer before cursor to |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2064 ;; STRING-LIST and remove surrounding delimiters if complete string |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2065 ;; could be expanded. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2066 (let* ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2067 (end (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2068 (beg (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2069 (re-search-backward "[ \t{\"]") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2070 (forward-char) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2071 (point))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2072 (part-of-word (buffer-substring-no-properties beg end)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2073 (completions (copy-sequence string-list)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2074 (completion (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2075 (if complete-strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2076 (while (re-search-backward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2077 bibtex-string nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2078 (setq completions |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2079 (cons |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2080 (list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2081 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2082 (match-beginning bibtex-key-in-string) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2083 (match-end bibtex-key-in-string))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2084 completions)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2085 (setq completions |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2086 (sort completions |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2087 (lambda(x y) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2088 (string-lessp |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2089 (car x) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2090 (car y))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2091 (try-completion part-of-word completions)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2092 (cond ((eq completion t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2093 (if complete-strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2094 ;; remove double-quotes or braces if field is no concatenation |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2095 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2096 (bibtex-inside-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2097 (bibtex-enclosing-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2098 (let ((end (match-end bibtex-text-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2099 (goto-char (match-beginning bibtex-text-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2100 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2101 (looking-at bibtex-field-string) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2102 (equal (match-end 0) end)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2103 (bibtex-remove-delimiters)))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2104 ((not completion) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2105 (error "Can't find completion for \"%s\"." part-of-word)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2106 ((not (string= part-of-word completion)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2107 (delete-region beg end) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2108 (insert completion) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2109 (if (and (assoc completion completions) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2110 complete-strings) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2111 ;; remove double-quotes or braces if field is no concatenation |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2112 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2113 (bibtex-inside-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2114 (bibtex-enclosing-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2115 (let ((end (match-end bibtex-text-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2116 (goto-char (match-beginning bibtex-text-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2117 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2118 (looking-at bibtex-field-string) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2119 (equal (match-end 0) end)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2120 (bibtex-remove-delimiters)))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2121 (t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2122 (message "Making completion list...") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2123 (let ((list (all-completions part-of-word completions))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2124 (with-output-to-temp-buffer "*Completions*" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2125 (display-completion-list list))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2126 (message "Making completion list...done"))))) |
257 | 2127 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2128 (defun bibtex-do-auto-fill () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2129 (let ((fill-prefix |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2130 (make-string |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2131 (+ bibtex-entry-offset bibtex-contline-indentation) ? ))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2132 (do-auto-fill))) |
257 | 2133 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2134 (defun bibtex-pop (arg direction) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2135 ;; generic function to be used by bibtex-pop-previous and bibtex-pop-next |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2136 (let (bibtex-help-message) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2137 (bibtex-find-text nil)) |
257 | 2138 (save-excursion |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2139 ;; parse current field |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2140 (bibtex-inside-field) |
257 | 2141 (bibtex-enclosing-field) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2142 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2143 (start-old-text (match-beginning bibtex-text-in-field)) |
257 | 2144 (stop-old-text (match-end bibtex-text-in-field)) |
2145 (start-name (match-beginning bibtex-name-in-field)) | |
2146 (stop-name (match-end bibtex-name-in-field)) | |
2147 (new-text)) | |
2148 (goto-char start-name) | |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2149 ;; construct regexp for field with same name as this one, |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2150 ;; ignoring possible OPT's or ALT's |
257 | 2151 (let ((matching-entry |
2152 (bibtex-cfield | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2153 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2154 (if (looking-at "OPT\\|ALT") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2155 (+ (point) (length "OPT")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2156 (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2157 stop-name) |
257 | 2158 bibtex-field-text))) |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2159 ;; if executed several times in a row, start each search where |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2160 ;; the last one was finished |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2161 (cond ((eq last-command 'bibtex-pop) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2162 t |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2163 ) |
257 | 2164 (t |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
2165 (bibtex-enclosing-reference-maybe-empty-head) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2166 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2167 bibtex-pop-previous-search-point (match-beginning 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2168 bibtex-pop-next-search-point (point)))) |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2169 (if (eq direction 'previous) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2170 (goto-char bibtex-pop-previous-search-point) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2171 (goto-char bibtex-pop-next-search-point)) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2172 ;; Now search for arg'th previous/next similar field |
257 | 2173 (cond |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2174 ((if (eq direction 'previous) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2175 (re-search-backward matching-entry nil t arg) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2176 (re-search-forward matching-entry nil t arg)) |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2177 ;; Found a matching field. Remember boundaries. |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2178 (setq bibtex-pop-previous-search-point (match-beginning 0)) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2179 (setq bibtex-pop-next-search-point (match-end 0)) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2180 (setq new-text |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
2181 (buffer-substring-no-properties |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2182 (match-beginning bibtex-text-in-field) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2183 (match-end bibtex-text-in-field))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
2184 ;; change delimiters, if any changes needed |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2185 (let ((start 0) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2186 old-open |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2187 new-open |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2188 old-close |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2189 new-close) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2190 (if (equal bibtex-field-delimiters 'braces) |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2191 (setq old-open ?\" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2192 new-open ?\{ |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2193 old-close ?\" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2194 new-close ?\}) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2195 (setq old-open ?\{ |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2196 new-open ?\" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2197 old-close ?\} |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2198 new-close ?\")) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2199 (while (string-match bibtex-field-string new-text start) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2200 (let ((beg (match-beginning 0)) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2201 (end (1- (match-end 0)))) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2202 (if (and |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2203 (eq (aref new-text beg) old-open) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2204 (eq (aref new-text end) old-close)) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2205 (progn |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2206 (aset new-text beg new-open) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2207 (aset new-text end new-close)))) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2208 (setq start (match-end 0)))) |
257 | 2209 (bibtex-flash-head) |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2210 ;; Go back to where we started, delete old text, and pop new. |
257 | 2211 (goto-char stop-old-text) |
2212 (delete-region start-old-text stop-old-text) | |
2213 (insert new-text)) | |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2214 (t |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2215 ;; search failed |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2216 (error (concat "No " |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2217 (if (eq direction 'previous) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2218 "previous" |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2219 "next") |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2220 " matching BibTeX field."))))))) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2221 (let (bibtex-help-message) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2222 (bibtex-find-text nil)) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2223 (setq this-command 'bibtex-pop)) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2224 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2225 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2226 ;; Interactive Functions: |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2227 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2228 ;;;###autoload |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2229 (defun bibtex-mode () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2230 "Major mode for editing BibTeX files. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2231 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2232 To submit a problem report, enter \\[bibtex-submit-bug-report] from a |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2233 bibtex-mode buffer. This automatically sets up a mail buffer with |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2234 version information already added. You just need to add a description |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2235 of the problem, including a reproducable test case and send the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2236 message. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2237 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2238 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2239 General information on working with BibTeX mode: |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2240 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2241 You should use commands as \\[bibtex-Book] to get a template for a |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2242 specific entry. You should then fill in all desired fields using |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2243 \\[bibtex-next-field] to jump from field to field. After having filled |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2244 in all desired fields in the entry, you should clean the new entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2245 with command \\[bibtex-clean-entry]. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2246 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2247 Some features of BibTeX mode are available only by setting variable |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2248 bibtex-maintain-sorted-entries to t. However, then BibTeX mode will |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2249 work with buffer containing only valid (syntactical correct) entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2250 and with entries being sorted. This is usually the case, if you have |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2251 created a buffer completely with BibTeX mode and finished every new |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2252 entry with \\[bibtex-clean-entry]. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2253 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2254 For third party BibTeX buffers, please call the function |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2255 `bibtex-convert-alien' to fully take advantage of all features of |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2256 BibTeX mode. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2257 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2258 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2259 Special information: |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2260 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2261 A command such as \\[bibtex-Book] will outline the fields for a BibTeX book entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2262 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2263 The optional fields start with the string OPT, and are thus ignored by BibTeX. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2264 Alternatives from which only one is required start with the string ALT. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2265 The OPT or ALT string may be removed from a field with \\[bibtex-remove-OPT-or-ALT]. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2266 \\[bibtex-make-field] inserts a new field after the current one. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2267 \\[bibtex-kill-field] kills the current field entirely. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2268 \\[bibtex-yank] will yank the last recently killed field after the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2269 current field. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2270 \\[bibtex-remove-delimiters] removes the double-quotes or braces around the text of the current field. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2271 \\[bibtex-empty-field] replaces the text of the current field with the default \"\" or {}. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2272 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2273 The command \\[bibtex-clean-entry] cleans the current entry, i.e. it removes OPT/ALT |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2274 from all non-empty optional or alternative fields, checks that no required |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2275 fields are empty, and does some formatting dependent on the value of |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2276 bibtex-entry-format. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2277 Note: some functions in BibTeX mode depend on entries being in a special |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2278 format (all fields beginning on separate lines), so it is usually a bad |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2279 idea to remove `realign' from bibtex-entry-format. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2280 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2281 Use \\[bibtex-find-text] to position the cursor at the end of the current field. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2282 Use \\[bibtex-next-field] to move to end of the next field. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2283 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2284 The following may be of interest as well: |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2285 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2286 Functions: |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2287 bibtex-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2288 bibtex-kill-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2289 bibtex-yank-pop |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2290 bibtex-pop-previous |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2291 bibtex-pop-next |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2292 bibtex-complete-string |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2293 bibtex-complete-key |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2294 bibtex-print-help-message |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2295 bibtex-generate-autokey |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2296 bibtex-beginning-of-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2297 bibtex-end-of-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2298 bibtex-reposition-window |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2299 bibtex-mark-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2300 bibtex-ispell-abstract |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2301 bibtex-ispell-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2302 bibtex-narrow-to-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2303 bibtex-hide-entry-bodies |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2304 bibtex-sort-buffer |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2305 bibtex-validate |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2306 bibtex-count |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2307 bibtex-fill-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2308 bibtex-reformat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2309 bibtex-convert-alien |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2310 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2311 Variables: |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2312 bibtex-field-delimiters |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2313 bibtex-include-OPTcrossref |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2314 bibtex-include-OPTkey |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2315 bibtex-user-optional-fields |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2316 bibtex-entry-format |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2317 bibtex-sort-ignore-string-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2318 bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2319 bibtex-entry-field-alist |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2320 bibtex-predefined-strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2321 bibtex-string-files |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2322 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2323 --------------------------------------------------------- |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2324 Entry to BibTeX mode calls the value of bibtex-mode-hook if that value is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2325 non-nil. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2326 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2327 \\{bibtex-mode-map} |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2328 " |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2329 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2330 (kill-all-local-variables) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2331 (use-local-map bibtex-mode-map) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2332 (setq major-mode 'bibtex-mode) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2333 (setq mode-name "BibTeX") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2334 (set-syntax-table bibtex-mode-syntax-table) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2335 (setq bibtex-strings bibtex-predefined-strings) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2336 (mapcar |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2337 (lambda (filename) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2338 ;; collect pathnames |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2339 (let* ((path (if bibtex-string-file-path |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2340 bibtex-string-file-path |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2341 ".")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2342 (dirs |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2343 (mapcar |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2344 (lambda (dirname) ;; strips off trailing slashes |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2345 (let ((len (length dirname))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2346 (if (equal (elt dirname (1- len)) "/") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2347 (substring dirname 0 (1- (1- len))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2348 dirname))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2349 (let (actdirs) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2350 (while (string-match ":" path) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2351 (setq actdirs |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2352 (append actdirs |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2353 (list (substring path 0 (1- (match-end 0))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2354 path (substring path (match-end 0)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2355 (append actdirs (list path))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2356 (filename (if (string-match "\.bib$" filename) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2357 filename |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2358 (concat filename ".bib"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2359 fullfilename |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2360 (item 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2361 (size (length dirs))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2362 ;; test filenames |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2363 (while (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2364 (< item size) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2365 (not (file-readable-p |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2366 (setq fullfilename |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2367 (concat (elt dirs item) "/" filename))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2368 (setq item (1+ item))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2369 (if (< item size) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2370 ;; file was found |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2371 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2372 (curbuf (current-buffer)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2373 (bufname (make-temp-name "")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2374 (compl bibtex-strings)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2375 (create-file-buffer bufname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2376 (set-buffer bufname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2377 (insert-file-contents fullfilename) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2378 (goto-char (point-min)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2379 (while (re-search-forward bibtex-string nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2380 (setq compl |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2381 (append compl |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2382 (list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2383 (list (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2384 (match-beginning bibtex-key-in-string) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2385 (match-end bibtex-key-in-string))))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2386 (kill-buffer bufname) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2387 (set-buffer curbuf) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2388 (setq bibtex-strings compl)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2389 (error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2390 "File %s not in paths defined by bibtex-string-file-path variable." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2391 filename)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2392 bibtex-string-files) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2393 (if bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2394 (run-with-idle-timer |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2395 0 nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2396 (lambda () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2397 (bibtex-parse-keys nil t t)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2398 ;; to get buffer parsed once if everything else (including things |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2399 ;; installed in bibtex-mode-hook) has done its work |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2400 (if (not bibtex-parse-idle-timer) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2401 (setq bibtex-parse-idle-timer |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2402 (run-with-idle-timer |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2403 bibtex-parse-keys-timeout t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2404 'bibtex-parse-buffers-stealthily))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2405 ;; Install stealthy parse function if not already installed |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2406 (set (make-local-variable 'paragraph-start) "[ \f\n\t]*$") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2407 (set (make-local-variable 'comment-start) "@Comment ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2408 (set (make-local-variable 'comment-start-skip) "@Comment ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2409 (set (make-local-variable 'comment-column) 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2410 (set (make-local-variable 'normal-auto-fill-function) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2411 'bibtex-do-auto-fill) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2412 (set (make-local-variable 'font-lock-defaults) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2413 '(bibtex-font-lock-keywords |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2414 nil t ((?$ . "\"") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2415 ;; Mathematical expressions should be fontified as strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2416 (?\" . ".") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2417 ;; Quotes are field delimiters and quote-delimited |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2418 ;; entries should be fontified in the same way as |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2419 ;; brace-delimited ones |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2420 ))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2421 (setq font-lock-mark-block-function |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2422 (lambda () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2423 (set-mark (bibtex-end-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2424 (bibtex-beginning-of-entry))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2425 (setq imenu-generic-expression |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2426 (list (list nil bibtex-reference-head bibtex-key-in-head))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2427 (run-hooks 'bibtex-mode-hook)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2428 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2429 (defun bibtex-submit-bug-report () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2430 "Submit via mail a bug report on bibtex.el." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2431 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2432 (if (y-or-n-p "Do you want to submit a bug report on BibTeX mode? ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2433 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2434 (require 'reporter) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2435 (let ((reporter-prompt-for-summary-p t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2436 (reporter-submit-bug-report |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2437 bibtex-maintainer-address |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2438 (concat "bibtex.el " "(emacs 19.35)") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2439 (list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2440 'system-configuration |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2441 'system-configuration-options |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2442 'bibtex-mode-hook |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2443 'bibtex-parse-keys-timeout |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2444 ;; possible general errors |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2445 'bibtex-sort-ignore-string-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2446 'bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2447 'bibtex-entry-delimiters |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2448 'bibtex-field-delimiters |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2449 'bibtex-comma-after-last-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2450 'bibtex-entry-offset |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2451 'bibtex-field-indentation |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2452 'bibtex-text-indentation |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2453 'bibtex-contline-indentation |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2454 'bibtex-align-at-equal-sign |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2455 ;; possible sorting and parsing bugs |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2456 'bibtex-entry-format |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2457 'bibtex-add-entry-hook |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2458 'bibtex-clean-entry-hook |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2459 ;; possible cleaning error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2460 'bibtex-user-optional-fields |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2461 ;; possible format error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2462 'bibtex-predefined-month-strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2463 'bibtex-predefined-strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2464 'bibtex-string-files |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2465 'bibtex-string-file-path |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2466 ;; possible format error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2467 'bibtex-font-lock-keywords |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2468 ;; possible bugs regarding fontlocking |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2469 'bibtex-autokey-prefix-string |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2470 'bibtex-autokey-names |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2471 'bibtex-autokey-names-stretch |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2472 'bibtex-autokey-additional-names |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2473 'bibtex-autokey-transcriptions |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2474 'bibtex-autokey-name-change-strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2475 'bibtex-autokey-name-length |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2476 'bibtex-autokey-name-separator |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2477 'bibtex-autokey-year-length |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2478 'bibtex-autokey-year-use-crossref-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2479 'bibtex-autokey-titlewords |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2480 'bibtex-autokey-title-terminators |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2481 'bibtex-autokey-titlewords-stretch |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2482 'bibtex-autokey-titleword-first-ignore |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2483 'bibtex-autokey-titleword-abbrevs |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2484 'bibtex-autokey-titleword-change-strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2485 'bibtex-autokey-titleword-length |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2486 'bibtex-autokey-titleword-separator |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2487 'bibtex-autokey-name-year-separator |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2488 'bibtex-autokey-year-title-separator |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2489 'bibtex-autokey-preserve-case |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2490 'bibtex-autokey-edit-before-use |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2491 'bibtex-autokey-before-presentation-hook |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2492 ;; possible bugs regarding automatic labels |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2493 'bibtex-entry-field-alist |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2494 ;; possible format error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2495 'bibtex-help-message |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2496 'bibtex-include-OPTcrossref |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2497 'bibtex-include-OPTkey |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2498 'bibtex-field-kill-ring-max |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2499 'bibtex-entry-kill-ring-max |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2500 ;; user variables which shouldn't cause any errors |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2501 ) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2502 nil nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2503 (concat "Hi Stefan, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2504 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2505 I want to report a bug on Emacs BibTeX mode. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2506 I've read the `Bugs' section in the `Emacs' info page, so I know how |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2507 to make a clear and unambiguous report. I have started a fresh Emacs |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2508 via `"invocation-name " --no-init-file --no-site-file', thereafter (in |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2509 case I'm reporting on a version of `bibtex.el' which is not part of |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2510 the standard emacs distribution) I loaded the questionable version |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2511 of `bibtex.el' with `M-x load-file', and then, to produce the buggy |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2512 behaviour, I did the following:"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2513 (message nil)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2514 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2515 (defun bibtex-entry (entry-type) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2516 "Inserts a new BibTeX entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2517 After insertion it calls the functions in bibtex-add-entry-hook." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2518 (interactive (let* ((completion-ignore-case t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2519 (e-t (completing-read |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2520 "Entry Type: " |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2521 bibtex-entry-field-alist |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2522 nil t nil 'bibtex-entry-type-history))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2523 (list e-t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2524 (if (not bibtex-keys) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2525 (bibtex-parse-keys nil t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2526 (let* (required |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2527 optional |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2528 (key |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2529 (if bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2530 (completing-read |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2531 (format "%s key: " entry-type) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2532 bibtex-keys nil nil nil 'bibtex-key-history))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2533 (e (assoc-ignore-case entry-type bibtex-entry-field-alist)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2534 (r-n-o (elt e 1)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2535 (c-ref (elt e 2))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2536 (if (not e) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2537 (error "Bibtex entry type %s not defined." entry-type)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2538 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2539 (member entry-type bibtex-include-OPTcrossref) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2540 c-ref) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2541 (setq required (elt c-ref 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2542 optional (elt c-ref 1)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2543 (setq required (elt r-n-o 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2544 optional (elt r-n-o 1))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2545 (if bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2546 (bibtex-find-entry-location key) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2547 (bibtex-move-outside-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2548 (indent-to-column bibtex-entry-offset) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2549 (insert "@" entry-type (bibtex-entry-left-delimiter)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2550 (if key |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2551 (insert key)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2552 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2553 (mapcar 'bibtex-make-field required) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2554 (if (member entry-type bibtex-include-OPTcrossref) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2555 (bibtex-make-optional-field '("crossref"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2556 (if bibtex-include-OPTkey |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2557 (if (or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2558 (stringp bibtex-include-OPTkey) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2559 (fboundp bibtex-include-OPTkey)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2560 (bibtex-make-optional-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2561 (list "key" nil bibtex-include-OPTkey)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2562 (bibtex-make-optional-field '("key")))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2563 (mapcar 'bibtex-make-optional-field optional) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2564 (mapcar 'bibtex-make-optional-field bibtex-user-optional-fields) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2565 (if bibtex-comma-after-last-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2566 (insert ",")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2567 (insert "\n") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2568 (indent-to-column bibtex-entry-offset) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2569 (insert (bibtex-entry-right-delimiter) "\n\n")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2570 (bibtex-next-field t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2571 (run-hooks 'bibtex-add-entry-hook))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2572 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2573 (defun bibtex-print-help-message () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2574 "Prints helpful information about current field in current BibTeX entry." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2575 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2576 (let* ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2577 (pnt (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2578 (field-name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2579 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2580 (condition-case errname |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2581 (bibtex-enclosing-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2582 (search-failed |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2583 (goto-char pnt) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2584 (error "Not on BibTeX field."))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2585 (let ((mb (match-beginning bibtex-name-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2586 (me (match-end bibtex-name-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2587 (goto-char mb) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2588 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2589 (if (looking-at "OPT\\|ALT") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2590 (+ 3 mb) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2591 mb) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2592 me)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2593 (reference-type |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2594 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2595 (re-search-backward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2596 bibtex-reference-maybe-empty-head nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2597 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2598 (1+ (match-beginning bibtex-type-in-head)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2599 (match-end bibtex-type-in-head)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2600 (entry-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2601 (assoc-ignore-case reference-type |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2602 bibtex-entry-field-alist)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2603 (c-r-list (elt entry-list 2)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2604 (req-opt-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2605 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2606 (member reference-type bibtex-include-OPTcrossref) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2607 c-r-list) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2608 c-r-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2609 (elt entry-list 1))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2610 (list-of-entries (append |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2611 (elt req-opt-list 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2612 (elt req-opt-list 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2613 bibtex-user-optional-fields |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2614 (if (member |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2615 reference-type |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2616 bibtex-include-OPTcrossref) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2617 '(("crossref" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2618 "Label of the crossreferenced entry"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2619 (if bibtex-include-OPTkey |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2620 '(("key" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2621 "Key used for label creation if author and editor fields are missing")))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2622 (goto-char pnt) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2623 (let ((comment (assoc-ignore-case field-name list-of-entries))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2624 (if comment |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2625 (message (elt comment 1)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2626 (message "NO COMMENT AVAILABLE"))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2627 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2628 (defun bibtex-make-field (e-t &optional called-by-yank) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2629 "Makes a field named E-T in current BibTeX entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2630 This function is for interactive and non-interactive purposes. To call |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2631 it interactively, just give it no arguments and enter the field name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2632 using the minibuffer." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2633 (interactive "*P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2634 (if (not e-t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2635 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2636 e-t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2637 (let* ((reference-type |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2638 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2639 (bibtex-enclosing-reference-maybe-empty-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2640 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2641 (1+ (match-beginning bibtex-type-in-head)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2642 (match-end bibtex-type-in-head)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2643 (fl |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2644 (car (cdr (assoc-ignore-case |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2645 reference-type bibtex-entry-field-alist)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2646 (field-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2647 (append |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2648 (elt fl 0) (elt fl 1) bibtex-user-optional-fields |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2649 (if bibtex-include-OPTcrossref '(("crossref" nil))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2650 (if bibtex-include-OPTkey '(("key" nil))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2651 (completion-ignore-case t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2652 (completing-read |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2653 "BibTeX field name: " field-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2654 nil nil nil bibtex-field-history)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2655 (if (not (consp e-t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2656 (setq e-t (list e-t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2657 (if (equal (length e-t) 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2658 (setq e-t (append e-t (list "")))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2659 (if (equal (length e-t) 2) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2660 (setq e-t (append e-t (list "")))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2661 (let ((name (if (elt e-t 3) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2662 (concat "ALT" (car e-t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2663 (car e-t)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2664 (if (or (interactive-p) called-by-yank) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2665 (let (bibtex-help-message) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2666 (bibtex-find-text nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2667 (if (looking-at "[}\"]") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2668 (forward-char)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2669 (insert ",\n") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2670 (indent-to-column |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2671 (+ bibtex-entry-offset bibtex-field-indentation)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2672 (insert name " ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2673 (if bibtex-align-at-equal-sign |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2674 (indent-to-column |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2675 (+ bibtex-entry-offset (- bibtex-text-indentation 2)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2676 (insert "= ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2677 (if (not bibtex-align-at-equal-sign) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2678 (indent-to-column |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2679 (+ bibtex-entry-offset bibtex-text-indentation))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2680 (insert (if called-by-yank |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2681 "" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2682 (bibtex-field-left-delimiter)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2683 (let ((init (elt e-t 2))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2684 (cond |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2685 ((stringp init) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2686 init) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2687 ((fboundp init) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2688 (funcall init)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2689 (t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2690 (error "%s is neither a string nor a function." init)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2691 (if called-by-yank |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2692 "" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2693 (bibtex-field-right-delimiter))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2694 (if (interactive-p) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2695 (forward-char -1)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2696 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2697 (defun bibtex-beginning-of-entry () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2698 "Move to beginning of BibTeX entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2699 If inside an entry, move to the beginning of it, otherwise move to the |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2700 beginning of the previous entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2701 If called from a program returns point." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2702 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2703 (skip-chars-forward " \t") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2704 (if (looking-at "@") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2705 (forward-char)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2706 (re-search-backward "^[ \t]*@" nil 'move)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2707 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2708 (defun bibtex-end-of-entry () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2709 "Move to end of BibTeX entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2710 If inside an entry, move to the end of it, otherwise move to the end |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2711 of the previous entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2712 If called from a program returns point." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2713 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2714 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2715 (valid-entry-head |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2716 (concat "[ \t]*@[ \t]*\\(" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2717 (mapconcat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2718 (lambda (type) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2719 (concat "\\(" (car type) "\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2720 bibtex-entry-field-alist |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2721 "\\|") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2722 "\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2723 (org (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2724 (pnt (bibtex-beginning-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2725 err) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2726 (cond |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2727 ((looking-at "[ \t]*@[ \t]*string[ \t\n]*[({]") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2728 (if (not (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2729 (re-search-forward bibtex-string nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2730 (equal (match-beginning 0) pnt))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2731 (setq err t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2732 ((looking-at "[ \t]*@[ \t]*preamble[ \t\n]*") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2733 (goto-char (match-end 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2734 (cond |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2735 ((looking-at "(") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2736 (if (not (re-search-forward ")[ \t]*\n\n" nil 'move)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2737 (setq err t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2738 ((looking-at "{") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2739 (if (not (re-search-forward "}[ \t]*\n\n" nil 'move)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2740 (setq err t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2741 (t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2742 (setq err t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2743 (if (not err) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2744 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2745 (goto-char (match-beginning 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2746 (forward-char)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2747 ((looking-at valid-entry-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2748 (bibtex-search-reference t nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2749 (if (not (equal (match-beginning 0) pnt)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2750 (setq err t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2751 (t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2752 (if (interactive-p) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2753 (message "Not on a known BibTeX entry.")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2754 (goto-char org))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2755 (if err |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2756 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2757 (goto-char pnt) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2758 (error "Syntactical incorrect entry starts here.")))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2759 (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2760 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2761 (defun bibtex-reposition-window (arg) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2762 "Make the current BibTeX entry visible." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2763 (interactive "P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2764 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2765 (goto-char |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2766 (/ (+ (bibtex-beginning-of-entry) (bibtex-end-of-entry)) 2)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2767 (recenter arg))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2768 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2769 (defun bibtex-mark-entry () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2770 "Put mark at beginning, point at end of current BibTeX entry." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2771 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2772 (set-mark (bibtex-beginning-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2773 (bibtex-end-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2774 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2775 (defun bibtex-count-entries (&optional count-string-entries) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2776 "Count number of entries in current buffer or region. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2777 With prefix argument it counts all entries, otherwise it counts all |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2778 except Strings. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2779 If mark is active it counts entries in region, if not in whole buffer." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2780 (interactive "P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2781 (let ((pnt (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2782 (start-point |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2783 (if mark-active |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2784 (region-beginning) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2785 (bibtex-beginning-of-first-entry))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2786 (end-point |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2787 (if mark-active |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2788 (region-end) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2789 (point-max))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2790 (number 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2791 (bibtex-sort-ignore-string-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2792 (not count-string-entries))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2793 (save-restriction |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2794 (narrow-to-region start-point end-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2795 (goto-char start-point) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
2796 (bibtex-map-entries |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2797 (lambda (current) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2798 (setq number (1+ number))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2799 (message (concat (if mark-active "Region" "Buffer") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2800 " contains %d entries.") number) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2801 (goto-char pnt))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2802 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2803 (defun bibtex-ispell-entry () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2804 "Spell whole BibTeX entry." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2805 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2806 (ispell-region (bibtex-beginning-of-entry) (bibtex-end-of-entry))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2807 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2808 (defun bibtex-ispell-abstract () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2809 "Spell abstract of BibTeX entry." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2810 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2811 (let ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2812 (pnt (bibtex-end-of-entry))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2813 (bibtex-beginning-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2814 (if (not |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2815 (re-search-forward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2816 (bibtex-cfield "abstract" bibtex-field-text) pnt t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2817 (error "No abstract in entry."))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2818 (ispell-region (match-beginning bibtex-text-in-cfield) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2819 (match-end bibtex-text-in-cfield))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2820 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2821 (defun bibtex-narrow-to-entry () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2822 "Narrow buffer to current BibTeX entry." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2823 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2824 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2825 (narrow-to-region |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2826 (bibtex-beginning-of-entry) (bibtex-end-of-entry)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2827 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2828 (defun bibtex-hide-entry-bodies (&optional arg) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2829 "Hide all lines between first and last BibTeX entries not beginning with @. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2830 With argument, show all text." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2831 (interactive "P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2832 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2833 (bibtex-beginning-of-first-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2834 (let ((buffer-read-only nil)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2835 (if arg |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2836 (subst-char-in-region (point) (point-max) ?\r ?\n t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2837 (while (not (eobp)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2838 (subst-char-in-region |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2839 (point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2840 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2841 (re-search-forward "[\n\r]@" nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2842 (forward-line -1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2843 (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2844 ?\n ?\r t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2845 (forward-line 1))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2846 (setq selective-display (not arg))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2847 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2848 (defun bibtex-sort-buffer () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2849 "Sort BibTeX buffer alphabetically by key. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2850 Text outside of BibTeX entries is not affected. If |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2851 bibtex-sort-ignore-string-entries is non-nil, @String entries will be |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2852 ignored." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2853 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2854 (save-restriction |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2855 (narrow-to-region |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2856 (bibtex-beginning-of-first-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2857 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2858 (goto-char (point-max)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2859 (bibtex-end-of-entry))) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
2860 (bibtex-skip-to-valid-entry) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2861 (sort-subr |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2862 nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2863 ;; NEXTREC function |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
2864 'bibtex-skip-to-valid-entry |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2865 ;; ENDREC function |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2866 'bibtex-end-of-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2867 ;; STARTKEY function |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2868 (lambda () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2869 (let ((case-fold-search t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2870 (re-search-forward bibtex-reference-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2871 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2872 (match-beginning bibtex-key-in-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2873 (match-end bibtex-key-in-head))))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2874 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2875 (defun bibtex-find-entry-location (entry-name &optional ignore-dups) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2876 "Looking for place to put the BibTeX entry named ENTRY-NAME. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2877 Performs a binary search (therefore, buffer is assumed to be in sorted |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2878 order, without duplicates (see \\[bibtex-validate]), if it is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2879 not, bibtex-find-entry-location will fail). If entry-name is already |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2880 used as a reference key, an error is signaled. However, if optional |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2881 variable IGNORE-DUPS is non-nil, no error messages about duplicate |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2882 entries are signaled, but the error handling is assumed to be made in |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2883 the calling function. Nil is returned, if an duplicate entry error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2884 occurred, and t in all other cases." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2885 (let* ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2886 (left |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2887 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2888 (bibtex-beginning-of-first-entry) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
2889 (bibtex-skip-to-valid-entry) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2890 (bibtex-end-of-entry))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2891 (right |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2892 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2893 (bibtex-beginning-of-last-entry) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
2894 (bibtex-skip-to-valid-entry t) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2895 (point))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2896 actual-point |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2897 actual-key |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2898 (done (>= left right)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2899 new |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2900 dup) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2901 (while (not done) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2902 (setq actual-point (/ (+ left right) 2)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2903 (goto-char actual-point) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
2904 (bibtex-skip-to-valid-entry t) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2905 (setq actual-key |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2906 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2907 (re-search-forward bibtex-reference-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2908 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2909 (match-beginning bibtex-key-in-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2910 (match-end bibtex-key-in-head)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2911 (cond |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2912 ((string-lessp entry-name actual-key) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2913 (setq new (bibtex-beginning-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2914 (if (equal right new) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2915 (setq done t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2916 (setq right new))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2917 ((string-lessp actual-key entry-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2918 (setq new (bibtex-end-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2919 (if (equal left new) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2920 (setq done t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2921 (setq left new))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2922 ((string-equal actual-key entry-name) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2923 (setq dup t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2924 done t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2925 (if (not ignore-dups) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2926 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2927 (bibtex-beginning-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2928 (error "Entry with key `%s' already exists." entry-name)))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2929 (if dup |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2930 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2931 (bibtex-beginning-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2932 nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2933 (goto-char right) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2934 (setq actual-key |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2935 (if (looking-at bibtex-reference-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2936 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2937 (match-beginning bibtex-key-in-reference) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2938 (match-end bibtex-key-in-reference)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2939 (if (or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2940 (not actual-key) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2941 (string-lessp actual-key entry-name)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2942 ;; buffer contains no valid entries or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2943 ;; greater than last entry --> append |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2944 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2945 (bibtex-end-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2946 (if (not (bobp)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2947 (newline (forward-line 2))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2948 (beginning-of-line)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2949 (goto-char right)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2950 t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2951 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2952 (defun bibtex-validate (&optional test-thoroughly) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2953 "Validate if buffer or region is syntactically correct. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2954 Only known reference types are checked, so you can put comments |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2955 outside of entries. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2956 With optional argument TEST-THOROUGHLY non-nil it checks for absence of |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2957 required fields and questionable month fields as well. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2958 If mark is active, it validates current region, if not whole buffer. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2959 Returns t if test was successful, nil otherwise." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2960 (interactive "P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2961 (let (error-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2962 syntax-error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2963 (case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2964 (valid-bibtex-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2965 (concat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2966 "@[ \t]*\\(\\(string\\)\\|" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2967 (mapconcat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2968 (lambda (type) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2969 (concat "\\(" (car type) "\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2970 bibtex-entry-field-alist |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2971 "\\|") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2972 "\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2973 (pnt (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2974 (start-point |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2975 (if mark-active |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2976 (region-beginning) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2977 (bibtex-beginning-of-first-entry))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2978 (end-point |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2979 (if mark-active |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2980 (region-end) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2981 (point-max)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2982 (save-restriction |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2983 (narrow-to-region start-point end-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2984 ;; looking if entries fit syntactical structure |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2985 (goto-char start-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2986 (bibtex-progress-message "Checking syntactical structure") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2987 (while (re-search-forward "^[ \t]*@" nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2988 (bibtex-progress-message) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2989 (forward-char -1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2990 (let ((p (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2991 (must-match |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2992 (looking-at valid-bibtex-entry))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2993 (if (not must-match) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2994 (forward-char) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2995 (let (bibtex-sort-ignore-string-entries) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
2996 (bibtex-skip-to-valid-entry)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2997 (if (equal (point) p) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2998 (forward-char) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2999 (goto-char p) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3000 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3001 error-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3002 (cons (list |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3003 (bibtex-current-line) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3004 "Syntax error (check esp. commas, braces, and quotes)") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3005 error-list)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3006 (forward-char))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3007 (bibtex-progress-message 'done) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3008 (if error-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3009 (setq syntax-error t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3010 ;; looking for correct sort order and duplicates (only if |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3011 ;; there were no syntax errors) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3012 (if bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3013 (let (previous) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3014 (goto-char start-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3015 (bibtex-progress-message "Checking correct sort order") |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3016 (bibtex-map-entries |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3017 (lambda (current) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3018 (bibtex-progress-message) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3019 (cond ((or (not previous) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3020 (string< previous current)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3021 (setq previous current)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3022 ((string-equal previous current) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3023 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3024 error-list |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3025 (cons (list (bibtex-current-line) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3026 "Duplicate key with previous") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3027 error-list))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3028 (t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3029 (setq previous current |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3030 error-list |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3031 (cons (list (bibtex-current-line) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3032 "Entries out of order") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3033 error-list)))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3034 (bibtex-progress-message 'done))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3035 (if test-thoroughly |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3036 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3037 (goto-char start-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3038 (bibtex-progress-message |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3039 "Checking required fields and month fields") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3040 (let ((bibtex-sort-ignore-string-entries t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3041 (questionable-month |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3042 (concat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3043 "[{\"]\\(" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3044 (mapconcat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3045 (lambda (mon) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3046 (concat "\\(" (car mon) "\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3047 bibtex-predefined-month-strings |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3048 "\\|") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3049 "\\)[}\"]"))) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3050 (bibtex-map-entries |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3051 (lambda (current) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3052 (bibtex-progress-message) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3053 (let* ((beg (bibtex-beginning-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3054 (end (bibtex-end-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3055 (entry-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3056 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3057 (goto-char beg) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3058 (bibtex-search-reference nil end) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3059 (assoc-ignore-case |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3060 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3061 (1+ (match-beginning bibtex-type-in-head)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3062 (match-end bibtex-type-in-head)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3063 bibtex-entry-field-alist))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3064 (req (copy-sequence (elt (elt entry-list 1) 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3065 (creq (copy-sequence (elt (elt entry-list 2) 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3066 crossref-there) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3067 (goto-char beg) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3068 (while (re-search-forward bibtex-field end t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3069 (let ((field-name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3070 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3071 (match-beginning bibtex-name-in-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3072 (match-end bibtex-name-in-field)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3073 (if (and (equal (downcase field-name) "month") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3074 (string-match |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3075 questionable-month |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3076 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3077 (match-beginning bibtex-text-in-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3078 (match-end bibtex-text-in-field)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3079 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3080 error-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3081 (cons |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3082 (list |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3083 (bibtex-current-line) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3084 "Questionable month field (delimited string)") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3085 error-list))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3086 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3087 req |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3088 (delete (assoc-ignore-case field-name req) req) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3089 creq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3090 (delete (assoc-ignore-case field-name creq) creq)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3091 (if (equal (downcase field-name) "crossref") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3092 (setq crossref-there t)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3093 (if crossref-there |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3094 (setq req creq)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3095 (if (or (> (length req) 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3096 (and (= (length req) 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3097 (not (elt (car req) 3)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3098 ;; two (or more) fields missed or one field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3099 ;; missed and this isn't flagged alternative |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3100 ;; (notice that this fails if there are more |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3101 ;; than two alternatives in a BibTeX entry, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3102 ;; which isn't the case momentarily) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3103 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3104 error-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3105 (cons |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3106 (list (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3107 (bibtex-beginning-of-entry) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3108 (bibtex-current-line)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3109 (concat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3110 "Required field \"" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3111 (car (car req)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3112 "\" missing")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3113 error-list))))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3114 (bibtex-progress-message 'done))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3115 (goto-char pnt) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3116 (if error-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3117 (let ((bufnam (buffer-name)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3118 (dir default-directory)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3119 (setq error-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3120 (sort error-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3121 (lambda (a b) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3122 (< (car a) (car b))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3123 (let ((pop-up-windows t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3124 (pop-to-buffer nil t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3125 (switch-to-buffer |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3126 (get-buffer-create "*BibTeX validation errors*") t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3127 ;; don't use switch-to-buffer-other-window, since this |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3128 ;; doesn't allow the second parameter NORECORD |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3129 (setq default-directory dir) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3130 (toggle-read-only -1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3131 (compilation-mode) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3132 (delete-region (point-min) (point-max)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3133 (goto-char (point-min)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3134 (insert |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3135 "BibTeX mode command `bibtex-validate'\n" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3136 (if syntax-error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3137 "Maybe undetected errors due to syntax errors. Correct and validate again." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3138 "") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3139 "\n") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3140 (while error-list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3141 (insert |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3142 bufnam ":" (number-to-string (elt (car error-list) 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3143 ": " (elt (car error-list) 1) "\n") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3144 (setq error-list (cdr error-list))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3145 (compilation-parse-errors nil nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3146 (setq compilation-old-error-list compilation-error-list) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3147 ;; this is necessary to avoid reparsing of buffer if you |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3148 ;; switch to compilation buffer and enter |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3149 ;; `compile-goto-error' |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3150 (set-buffer-modified-p nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3151 (toggle-read-only 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3152 (goto-char (point-min)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3153 (other-window -1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3154 ;; return nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3155 nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3156 (if mark-active |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3157 (message "Region is syntactically correct") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3158 (message "Buffer is syntactically correct")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3159 t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3160 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3161 (defun bibtex-next-field (arg) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3162 "Finds end of text of next BibTeX field; with arg, to its beginning." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3163 (interactive "P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3164 (bibtex-inside-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3165 (let ((start (point))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3166 (condition-case () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3167 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3168 (bibtex-enclosing-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3169 (goto-char (match-end 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3170 (forward-char 2)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3171 (error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3172 (goto-char start) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3173 (end-of-line) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3174 (forward-char)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3175 (bibtex-find-text arg t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3176 |
18502
708870732e5d
(bibtex-kill-field, bibtex-find-text): Killing a field moves to the next line.
Richard M. Stallman <rms@gnu.org>
parents:
18248
diff
changeset
|
3177 (defun bibtex-find-text (arg &optional as-if-interactive silent) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3178 "Go to end of text of current field; with ARG, go to beginning." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3179 (interactive "P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3180 (bibtex-inside-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3181 (if (bibtex-enclosing-field (or (interactive-p) as-if-interactive)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3182 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3183 (if arg |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3184 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3185 (goto-char (match-beginning bibtex-text-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3186 (if (looking-at "[{\"]") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3187 (forward-char))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3188 (goto-char (match-end bibtex-text-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3189 (if (or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3190 (= (preceding-char) ?}) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3191 (= (preceding-char) ?\")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3192 (forward-char -1))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3193 (if bibtex-help-message |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3194 (bibtex-print-help-message))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3195 (beginning-of-line) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3196 (cond |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3197 ((looking-at bibtex-string) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3198 (goto-char |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3199 (if arg |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3200 (match-beginning bibtex-text-in-string) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3201 (match-end bibtex-text-in-string)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3202 ((looking-at bibtex-reference-maybe-empty-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3203 (goto-char |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3204 (if arg |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3205 (match-beginning bibtex-key-in-head) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3206 (match-end 0)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3207 (t |
18502
708870732e5d
(bibtex-kill-field, bibtex-find-text): Killing a field moves to the next line.
Richard M. Stallman <rms@gnu.org>
parents:
18248
diff
changeset
|
3208 (if (not silent) |
708870732e5d
(bibtex-kill-field, bibtex-find-text): Killing a field moves to the next line.
Richard M. Stallman <rms@gnu.org>
parents:
18248
diff
changeset
|
3209 (error "Not on BibTeX field.")))))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3210 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3211 (defun bibtex-remove-OPT-or-ALT () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3212 "Removes the string starting optional/alternative fields. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3213 Aligns text and goes thereafter to end of text." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3214 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3215 (let ((case-fold-search t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3216 (bibtex-inside-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3217 (bibtex-enclosing-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3218 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3219 (goto-char (match-beginning bibtex-name-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3220 (if (looking-at "OPT\\|ALT") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3221 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3222 (delete-char (length "OPT")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3223 ;; make field non-OPT |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3224 (search-forward "=") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3225 (forward-char -1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3226 (delete-horizontal-space) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3227 (if bibtex-align-at-equal-sign |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3228 (indent-to-column (- bibtex-text-indentation 2)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3229 (insert " ")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3230 (search-forward "=") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3231 (delete-horizontal-space) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3232 (if bibtex-align-at-equal-sign |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3233 (insert " ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3234 (indent-to-column bibtex-text-indentation))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3235 (bibtex-inside-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3236 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3237 (defun bibtex-remove-delimiters () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3238 "Removes \"\" or {} around string." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3239 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3240 (let ((case-fold-search t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3241 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3242 (bibtex-inside-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3243 (bibtex-enclosing-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3244 (let ((start (match-beginning bibtex-text-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3245 (stop (match-end bibtex-text-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3246 (goto-char start) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3247 (while (re-search-forward bibtex-field-string stop t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3248 (let ((beg (copy-marker (match-beginning 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3249 (end (copy-marker (match-end 0)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3250 (goto-char beg) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3251 (if (looking-at "[{\"]") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3252 (delete-char 1)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3253 (goto-char end) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3254 (forward-char -1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3255 (if (looking-at "[}\"]") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3256 (delete-char 1)))))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3257 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3258 (defun bibtex-kill-field (&optional copy-only) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3259 "Kills the entire enclosing BibTeX field. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3260 With prefix arg copy the current field to bibtex-field-kill-ring, but |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3261 do not actually kill it." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3262 (interactive "P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3263 (let ((pnt (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3264 (case-fold-search t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3265 (bibtex-inside-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3266 (bibtex-enclosing-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3267 (let ((the-end (match-end 0)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3268 (the-beginning (match-beginning 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3269 (goto-char the-end) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3270 (skip-chars-forward " \t\n,") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3271 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3272 bibtex-field-kill-ring |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3273 (cons |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3274 (list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3275 'field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3276 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3277 (match-beginning bibtex-name-in-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3278 (match-end bibtex-name-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3279 (buffer-substring-no-properties |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3280 (match-beginning bibtex-text-in-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3281 (match-end bibtex-text-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3282 bibtex-field-kill-ring)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3283 (if (> (length bibtex-field-kill-ring) bibtex-field-kill-ring-max) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3284 (setcdr |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3285 (nthcdr (1- bibtex-field-kill-ring-max) bibtex-field-kill-ring) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3286 nil)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3287 (setq bibtex-field-kill-ring-yank-pointer bibtex-field-kill-ring) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3288 (if copy-only |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3289 (goto-char pnt) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3290 (delete-region the-beginning the-end) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3291 (let (bibtex-help-message) |
18502
708870732e5d
(bibtex-kill-field, bibtex-find-text): Killing a field moves to the next line.
Richard M. Stallman <rms@gnu.org>
parents:
18248
diff
changeset
|
3292 (bibtex-find-text nil t t))))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3293 (setq bibtex-last-kill-command 'field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3294 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3295 (defun bibtex-copy-field-as-kill () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3296 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3297 (bibtex-kill-field t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3298 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3299 (defun bibtex-kill-entry (&optional copy-only) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3300 "Kills the entire enclosing BibTeX reference entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3301 With prefix arg copy the current reference entry to |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3302 bibtex-entry-kill-ring, but do not actually kill it." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3303 (interactive "P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3304 (let ((pnt (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3305 (case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3306 (beg (bibtex-beginning-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3307 (end |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3308 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3309 (bibtex-end-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3310 (if (re-search-forward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3311 bibtex-reference-maybe-empty-head nil 'move) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3312 (goto-char (match-beginning 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3313 (point)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3314 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3315 bibtex-entry-kill-ring |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3316 (cons |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3317 (list 'entry (buffer-substring-no-properties beg end)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3318 bibtex-entry-kill-ring)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3319 (if (> (length bibtex-entry-kill-ring) bibtex-entry-kill-ring-max) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3320 (setcdr |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3321 (nthcdr (1- bibtex-entry-kill-ring-max) bibtex-entry-kill-ring) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3322 nil)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3323 (setq bibtex-entry-kill-ring-yank-pointer bibtex-entry-kill-ring) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3324 (if copy-only |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3325 (goto-char pnt) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3326 (delete-region beg end))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3327 (setq bibtex-last-kill-command 'entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3328 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3329 (defun bibtex-copy-entry-as-kill () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3330 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3331 (bibtex-kill-entry t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3332 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3333 (defun bibtex-yank (&optional n) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3334 "Reinsert the last BibTeX item. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3335 More precisely, reinsert the field or entry killed or yanked most recently. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3336 With argument N, reinsert the Nth most recently killed BibTeX item. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3337 See also the command \\[bibtex-yank-pop]]." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3338 (interactive "*p") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3339 (bibtex-insert-current-kill (1- n)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3340 (setq this-command 'bibtex-yank)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3341 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3342 (defun bibtex-yank-pop (n) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3343 "Replace just-yanked killed BibTeX item with a different. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3344 This command is allowed only immediately after a `bibtex-yank' or a |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3345 `bibtex-yank-pop'. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3346 At such a time, the region contains a reinserted previously killed |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3347 BibTeX item. `bibtex-yank-pop' deletes that item and inserts in its |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3348 place a different killed BibTeX item. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3349 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3350 With no argument, the previous kill is inserted. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3351 With argument N, insert the Nth previous kill. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3352 If N is negative, this is a more recent kill. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3353 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3354 The sequence of kills wraps around, so that after the oldest one |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3355 comes the newest one." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3356 (interactive "*p") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3357 (if (not (eq last-command 'bibtex-yank)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3358 (error "Previous command was not a BibTeX yank")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3359 (setq this-command 'bibtex-yank) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3360 (let ((inhibit-read-only t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3361 (delete-region (point) (mark t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3362 (bibtex-insert-current-kill n))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3363 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3364 (defun bibtex-empty-field () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3365 "Delete the text part of the current field, replace with empty text." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3366 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3367 (bibtex-inside-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3368 (bibtex-enclosing-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3369 (goto-char (match-beginning bibtex-text-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3370 (delete-region (point) (match-end bibtex-text-in-field)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3371 (insert (concat (bibtex-field-left-delimiter) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3372 (bibtex-field-right-delimiter)) ) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3373 (bibtex-find-text t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3374 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3375 (defun bibtex-pop-previous (arg) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3376 "Replace text of current field with the text of similar field in previous entry. |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3377 With arg, goes up ARG entries. Repeated, goes up so many times. May be |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3378 intermixed with \\[bibtex-pop-next] (bibtex-pop-next)." |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3379 (interactive "p") |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3380 (bibtex-pop arg 'previous)) |
257 | 3381 |
3382 (defun bibtex-pop-next (arg) | |
3383 "Replace text of current field with the text of similar field in next entry. | |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3384 With arg, goes down ARG entries. Repeated, goes down so many times. May be |
257 | 3385 intermixed with \\[bibtex-pop-previous] (bibtex-pop-previous)." |
3386 (interactive "p") | |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3387 (bibtex-pop arg 'next)) |
257 | 3388 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3389 (defun bibtex-clean-entry (&optional new-label called-by-reformat) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3390 "Finish editing the current BibTeX entry and clean it up. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3391 Checks that no required fields are empty and formats entry dependent |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3392 on the value of bibtex-entry-format. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3393 If label of entry is empty or a prefix argument is given, calculate a |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3394 new entry label (note: this only will work if fields in entry begin on |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3395 separate lines prior to calling bibtex-clean-entry or if 'realign is |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3396 contained in bibtex-entry-format). |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3397 Don't call this on `string' or `preamble' entries. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3398 At end of the cleaning process, the functions in |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3399 bibtex-clean-entry-hook are called with region narrowed to entry." |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3400 (interactive "P") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3401 (bibtex-format-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3402 (let* ((case-fold-search t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3403 (eob (bibtex-end-of-entry)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3404 (key (progn |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3405 (bibtex-beginning-of-entry) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3406 (if (re-search-forward |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3407 bibtex-reference-head eob t) |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
3408 (buffer-substring-no-properties |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3409 (match-beginning bibtex-key-in-head) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3410 (match-end bibtex-key-in-head)))))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3411 (if (or |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3412 new-label |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3413 (not key)) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3414 (progn |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3415 (let ((autokey |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3416 (if bibtex-autokey-edit-before-use |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3417 (read-from-minibuffer |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3418 "Key to use: " (bibtex-generate-autokey) nil nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3419 'bibtex-key-history) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3420 (bibtex-generate-autokey)))) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3421 (bibtex-beginning-of-entry) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3422 (re-search-forward bibtex-reference-maybe-empty-head) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3423 (if (match-beginning bibtex-key-in-head) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3424 (delete-region (match-beginning bibtex-key-in-head) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3425 (match-end bibtex-key-in-head))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3426 (insert autokey) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3427 (let* ((start (bibtex-beginning-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3428 (end (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3429 (bibtex-end-of-entry) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3430 (if (re-search-forward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3431 bibtex-reference-maybe-empty-head nil 'move) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3432 (goto-char (match-beginning 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3433 (point))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3434 (entry (buffer-substring start end))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3435 (delete-region start end) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3436 (let ((success |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3437 (or |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3438 called-by-reformat |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3439 (not bibtex-maintain-sorted-entries) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3440 (bibtex-find-entry-location autokey t)))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3441 (insert entry) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3442 (forward-char -1) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3443 (bibtex-beginning-of-entry) |
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
3444 (re-search-forward bibtex-reference-head) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3445 (if (not success) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3446 (error |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3447 "New inserted reference yields duplicate key.")))))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3448 (if (not called-by-reformat) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3449 (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3450 (save-restriction |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3451 (narrow-to-region |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3452 (bibtex-beginning-of-entry) (bibtex-end-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3453 (bibtex-parse-keys t nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3454 (run-hooks 'bibtex-clean-entry-hook))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3455 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3456 (defun bibtex-fill-entry () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3457 "Fill current entry. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3458 Realigns entry, so that every field starts on a separate line. Field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3459 names appear in column bibtex-field-indentation, field text starts in |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3460 column bibtex-text-indentation and continuation lines start here, too. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3461 If bibtex-align-at-equal-sign is non-nil, equal signs are aligned as |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3462 well." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3463 (interactive "*") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3464 (let ((pnt (copy-marker (point))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3465 (end (copy-marker (bibtex-end-of-entry)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3466 (bibtex-beginning-of-entry) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3467 (bibtex-delete-whitespace) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3468 (indent-to-column bibtex-entry-offset) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3469 (while (re-search-forward bibtex-field end t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3470 (let* ((begin-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3471 (copy-marker (match-beginning 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3472 (end-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3473 (copy-marker (match-end 0))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3474 (begin-name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3475 (copy-marker (match-beginning bibtex-name-in-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3476 (end-name |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3477 (copy-marker (match-end bibtex-name-in-field)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3478 (goto-char begin-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3479 (forward-char) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3480 (bibtex-delete-whitespace) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3481 (open-line 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3482 (forward-char) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3483 (indent-to-column |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3484 (+ bibtex-entry-offset bibtex-field-indentation)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3485 (re-search-forward "[ \t\n]*=" end) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3486 (replace-match "=") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3487 (forward-char -1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3488 (if bibtex-align-at-equal-sign |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3489 (indent-to-column |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3490 (+ bibtex-entry-offset (- bibtex-text-indentation 2))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3491 (insert " ")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3492 (forward-char) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3493 (bibtex-delete-whitespace) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3494 (if bibtex-align-at-equal-sign |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3495 (insert " ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3496 (indent-to-column bibtex-text-indentation)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3497 (while (re-search-forward "[ \t\n]+" end-field 'move) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3498 (replace-match " ")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3499 (bibtex-do-auto-fill))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3500 (if (looking-at ",") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3501 (forward-char)) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3502 (bibtex-delete-whitespace) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3503 (open-line 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3504 (forward-char) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3505 (indent-to-column bibtex-entry-offset) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3506 (goto-char pnt))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3507 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3508 (defun bibtex-reformat (&optional additional-options called-by-convert-alien) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3509 "Reformats entries in buffer or region. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3510 Refills all entries. With prefix argument, read options for |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3511 reformatting entries from minibuffer. With double prefix argument, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3512 reuse previous answers (if any) again. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3513 If mark is active it reformats entries in region, if not in whole buffer." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3514 (interactive "*P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3515 (let* ((pnt (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3516 (use-previous-options |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3517 (and (equal (prefix-numeric-value additional-options) 16) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3518 (or bibtex-reformat-previous-options |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3519 bibtex-reformat-previous-labels))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3520 (bibtex-entry-format |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3521 (if additional-options |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3522 (if use-previous-options |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3523 bibtex-reformat-previous-options |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3524 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3525 bibtex-reformat-previous-options |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3526 (delq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3527 nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3528 (list |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3529 (if (or |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3530 called-by-convert-alien |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3531 (y-or-n-p |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3532 "Realign entries (recommended for files not created by BibTeX mode)? ")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3533 'realign) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3534 (if (y-or-n-p |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3535 "Remove empty optional and alternative fields? ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3536 'opts-or-alts) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3537 (if (y-or-n-p |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3538 "Remove delimiters around pure numerical fields? ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3539 'numerical-fields) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3540 (if (y-or-n-p (concat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3541 (if bibtex-comma-after-last-field |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3542 "Insert" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3543 "Remove") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3544 " comma at end of entry? ")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3545 'last-comma) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3546 (if (y-or-n-p |
18502
708870732e5d
(bibtex-kill-field, bibtex-find-text): Killing a field moves to the next line.
Richard M. Stallman <rms@gnu.org>
parents:
18248
diff
changeset
|
3547 "Replace double page dashes by single ones? ") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3548 'page-dashes) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3549 (if (y-or-n-p |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3550 "Force delimiters? ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3551 'delimiters) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3552 (if (y-or-n-p |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3553 "Unify case of entry types and field names? ") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3554 'unify-case))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3555 '(realign))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3556 (labels |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3557 (if additional-options |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3558 (if use-previous-options |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3559 bibtex-reformat-previous-labels |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3560 (setq |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3561 bibtex-reformat-previous-labels |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3562 (y-or-n-p "Generate automatically new reference labels? "))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3563 bibtex-autokey-edit-before-use |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3564 (bibtex-sort-ignore-string-entries t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3565 (start-point |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3566 (if mark-active |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3567 (region-beginning) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3568 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3569 (bibtex-beginning-of-first-entry) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3570 (bibtex-skip-to-valid-entry) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3571 (point)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3572 (end-point |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3573 (if mark-active |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3574 (region-end) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3575 (point-max))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3576 (valid-bibtex-entry |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3577 (concat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3578 "[ \t\n]+\\(@[ \t]*\\(" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3579 (mapconcat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3580 (lambda (type) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3581 (concat "\\(" (car type) "\\)")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3582 bibtex-entry-field-alist |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3583 "\\|") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3584 "\\)\\)"))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3585 (save-restriction |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3586 (narrow-to-region start-point end-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3587 (if (memq 'realign bibtex-entry-format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3588 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3589 (goto-char (point-min)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3590 (while (re-search-forward valid-bibtex-entry nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3591 (replace-match "\n\\1")))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3592 (goto-char start-point) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3593 (bibtex-progress-message "Formatting" 1) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3594 (bibtex-map-entries |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3595 (lambda (current) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3596 (bibtex-progress-message) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3597 (bibtex-clean-entry labels labels) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3598 (if (memq 'realign bibtex-entry-format) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3599 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3600 (bibtex-end-of-entry) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3601 (bibtex-delete-whitespace) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3602 (open-line 2))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3603 (bibtex-progress-message 'done)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3604 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3605 labels |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3606 bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3607 (not called-by-convert-alien)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3608 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3609 (bibtex-sort-buffer) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3610 (setq bibtex-keys nil) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3611 (bibtex-parse-keys nil t t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3612 (goto-char pnt))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3613 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3614 (defun bibtex-convert-alien (&optional do-additional-reformatting) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3615 "Converts an alien BibTeX buffer to be fully usable by BibTeX mode. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3616 If a file doesn't confirm with some standards used by BibTeX mode, |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3617 some of the high-level features of BibTeX mode won't be available. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3618 This function tries to convert current buffer to confirm with these |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3619 standards. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3620 With prefix argument DO-ADDITIONAL-REFORMATTING |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3621 non-nil, read options for reformatting entries from minibuffer." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3622 (interactive "*P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3623 (message "Starting to validate buffer...") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3624 (sit-for 1 nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3625 (goto-char (point-min)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3626 (while (re-search-forward "[ \t\n]+@" nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3627 (replace-match "\n@")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3628 (message |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3629 "If errors occur, correct them and call `bibtex-convert-alien' again") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3630 (sit-for 5 nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3631 (if (let (mark-active |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3632 bibtex-maintain-sorted-entries) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3633 (bibtex-validate)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3634 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3635 (message "Starting to reformat entries...") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3636 (sit-for 2 nil t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3637 (bibtex-reformat do-additional-reformatting t) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3638 (if bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3639 (progn |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3640 (message "Starting to sort buffer...") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3641 (bibtex-sort-buffer))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3642 (goto-char (point-max)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3643 (message "Buffer is now parsable. Please save it.")))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3644 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3645 (defun bibtex-complete-string () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3646 "Complete word fragment before point to longest prefix of a defined string. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3647 If point is not after the part of a word, all strings are listed. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3648 Remove surrounding delimiters if complete string could be expanded." |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3649 (interactive "*") |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3650 (bibtex-complete bibtex-strings t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3651 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3652 (defun bibtex-complete-key () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3653 "Complete word fragment before point to longest prefix of a defined key. |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3654 If point is not after the part of a word, all keys are listed. This |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3655 function is most useful in completing crossref entries." |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3656 (interactive "*") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3657 (if (not bibtex-keys) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3658 (bibtex-parse-keys nil t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3659 (bibtex-complete bibtex-keys)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3660 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3661 (defun bibtex-Article () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3662 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3663 (bibtex-entry "Article")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3664 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3665 (defun bibtex-Book () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3666 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3667 (bibtex-entry "Book")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3668 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3669 (defun bibtex-Booklet () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3670 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3671 (bibtex-entry "Booklet")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3672 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3673 (defun bibtex-InBook () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3674 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3675 (bibtex-entry "InBook")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3676 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3677 (defun bibtex-InCollection () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3678 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3679 (bibtex-entry "InCollection")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3680 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3681 (defun bibtex-InProceedings () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3682 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3683 (bibtex-entry "InProceedings")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3684 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3685 (defun bibtex-Manual () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3686 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3687 (bibtex-entry "Manual")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3688 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3689 (defun bibtex-MastersThesis () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3690 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3691 (bibtex-entry "MastersThesis")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3692 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3693 (defun bibtex-Misc () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3694 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3695 (bibtex-entry "Misc")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3696 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3697 (defun bibtex-PhdThesis () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3698 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3699 (bibtex-entry "PhdThesis")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3700 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3701 (defun bibtex-Proceedings () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3702 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3703 (bibtex-entry "Proceedings")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3704 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3705 (defun bibtex-TechReport () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3706 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3707 (bibtex-entry "TechReport")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3708 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3709 (defun bibtex-Unpublished () |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3710 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3711 (bibtex-entry "Unpublished")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3712 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3713 (defun bibtex-String () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3714 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3715 (if (not bibtex-keys) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3716 (bibtex-parse-keys nil t)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3717 (let ((key |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3718 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3719 bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3720 (not bibtex-sort-ignore-string-entries)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3721 (completing-read |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3722 "String key: " bibtex-keys nil nil nil 'bibtex-key-history)))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3723 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3724 bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3725 (not bibtex-sort-ignore-string-entries)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3726 (bibtex-find-entry-location key) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3727 (bibtex-move-outside-of-entry)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3728 (indent-to-column bibtex-entry-offset) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3729 (insert |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3730 (concat |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3731 "@String" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3732 (bibtex-entry-left-delimiter) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3733 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3734 bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3735 (not bibtex-sort-ignore-string-entries)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3736 key) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3737 " = " |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3738 (bibtex-field-left-delimiter) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3739 (bibtex-field-right-delimiter) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3740 (bibtex-entry-right-delimiter) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3741 "\n")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3742 (forward-line -1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3743 (forward-char |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3744 (if (and |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3745 bibtex-maintain-sorted-entries |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3746 (not bibtex-sort-ignore-string-entries)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3747 (+ (length "@String{") (length key) (length " = {")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3748 (length "@String{"))))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3749 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3750 (defun bibtex-Preamble () |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3751 (interactive) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3752 (bibtex-move-outside-of-entry) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3753 (indent-to-column bibtex-entry-offset) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3754 (insert |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3755 "@Preamble" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3756 (bibtex-entry-left-delimiter) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3757 (bibtex-entry-right-delimiter) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3758 "\n") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3759 (forward-line -1) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3760 (forward-char 10)) |
257 | 3761 |
3762 | |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
3763 ;; Make BibTeX a Feature |
257 | 3764 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3765 (provide 'bibtex) |
2602
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
3766 |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
3767 ;;; bibtex.el ends here |