Mercurial > emacs
annotate lisp/textmodes/bibtex.el @ 59774:a8e1cfe86c9b
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 29 Jan 2005 15:52:07 +0000 |
parents | 96d73eb02751 |
children | d11749d2bcff f8a7a9ba3d08 |
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 |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
3 ;; Copyright (C) 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2004 |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
845 | 5 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
6 ;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de> |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
7 ;; Bengt Martensson <bengt@mathematik.uni-Bremen.de> |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
8 ;; Mark Shapiro <shapiro@corto.inria.fr> |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
9 ;; Mike Newton <newton@gumby.cs.caltech.edu> |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
10 ;; Aaron Larson <alarson@src.honeywell.com> |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
11 ;; Dirk Herrmann <D.Herrmann@tu-bs.de> |
45849 | 12 ;; Maintainer: Roland Winkler <roland.winkler@physik.uni-erlangen.de> |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
13 ;; Keywords: BibTeX, LaTeX, TeX |
810
80303373daae
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
14 |
257 | 15 ;; This file is part of GNU Emacs. |
16 | |
17 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
18 ;; it under the terms of the GNU General Public License as published by | |
1851 | 19 ;; the Free Software Foundation; either version 2, or (at your option) |
257 | 20 ;; any later version. |
21 | |
22 ;; GNU Emacs is distributed in the hope that it will be useful, | |
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 ;; GNU General Public License for more details. | |
26 | |
27 ;; You should have received a copy of the GNU General Public License | |
14169 | 28 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
29 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
30 ;; Boston, MA 02111-1307, USA. | |
257 | 31 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
32 ;;; Commentary: |
14169 | 33 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
34 ;; Major mode for editing and validating BibTeX files. |
257 | 35 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
36 ;; Usage: |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
37 ;; See documentation for function bibtex-mode or type "\M-x describe-mode" |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
38 ;; 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
|
39 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
40 ;; Todo: |
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
41 ;; Distribute texinfo file. |
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 ;;; Code: |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
44 |
57815 | 45 (require 'button) |
46 | |
26711
eac840d283b6
(bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents:
25444
diff
changeset
|
47 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
48 ;; User Options: |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
49 |
19460 | 50 (defgroup bibtex nil |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
51 "BibTeX mode" |
19460 | 52 :group 'tex |
53 :prefix "bibtex-") | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
54 |
19460 | 55 (defgroup bibtex-autokey nil |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
56 "Generate automatically a key from the author/editor and the title field" |
19460 | 57 :group 'bibtex |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
58 :prefix "bibtex-autokey-") |
19460 | 59 |
60 (defcustom bibtex-mode-hook nil | |
61 "List of functions to call on entry to BibTeX mode." | |
62 :group 'bibtex | |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
63 :type 'hook) |
19460 | 64 |
65 (defcustom bibtex-field-delimiters 'braces | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
66 "Type of field delimiters. Allowed values are `braces' or `double-quotes'." |
19460 | 67 :group 'bibtex |
68 :type '(choice (const braces) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
69 (const double-quotes))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
70 |
19460 | 71 (defcustom bibtex-entry-delimiters 'braces |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
72 "Type of entry delimiters. Allowed values are `braces' or `parentheses'." |
19460 | 73 :group 'bibtex |
74 :type '(choice (const braces) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
75 (const parentheses))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
76 |
19460 | 77 (defcustom bibtex-include-OPTcrossref '("InProceedings" "InCollection") |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
78 "List of BibTeX entries that get an OPTcrossref field." |
19460 | 79 :group 'bibtex |
80 :type '(repeat string)) | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
81 |
19460 | 82 (defcustom bibtex-include-OPTkey t |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
83 "If non-nil, all newly created entries get an OPTkey field. |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
84 If this is a string, use it as the initial field text. |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
85 If this is a function, call it to generate the initial field text." |
19460 | 86 :group 'bibtex |
87 :type '(choice (const :tag "None" nil) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
88 (string :tag "Initial text") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
89 (function :tag "Initialize Function" :value fun) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
90 (other :tag "Default" t))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
91 |
19460 | 92 (defcustom bibtex-user-optional-fields |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
93 '(("annote" "Personal annotation (ignored)")) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
94 "List of optional fields the user wants to have always present. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
95 Entries should be of the same form as the OPTIONAL and |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
96 CROSSREF-OPTIONAL lists in `bibtex-entry-field-alist' (which see)." |
19460 | 97 :group 'bibtex |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
98 :type '(repeat (group (string :tag "Field") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
99 (string :tag "Comment") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
100 (option (group :inline t |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
101 :extra-offset -4 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
102 (choice :tag "Init" :value "" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
103 string |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
104 function)))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
105 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
106 (defcustom bibtex-entry-format |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
107 '(opts-or-alts required-fields numerical-fields) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
108 "Type of formatting performed by `bibtex-clean-entry'. |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
109 It may be t, nil, or a list of symbols out of the following: |
19461 | 110 opts-or-alts Delete empty optional and alternative fields and |
111 remove OPT and ALT prefixes from used fields. | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
112 required-fields Signal an error if a required field is missing. |
19461 | 113 numerical-fields Delete delimiters around numeral fields. |
114 page-dashes Change double dashes in page field to single dash | |
115 (for scribe compatibility). | |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
116 inherit-booktitle If entry contains a crossref field and the booktitle |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
117 field is empty, set the booktitle field to the content |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
118 of the title field of the crossreferenced entry. |
19461 | 119 realign Realign entries, so that field texts and perhaps equal |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
120 signs (depending on the value of |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
121 `bibtex-align-at-equal-sign') begin in the same column. |
19461 | 122 last-comma Add or delete comma on end of last field in entry, |
123 according to value of `bibtex-comma-after-last-field'. | |
124 delimiters Change delimiters according to variables | |
125 `bibtex-field-delimiters' and `bibtex-entry-delimiters'. | |
126 unify-case Change case of entry and field names. | |
127 | |
128 The value t means do all of the above formatting actions. | |
129 The value nil means do no formatting at all." | |
19460 | 130 :group 'bibtex |
131 :type '(choice (const :tag "None" nil) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
132 (const :tag "All" t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
133 (set :menu-tag "Some" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
134 (const opts-or-alts) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
135 (const required-fields) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
136 (const numerical-fields) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
137 (const page-dashes) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
138 (const inherit-booktitle) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
139 (const realign) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
140 (const last-comma) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
141 (const delimiters) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
142 (const unify-case)))) |
257 | 143 |
19460 | 144 (defcustom bibtex-clean-entry-hook nil |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
145 "List of functions to call when entry has been cleaned. |
19461 | 146 Functions are called with point inside the cleaned entry, and the buffer |
19460 | 147 narrowed to just the entry." |
148 :group 'bibtex | |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
149 :type 'hook) |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
150 |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
151 (defcustom bibtex-maintain-sorted-entries nil |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
152 "If non-nil, BibTeX mode maintains all entries in sorted order. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
153 Allowed non-nil values are: |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
154 plain All entries are sorted alphabetically. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
155 crossref All entries are sorted alphabetically unless an entry has a |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
156 crossref field. These crossrefed entries are placed in |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
157 alphabetical order immediately preceding the main entry. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
158 entry-class The entries are divided into classes according to their |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
159 entry name, see `bibtex-sort-entry-class'. Within each class |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
160 the entries are sorted alphabetically. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
161 See also `bibtex-sort-ignore-string-entries'." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
162 :group 'bibtex |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
163 :type '(choice (const nil) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
164 (const plain) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
165 (const crossref) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
166 (const entry-class))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
167 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
168 (defcustom bibtex-sort-entry-class |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
169 '(("String") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
170 (catch-all) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
171 ("Book" "Proceedings")) |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
172 "List of classes of BibTeX entry names, used for sorting entries. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
173 If value of `bibtex-maintain-sorted-entries' is `entry-class' |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
174 entries are ordered according to the classes they belong to. Each |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
175 class contains a list of entry names. An entry `catch-all' applies |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
176 to all entries not explicitly mentioned." |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
177 :group 'BibTeX |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
178 :type '(repeat (choice :tag "Class" |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
179 (const :tag "catch-all" (catch-all)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
180 (repeat :tag "Entry name" string)))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
181 |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
182 (defcustom bibtex-sort-ignore-string-entries t |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
183 "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
|
184 That means they are ignored when determining ordering of the buffer |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
185 \(e.g., sorting, locating alphabetical position for new entries, etc.)." |
19460 | 186 :group 'bibtex |
187 :type 'boolean) | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
188 |
19460 | 189 (defcustom bibtex-field-kill-ring-max 20 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
190 "Max length of `bibtex-field-kill-ring' before discarding oldest elements." |
19460 | 191 :group 'bibtex |
192 :type 'integer) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
193 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
194 (defcustom bibtex-entry-kill-ring-max 20 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
195 "Max length of `bibtex-entry-kill-ring' before discarding oldest elements." |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
196 :group 'bibtex |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
197 :type 'integer) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
198 |
19460 | 199 (defcustom bibtex-parse-keys-timeout 60 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
200 "Time interval in seconds for parsing BibTeX buffers during idle time. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
201 Parsing initializes `bibtex-reference-keys' and `bibtex-strings'." |
19460 | 202 :group 'bibtex |
203 :type 'integer) | |
15637
405b1ecbf8ba
(bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents:
15565
diff
changeset
|
204 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
205 (defcustom bibtex-parse-keys-fast t |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
206 "If non-nil, use fast but simplified algorithm for parsing BibTeX keys. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
207 If parsing fails, try to set this variable to nil." |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
208 :group 'bibtex |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
209 :type 'boolean) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
210 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
211 (defvar bibtex-entry-field-alist |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
212 '(("Article" |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
213 ((("author" "Author1 [and Author2 ...] [and others]") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
214 ("title" "Title of the article (BibTeX converts it to lowercase)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
215 ("journal" "Name of the journal (use string, remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
216 ("year" "Year of publication")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
217 (("volume" "Volume of the journal") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
218 ("number" "Number of the journal (only allowed if entry contains volume)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
219 ("pages" "Pages in the journal") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
220 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
221 ("note" "Remarks to be put at the end of the \\bibitem"))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
222 ((("author" "Author1 [and Author2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
223 ("title" "Title of the article (BibTeX converts it to lowercase)")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
224 (("pages" "Pages in the journal") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
225 ("journal" "Name of the journal (use string, remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
226 ("year" "Year of publication") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
227 ("volume" "Volume of the journal") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
228 ("number" "Number of the journal") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
229 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
230 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
231 ("Book" |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
232 ((("author" "Author1 [and Author2 ...] [and others]" nil t) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
233 ("editor" "Editor1 [and Editor2 ...] [and others]" nil t) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
234 ("title" "Title of the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
235 ("publisher" "Publishing company") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
236 ("year" "Year of publication")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
237 (("volume" "Volume of the book in the series") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
238 ("number" "Number of the book in a small series (overwritten by volume)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
239 ("series" "Series in which the book appeared") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
240 ("address" "Address of the publisher") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
241 ("edition" "Edition of the book as a capitalized English word") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
242 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
243 ("note" "Remarks to be put at the end of the \\bibitem"))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
244 ((("author" "Author1 [and Author2 ...] [and others]" nil t) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
245 ("editor" "Editor1 [and Editor2 ...] [and others]" nil t) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
246 ("title" "Title of the book")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
247 (("publisher" "Publishing company") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
248 ("year" "Year of publication") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
249 ("volume" "Volume of the book in the series") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
250 ("number" "Number of the book in a small series (overwritten by volume)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
251 ("series" "Series in which the book appeared") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
252 ("address" "Address of the publisher") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
253 ("edition" "Edition of the book as a capitalized English word") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
254 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
255 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
256 ("Booklet" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
257 ((("title" "Title of the booklet (BibTeX converts it to lowercase)")) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
258 (("author" "Author1 [and Author2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
259 ("howpublished" "The way in which the booklet was published") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
260 ("address" "Address of the publisher") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
261 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
262 ("year" "Year of publication") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
263 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
264 ("InBook" |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
265 ((("author" "Author1 [and Author2 ...] [and others]" nil t) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
266 ("editor" "Editor1 [and Editor2 ...] [and others]" nil t) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
267 ("title" "Title of the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
268 ("chapter" "Chapter in the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
269 ("publisher" "Publishing company") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
270 ("year" "Year of publication")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
271 (("volume" "Volume of the book in the series") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
272 ("number" "Number of the book in a small series (overwritten by volume)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
273 ("series" "Series in which the book appeared") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
274 ("type" "Word to use instead of \"chapter\"") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
275 ("address" "Address of the publisher") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
276 ("edition" "Edition of the book as a capitalized English word") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
277 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
278 ("pages" "Pages in the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
279 ("note" "Remarks to be put at the end of the \\bibitem"))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
280 ((("author" "Author1 [and Author2 ...] [and others]" nil t) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
281 ("editor" "Editor1 [and Editor2 ...] [and others]" nil t) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
282 ("title" "Title of the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
283 ("chapter" "Chapter in the book")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
284 (("pages" "Pages in the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
285 ("publisher" "Publishing company") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
286 ("year" "Year of publication") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
287 ("volume" "Volume of the book in the series") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
288 ("number" "Number of the book in a small series (overwritten by volume)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
289 ("series" "Series in which the book appeared") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
290 ("type" "Word to use instead of \"chapter\"") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
291 ("address" "Address of the publisher") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
292 ("edition" "Edition of the book as a capitalized English word") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
293 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
294 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
295 ("InCollection" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
296 ((("author" "Author1 [and Author2 ...] [and others]") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
297 ("title" "Title of the article in book (BibTeX converts it to lowercase)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
298 ("booktitle" "Name of the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
299 ("publisher" "Publishing company") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
300 ("year" "Year of publication")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
301 (("editor" "Editor1 [and Editor2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
302 ("volume" "Volume of the book in the series") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
303 ("number" "Number of the book in a small series (overwritten by volume)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
304 ("series" "Series in which the book appeared") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
305 ("type" "Word to use instead of \"chapter\"") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
306 ("chapter" "Chapter in the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
307 ("pages" "Pages in the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
308 ("address" "Address of the publisher") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
309 ("edition" "Edition of the book as a capitalized English word") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
310 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
311 ("note" "Remarks to be put at the end of the \\bibitem"))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
312 ((("author" "Author1 [and Author2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
313 ("title" "Title of the article in book (BibTeX converts it to lowercase)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
314 ("booktitle" "Name of the book")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
315 (("pages" "Pages in the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
316 ("publisher" "Publishing company") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
317 ("year" "Year of publication") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
318 ("editor" "Editor1 [and Editor2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
319 ("volume" "Volume of the book in the series") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
320 ("number" "Number of the book in a small series (overwritten by volume)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
321 ("series" "Series in which the book appeared") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
322 ("type" "Word to use instead of \"chapter\"") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
323 ("chapter" "Chapter in the book") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
324 ("address" "Address of the publisher") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
325 ("edition" "Edition of the book as a capitalized English word") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
326 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
327 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
328 ("InProceedings" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
329 ((("author" "Author1 [and Author2 ...] [and others]") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
330 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
331 ("booktitle" "Name of the conference proceedings") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
332 ("year" "Year of publication")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
333 (("editor" "Editor1 [and Editor2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
334 ("volume" "Volume of the conference proceedings in the series") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
335 ("number" "Number of the conference proceedings in a small series (overwritten by volume)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
336 ("series" "Series in which the conference proceedings appeared") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
337 ("pages" "Pages in the conference proceedings") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
338 ("address" "Location of the Proceedings") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
339 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
340 ("organization" "Sponsoring organization of the conference") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
341 ("publisher" "Publishing company, its location") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
342 ("note" "Remarks to be put at the end of the \\bibitem"))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
343 ((("author" "Author1 [and Author2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
344 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
345 (("booktitle" "Name of the conference proceedings") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
346 ("pages" "Pages in the conference proceedings") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
347 ("year" "Year of publication") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
348 ("editor" "Editor1 [and Editor2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
349 ("volume" "Volume of the conference proceedings in the series") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
350 ("number" "Number of the conference proceedings in a small series (overwritten by volume)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
351 ("series" "Series in which the conference proceedings appeared") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
352 ("address" "Location of the Proceedings") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
353 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
354 ("organization" "Sponsoring organization of the conference") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
355 ("publisher" "Publishing company, its location") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
356 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
357 ("Manual" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
358 ((("title" "Title of the manual")) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
359 (("author" "Author1 [and Author2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
360 ("organization" "Publishing organization of the manual") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
361 ("address" "Address of the organization") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
362 ("edition" "Edition of the manual as a capitalized English word") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
363 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
364 ("year" "Year of publication") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
365 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
366 ("MastersThesis" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
367 ((("author" "Author1 [and Author2 ...] [and others]") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
368 ("title" "Title of the master\'s thesis (BibTeX converts it to lowercase)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
369 ("school" "School where the master\'s thesis was written") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
370 ("year" "Year of publication")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
371 (("type" "Type of the master\'s thesis (if other than \"Master\'s thesis\")") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
372 ("address" "Address of the school (if not part of field \"school\") or country") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
373 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
374 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
375 ("Misc" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
376 (() |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
377 (("author" "Author1 [and Author2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
378 ("title" "Title of the work (BibTeX converts it to lowercase)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
379 ("howpublished" "The way in which the work was published") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
380 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
381 ("year" "Year of publication") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
382 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
383 ("PhdThesis" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
384 ((("author" "Author1 [and Author2 ...] [and others]") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
385 ("title" "Title of the PhD. thesis") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
386 ("school" "School where the PhD. thesis was written") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
387 ("year" "Year of publication")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
388 (("type" "Type of the PhD. thesis") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
389 ("address" "Address of the school (if not part of field \"school\") or country") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
390 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
391 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
392 ("Proceedings" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
393 ((("title" "Title of the conference proceedings") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
394 ("year" "Year of publication")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
395 (("booktitle" "Title of the proceedings for cross references") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
396 ("editor" "Editor1 [and Editor2 ...] [and others]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
397 ("volume" "Volume of the conference proceedings in the series") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
398 ("number" "Number of the conference proceedings in a small series (overwritten by volume)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
399 ("series" "Series in which the conference proceedings appeared") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
400 ("address" "Location of the Proceedings") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
401 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
402 ("organization" "Sponsoring organization of the conference") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
403 ("publisher" "Publishing company, its location") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
404 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
405 ("TechReport" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
406 ((("author" "Author1 [and Author2 ...] [and others]") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
407 ("title" "Title of the technical report (BibTeX converts it to lowercase)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
408 ("institution" "Sponsoring institution of the report") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
409 ("year" "Year of publication")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
410 (("type" "Type of the report (if other than \"technical report\")") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
411 ("number" "Number of the technical report") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
412 ("address" "Address of the institution (if not part of field \"institution\") or country") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
413 ("month" "Month of the publication as a string (remove braces)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
414 ("note" "Remarks to be put at the end of the \\bibitem")))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
415 ("Unpublished" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
416 ((("author" "Author1 [and Author2 ...] [and others]") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
417 ("title" "Title of the unpublished work (BibTeX converts it to lowercase)") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
418 ("note" "Remarks to be put at the end of the \\bibitem")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
419 (("month" "Month of the publication as a string (remove braces)") |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
420 ("year" "Year of publication"))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
421 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
422 "List of BibTeX entry types and their associated fields. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
423 List elements are triples |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
424 \(ENTRY-NAME (REQUIRED OPTIONAL) (CROSSREF-REQUIRED CROSSREF-OPTIONAL)). |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
425 ENTRY-NAME is the name of a BibTeX entry. The remaining pairs contain |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
426 the required and optional fields of the BibTeX entry. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
427 The second pair is used if a crossref field is present |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
428 and the first pair is used if a crossref field is absent. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
429 If the second pair is nil, the first pair is always used. |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
430 REQUIRED, OPTIONAL, CROSSREF-REQUIRED and CROSSREF-OPTIONAL are lists. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
431 Each element of these lists is a list of the form |
43950
5ef8be2a8db1
(bibtex-sort-ignore-string-entries)
Pavel Janík <Pavel@Janik.cz>
parents:
43758
diff
changeset
|
432 \(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG). |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
433 COMMENT-STRING, INIT, and ALTERNATIVE-FLAG are optional. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
434 FIELD-NAME is the name of the field, COMMENT-STRING is the comment that |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
435 appears in the echo area, INIT is either the initial content of the |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
436 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
|
437 of the field, and ALTERNATIVE-FLAG (either nil or t) marks if the |
19461 | 438 field is an alternative. ALTERNATIVE-FLAG may be t only 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 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
|
440 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
441 (defcustom bibtex-comment-start "@Comment" |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
442 "String starting a BibTeX comment." |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
443 :group 'bibtex |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
444 :type 'string) |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
445 |
19460 | 446 (defcustom bibtex-add-entry-hook nil |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
447 "List of functions to call when BibTeX entry has been inserted." |
19460 | 448 :group 'bibtex |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
449 :type 'hook) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
450 |
19460 | 451 (defcustom bibtex-predefined-month-strings |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
452 '(("jan" . "January") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
453 ("feb" . "February") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
454 ("mar" . "March") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
455 ("apr" . "April") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
456 ("may" . "May") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
457 ("jun" . "June") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
458 ("jul" . "July") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
459 ("aug" . "August") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
460 ("sep" . "September") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
461 ("oct" . "October") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
462 ("nov" . "November") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
463 ("dec" . "December")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
464 "Alist of month string definitions used in the BibTeX style files. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
465 Each element is a pair of strings (ABBREVIATION . EXPANSION)." |
19460 | 466 :group 'bibtex |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
467 :type '(repeat (cons (string :tag "Month abbreviation") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
468 (string :tag "Month expansion")))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
469 |
19460 | 470 (defcustom 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
|
471 (append |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
472 bibtex-predefined-month-strings |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
473 '(("acmcs" . "ACM Computing Surveys") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
474 ("acta" . "Acta Informatica") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
475 ("cacm" . "Communications of the ACM") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
476 ("ibmjrd" . "IBM Journal of Research and Development") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
477 ("ibmsj" . "IBM Systems Journal") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
478 ("ieeese" . "IEEE Transactions on Software Engineering") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
479 ("ieeetc" . "IEEE Transactions on Computers") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
480 ("ieeetcad" . "IEEE Transactions on Computer-Aided Design of Integrated Circuits") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
481 ("ipl" . "Information Processing Letters") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
482 ("jacm" . "Journal of the ACM") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
483 ("jcss" . "Journal of Computer and System Sciences") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
484 ("scp" . "Science of Computer Programming") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
485 ("sicomp" . "SIAM Journal on Computing") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
486 ("tcs" . "Theoretical Computer Science") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
487 ("tocs" . "ACM Transactions on Computer Systems") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
488 ("tods" . "ACM Transactions on Database Systems") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
489 ("tog" . "ACM Transactions on Graphics") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
490 ("toms" . "ACM Transactions on Mathematical Software") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
491 ("toois" . "ACM Transactions on Office Information Systems") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
492 ("toplas" . "ACM Transactions on Programming Languages and Systems"))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
493 "Alist of string definitions used in the BibTeX style files. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
494 Each element is a pair of strings (ABBREVIATION . EXPANSION)." |
19460 | 495 :group 'bibtex |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
496 :type '(repeat (cons (string :tag "String") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
497 (string :tag "String expansion")))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
498 |
19460 | 499 (defcustom bibtex-string-files nil |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
500 "List of BibTeX files containing string definitions. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
501 List elements can be absolute file names or file names relative |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
502 to the directories specified in `bibtex-string-file-path'." |
19460 | 503 :group 'bibtex |
504 :type '(repeat file)) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
505 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
506 (defvar bibtex-string-file-path (getenv "BIBINPUTS") |
26711
eac840d283b6
(bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents:
25444
diff
changeset
|
507 "*Colon separated list of paths 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
|
508 |
57815 | 509 (defcustom bibtex-files nil |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
510 "List of BibTeX files that are searched for entry keys. |
57815 | 511 List elements can be absolute file names or file names relative to the |
512 directories specified in `bibtex-file-path'. If an element is a directory, | |
513 check all BibTeX files in this directory. If an element is the symbol | |
514 `bibtex-file-path', check all BibTeX files in `bibtex-file-path'." | |
515 :group 'bibtex | |
516 :type '(repeat file)) | |
517 | |
518 (defvar bibtex-file-path (getenv "BIBINPUTS") | |
519 "*Colon separated list of paths to search for `bibtex-files'.") | |
520 | |
19460 | 521 (defcustom bibtex-help-message t |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
522 "If non-nil print help messages in the echo area on entering a new field." |
19460 | 523 :group 'bibtex |
524 :type 'boolean) | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
525 |
19460 | 526 (defcustom bibtex-autokey-prefix-string "" |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
527 "String prefix for automatically generated reference keys. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
528 See `bibtex-generate-autokey' for details." |
19460 | 529 :group 'bibtex-autokey |
530 :type 'string) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
531 |
19460 | 532 (defcustom bibtex-autokey-names 1 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
533 "Number of names to use for the automatically generated reference key. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
534 Possibly more names are used according to `bibtex-autokey-names-stretch'. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
535 If this variable is nil, all names are used. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
536 See `bibtex-generate-autokey' for details." |
19460 | 537 :group 'bibtex-autokey |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
538 :type '(choice (const :tag "All" infty) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
539 integer)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
540 |
19460 | 541 (defcustom bibtex-autokey-names-stretch 0 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
542 "Number of names that can additionally be used for reference keys. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
543 These names are used only, if all names are used then. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
544 See `bibtex-generate-autokey' for details." |
19460 | 545 :group 'bibtex-autokey |
546 :type 'integer) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
547 |
19460 | 548 (defcustom bibtex-autokey-additional-names "" |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
549 "String to append to the generated key if not all names could be used. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
550 See `bibtex-generate-autokey' for details." |
19460 | 551 :group 'bibtex-autokey |
552 :type 'string) | |
18212
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-autokey-transcriptions |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
555 '(;; language specific characters |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
556 ("\\\\aa" . "a") ; \aa -> a |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
557 ("\\\\AA" . "A") ; \AA -> A |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
558 ("\\\"a\\|\\\\\\\"a\\|\\\\ae" . "ae") ; "a,\"a,\ae -> ae |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
559 ("\\\"A\\|\\\\\\\"A\\|\\\\AE" . "Ae") ; "A,\"A,\AE -> Ae |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
560 ("\\\\i" . "i") ; \i -> i |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
561 ("\\\\j" . "j") ; \j -> j |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
562 ("\\\\l" . "l") ; \l -> l |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
563 ("\\\\L" . "L") ; \L -> L |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
564 ("\\\"o\\|\\\\\\\"o\\|\\\\o\\|\\\\oe" . "oe") ; "o,\"o,\o,\oe -> oe |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
565 ("\\\"O\\|\\\\\\\"O\\|\\\\O\\|\\\\OE" . "Oe") ; "O,\"O,\O,\OE -> Oe |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
566 ("\\\"s\\|\\\\\\\"s\\|\\\\3" . "ss") ; "s,\"s,\3 -> ss |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
567 ("\\\"u\\|\\\\\\\"u" . "ue") ; "u,\"u -> ue |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
568 ("\\\"U\\|\\\\\\\"U" . "Ue") ; "U,\"U -> Ue |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
569 ;; accents |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
570 ("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" . "") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
571 ;; braces, quotes, concatenation. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
572 ("[`'\"{}#]" . "") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
573 ;; spaces |
57815 | 574 ("\\\\?[ \t\n]+\\|~" . " ")) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
575 "Alist of (OLD-REGEXP . NEW-STRING) pairs. |
19461 | 576 Used by the default values of `bibtex-autokey-name-change-strings' and |
577 `bibtex-autokey-titleword-change-strings'. Defaults to translating some | |
578 language specific characters to their ASCII transcriptions, and | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
579 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
|
580 |
19460 | 581 (defcustom 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
|
582 bibtex-autokey-transcriptions |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
583 "Alist of (OLD-REGEXP . NEW-STRING) pairs. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
584 Any part of a name matching OLD-REGEXP is replaced by NEW-STRING. |
19461 | 585 Case is significant in OLD-REGEXP. All regexps are tried in the |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
586 order in which they appear in the list. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
587 See `bibtex-generate-autokey' for details." |
19460 | 588 :group 'bibtex-autokey |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
589 :type '(repeat (cons (regexp :tag "Old") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
590 (string :tag "New")))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
591 |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
592 (defcustom bibtex-autokey-name-case-convert 'downcase |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
593 "Function called for each name to perform case conversion. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
594 See `bibtex-generate-autokey' for details." |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
595 :group 'bibtex-autokey |
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
596 :type '(choice (const :tag "Preserve case" identity) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
597 (const :tag "Downcase" downcase) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
598 (const :tag "Capitalize" capitalize) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
599 (const :tag "Upcase" upcase) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
600 (function :tag "Conversion function"))) |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
601 |
19460 | 602 (defcustom bibtex-autokey-name-length 'infty |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
603 "Number of characters from name to incorporate into key. |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
604 If this is set to anything but a number, all characters are used. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
605 See `bibtex-generate-autokey' for details." |
19460 | 606 :group 'bibtex-autokey |
607 :type '(choice (const :tag "All" infty) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
608 integer)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
609 |
19460 | 610 (defcustom bibtex-autokey-name-separator "" |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
611 "String that comes between any two names in the key. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
612 See `bibtex-generate-autokey' for details." |
19460 | 613 :group 'bibtex-autokey |
614 :type 'string) | |
615 | |
616 (defcustom bibtex-autokey-year-length 2 | |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
617 "Number of rightmost digits from the year field to incorporate into key. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
618 See `bibtex-generate-autokey' for details." |
19460 | 619 :group 'bibtex-autokey |
620 :type 'integer) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
621 |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
622 (defcustom bibtex-autokey-use-crossref t |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
623 "If non-nil use fields from crossreferenced entry if necessary. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
624 If this variable is non-nil and some field has no entry, but a |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
625 valid crossref entry, the field from the crossreferenced entry is used. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
626 See `bibtex-generate-autokey' for details." |
19460 | 627 :group 'bibtex-autokey |
628 :type 'boolean) | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
629 |
19460 | 630 (defcustom bibtex-autokey-titlewords 5 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
631 "Number of title words to use for the automatically generated reference key. |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
632 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
|
633 Possibly more words from the title are used according to |
19461 | 634 `bibtex-autokey-titlewords-stretch'. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
635 See `bibtex-generate-autokey' for details." |
19460 | 636 :group 'bibtex-autokey |
637 :type '(choice (const :tag "All" infty) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
638 integer)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
639 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
640 (defcustom bibtex-autokey-title-terminators "[.!?:;]\\|--" |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
641 "Regexp defining the termination of the main part of the title. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
642 Case of the regexps is ignored. See `bibtex-generate-autokey' for details." |
19460 | 643 :group 'bibtex-autokey |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
644 :type 'regexp) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
645 |
19460 | 646 (defcustom bibtex-autokey-titlewords-stretch 2 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
647 "Number of words that can additionally be used from the title. |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
648 These words are used only, if a sentence from the title can be ended then. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
649 See `bibtex-generate-autokey' for details." |
19460 | 650 :group 'bibtex-autokey |
651 :type 'integer) | |
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
|
652 |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
653 (defcustom bibtex-autokey-titleword-ignore |
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
654 '("A" "An" "On" "The" "Eine?" "Der" "Die" "Das" |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
655 "[^A-Z].*" ".*[^A-Z0-9].*") |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
656 "Determines words from the title that are not to be used in the key. |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
657 Each item of the list is a regexp. If a word of the title matches a |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
658 regexp from that list, it is not included in the title part of the key. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
659 See `bibtex-generate-autokey' for details." |
19460 | 660 :group 'bibtex-autokey |
661 :type '(repeat regexp)) | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
662 |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
663 (defcustom bibtex-autokey-titleword-case-convert 'downcase |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
664 "Function called for each titleword to perform case conversion. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
665 See `bibtex-generate-autokey' for details." |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
666 :group 'bibtex-autokey |
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
667 :type '(choice (const :tag "Preserve case" identity) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
668 (const :tag "Downcase" downcase) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
669 (const :tag "Capitalize" capitalize) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
670 (const :tag "Upcase" upcase) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
671 (function :tag "Conversion function"))) |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
672 |
19460 | 673 (defcustom bibtex-autokey-titleword-abbrevs nil |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
674 "Determines exceptions to the usual abbreviation mechanism. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
675 An alist of (OLD-REGEXP . NEW-STRING) pairs. Case is ignored |
19461 | 676 in matching against OLD-REGEXP, and the first matching pair is used. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
677 See `bibtex-generate-autokey' for details." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
678 :group 'bibtex-autokey |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
679 :type '(repeat (cons (regexp :tag "Old") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
680 (string :tag "New")))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
681 |
19460 | 682 (defcustom 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
|
683 bibtex-autokey-transcriptions |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
684 "Alist of (OLD-REGEXP . NEW-STRING) pairs. |
19461 | 685 Any part of title word matching a OLD-REGEXP is replaced by NEW-STRING. |
686 Case is significant in OLD-REGEXP. All regexps are tried in the | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
687 order in which they appear in the list. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
688 See `bibtex-generate-autokey' for details." |
19460 | 689 :group 'bibtex-autokey |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
690 :type '(repeat (cons (regexp :tag "Old") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
691 (string :tag "New")))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
692 |
19460 | 693 (defcustom bibtex-autokey-titleword-length 5 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
694 "Number of characters from title words to incorporate into key. |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
695 If this is set to anything but a number, all characters are used. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
696 See `bibtex-generate-autokey' for details." |
19460 | 697 :group 'bibtex-autokey |
698 :type '(choice (const :tag "All" infty) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
699 integer)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
700 |
19460 | 701 (defcustom bibtex-autokey-titleword-separator "_" |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
702 "String to be put between the title words. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
703 See `bibtex-generate-autokey' for details." |
19460 | 704 :group 'bibtex-autokey |
705 :type 'string) | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
706 |
19460 | 707 (defcustom bibtex-autokey-name-year-separator "" |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
708 "String to be put between name part and year part of key. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
709 See `bibtex-generate-autokey' for details." |
19460 | 710 :group 'bibtex-autokey |
711 :type 'string) | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
712 |
19460 | 713 (defcustom bibtex-autokey-year-title-separator ":_" |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
714 "String to be put between name part and year part of key. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
715 See `bibtex-generate-autokey' for details." |
19460 | 716 :group 'bibtex-autokey |
717 :type 'string) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
718 |
19460 | 719 (defcustom bibtex-autokey-edit-before-use t |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
720 "If non-nil, user is allowed to edit the generated key before it is used." |
19460 | 721 :group 'bibtex-autokey |
722 :type 'boolean) | |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
723 |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
724 (defcustom bibtex-autokey-before-presentation-function nil |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
725 "If non-nil, function to call before generated key is presented. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
726 The function must take one argument (the automatically generated key), |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
727 and must return a string (the key to use)." |
19460 | 728 :group 'bibtex-autokey |
35962
ad7104908c16
(bibtex-autokey-before-presentation-function): Fix :type.
Dave Love <fx@gnu.org>
parents:
27701
diff
changeset
|
729 :type '(choice (const nil) function)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
730 |
19460 | 731 (defcustom bibtex-entry-offset 0 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
732 "Offset for BibTeX entries. |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
733 Added to the value of all other variables which determine columns." |
19460 | 734 :group 'bibtex |
735 :type 'integer) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
736 |
19460 | 737 (defcustom bibtex-field-indentation 2 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
738 "Starting column for the name part in BibTeX fields." |
19460 | 739 :group 'bibtex |
740 :type 'integer) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
741 |
19460 | 742 (defcustom bibtex-text-indentation |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
743 (+ bibtex-field-indentation |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
744 (length "organization = ")) |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
745 "Starting column for the text part in BibTeX fields. |
19460 | 746 Should be equal to the space needed for the longest name part." |
747 :group 'bibtex | |
748 :type 'integer) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
749 |
19460 | 750 (defcustom bibtex-contline-indentation |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
751 (+ bibtex-text-indentation 1) |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
752 "Starting column for continuation lines of BibTeX fields." |
19460 | 753 :group 'bibtex |
754 :type 'integer) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
755 |
19460 | 756 (defcustom bibtex-align-at-equal-sign nil |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
757 "If non-nil, align fields at equal sign instead of field text. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
758 If non-nil, the column for the equal sign is the value of |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
759 `bibtex-text-indentation', minus 2." |
19460 | 760 :group 'bibtex |
761 :type 'boolean) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
762 |
19460 | 763 (defcustom bibtex-comma-after-last-field nil |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
764 "If non-nil, a comma is put at end of last field in the entry template." |
19460 | 765 :group 'bibtex |
766 :type 'boolean) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
767 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
768 (defcustom bibtex-autoadd-commas t |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
769 "If non-nil automatically add missing commas at end of BibTeX fields." |
57815 | 770 :group 'bibtex |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
771 :type 'boolean) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
772 |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
773 (defcustom bibtex-autofill-types '("Proceedings") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
774 "Automatically fill fields if possible for those BibTeX entry types." |
57815 | 775 :group 'bibtex |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
776 :type '(repeat string)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
777 |
57815 | 778 (defcustom bibtex-summary-function 'bibtex-summary |
779 "Function to call for generating a one-line summary of a BibTeX entry. | |
780 It takes one argument, the key of the entry. | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
781 Used by `bibtex-complete-crossref-cleanup' and `bibtex-copy-summary-as-kill'." |
57815 | 782 :group 'bibtex |
783 :type '(choice (const :tag "Default" bibtex-summary) | |
784 (function :tag "Personalized function"))) | |
785 | |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
786 (defcustom bibtex-generate-url-list |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
787 '((("url" . ".*:.*")) |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
788 ;; Example of a complex setup. |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
789 (("journal" . "\\<\\(PR[ABCDEL]?\\|RMP\\)\\>") |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
790 "http://link.aps.org/abstract/" |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
791 ("journal" ".*" downcase) |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
792 "/v" |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
793 ("volume" ".*" 0) |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
794 "/p" |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
795 ("pages" "\\`\\([0-9]+\\)" 1))) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
796 "List of schemes for generating the URL of a BibTeX entry. |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
797 These schemes are used by `bibtex-url'. |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
798 |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
799 Each scheme is of the form ((FIELD . REGEXP) STEP...). |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
800 |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
801 FIELD is a field name as returned by `bibtex-parse-entry'. |
57815 | 802 REGEXP is matched against the text of FIELD. If the match succeeds, then |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
803 this scheme is used. If no STEPs are specified the matched text is used |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
804 as the URL, otherwise the URL is built by concatenating the STEPs. |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
805 |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
806 A STEP can be a string or a list (FIELD REGEXP REPLACE) in which case |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
807 the text of FIELD is matched against REGEXP, and is replaced with REPLACE. |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
808 REPLACE can be a string, or a number (which selects the corresponding submatch) |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
809 or a function called with the field's text as argument and with the |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
810 `match-data' properly set. |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
811 |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
812 Case is always ignored. Always remove the field delimiters." |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
813 :group 'bibtex |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
814 :type '(repeat |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
815 (list :tag "Scheme" |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
816 (cons :tag "Matcher" :extra-offset 4 |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
817 (string :tag "BibTeX field") |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
818 (regexp :tag "Regexp")) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
819 (repeat :tag "Steps to generate URL" :inline t |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
820 (choice |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
821 (string :tag "Literal text") |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
822 (list (string :tag "BibTeX field") |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
823 (regexp :tag "Regexp") |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
824 (choice (string :tag "Replacement") |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
825 (integer :tag "Sub-match") |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
826 (function :tag "Filter")))))))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
827 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
828 ;; 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
|
829 ;; 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
|
830 ;; section of this file, it is defined later. |
26711
eac840d283b6
(bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents:
25444
diff
changeset
|
831 |
eac840d283b6
(bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents:
25444
diff
changeset
|
832 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
833 ;; 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
|
834 (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
|
835 (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
|
836 (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
|
837 (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
|
838 (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
|
839 (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
|
840 (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
|
841 (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
|
842 (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
|
843 (modify-syntax-entry ?\n "> " st) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
844 ;; Keys cannot have = in them (wrong font-lock of @string{foo=bar}). |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
845 (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
|
846 (modify-syntax-entry ?~ " " st) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
847 st) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
848 "Syntax table used in BibTeX mode 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
|
849 |
2465861025cd
Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
850 (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
|
851 (let ((km (make-sparse-keymap))) |
26711
eac840d283b6
(bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents:
25444
diff
changeset
|
852 ;; The Key `C-c&' is reserved for reftex.el |
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
|
853 (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
|
854 (define-key km "\n" 'bibtex-next-field) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
855 (define-key km "\M-\t" 'bibtex-complete) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
856 (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
|
857 (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
|
858 (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
|
859 (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
|
860 (define-key km "\C-c\C-q" 'bibtex-fill-entry) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
861 (define-key km "\C-c\C-s" 'bibtex-find-entry) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
862 (define-key km "\C-c\C-x" 'bibtex-find-crossref) |
57815 | 863 (define-key km "\C-c\C-t" 'bibtex-copy-summary-as-kill) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
864 (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
|
865 (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
|
866 (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
|
867 (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
|
868 (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
|
869 (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
|
870 (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
|
871 (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
|
872 (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
|
873 (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
|
874 (define-key km "\C-c\C-f" 'bibtex-make-field) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
875 (define-key km "\C-c\C-u" 'bibtex-entry-update) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
876 (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
|
877 (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
|
878 (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
|
879 (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
|
880 (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
|
881 (define-key km "\C-c\C-b" 'bibtex-entry) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
882 (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
|
883 (define-key km "\C-c\C-rw" 'widen) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
884 (define-key km "\C-c\C-l" 'bibtex-url) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
885 (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
|
886 (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
|
887 (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
|
888 (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
|
889 (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
|
890 (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
|
891 (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
|
892 (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
|
893 (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
|
894 (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
|
895 (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
|
896 (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
|
897 (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
|
898 (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
|
899 (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
|
900 (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
|
901 (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
|
902 (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
|
903 (define-key km "\C-c\C-e\C-u" 'bibtex-Unpublished) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
904 km) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
905 "Keymap used 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
|
906 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
907 (easy-menu-define |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
908 bibtex-edit-menu bibtex-mode-map "BibTeX-Edit Menu in BibTeX mode" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
909 '("BibTeX-Edit" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
910 ("Moving inside an Entry" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
911 ["End of Field" bibtex-find-text t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
912 ["Next Field" bibtex-next-field t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
913 ["Beginning of Entry" bibtex-beginning-of-entry t] |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
914 ["End of Entry" bibtex-end-of-entry t] |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
915 "--" |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
916 ["Make Entry Visible" bibtex-reposition-window t]) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
917 ("Moving in BibTeX Buffers" |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
918 ["Find Entry" bibtex-find-entry t] |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
919 ["Find Crossref Entry" bibtex-find-crossref t]) |
57815 | 920 "--" |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
921 ("Operating on Current Field" |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
922 ["Fill Field" fill-paragraph t] |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
923 ["Remove Delimiters" bibtex-remove-delimiters t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
924 ["Remove OPT or ALT Prefix" bibtex-remove-OPT-or-ALT t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
925 ["Clear Field" bibtex-empty-field t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
926 "--" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
927 ["Kill Field" bibtex-kill-field t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
928 ["Copy Field to Kill Ring" bibtex-copy-field-as-kill t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
929 ["Paste Most Recently Killed Field" bibtex-yank t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
930 ["Paste Previously Killed Field" bibtex-yank-pop t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
931 "--" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
932 ["Make New Field" bibtex-make-field t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
933 "--" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
934 ["Snatch from Similar Following Field" bibtex-pop-next t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
935 ["Snatch from Similar Preceding Field" bibtex-pop-previous t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
936 "--" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
937 ["String or Key Complete" bibtex-complete t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
938 "--" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
939 ["Help about Current Field" bibtex-print-help-message t]) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
940 ("Operating on Current Entry" |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
941 ["Fill Entry" bibtex-fill-entry t] |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
942 ["Clean Entry" bibtex-clean-entry t] |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
943 ["Update Entry" bibtex-entry-update t] |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
944 "--" |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
945 ["Kill Entry" bibtex-kill-entry t] |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
946 ["Copy Entry to Kill Ring" bibtex-copy-entry-as-kill t] |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
947 ["Paste Most Recently Killed Entry" bibtex-yank t] |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
948 ["Paste Previously Killed Entry" bibtex-yank-pop t] |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
949 "--" |
57815 | 950 ["Copy Summary to Kill Ring" bibtex-copy-summary-as-kill t] |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
951 ["Browse URL" bibtex-url t] |
57815 | 952 "--" |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
953 ["Ispell Entry" bibtex-ispell-entry t] |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
954 ["Ispell Entry Abstract" bibtex-ispell-abstract t] |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
955 "--" |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
956 ["Narrow to Entry" bibtex-narrow-to-entry t] |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
957 ["Mark Entry" bibtex-mark-entry t] |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
958 "--" |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
959 ["View Cite Locations (RefTeX)" reftex-view-crossref-from-bibtex |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
960 (fboundp 'reftex-view-crossref-from-bibtex)]) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
961 ("Operating on Buffer or Region" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
962 ["Validate Entries" bibtex-validate t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
963 ["Sort Entries" bibtex-sort-buffer t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
964 ["Reformat Entries" bibtex-reformat t] |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
965 ["Count Entries" bibtex-count-entries t] |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
966 "--" |
57815 | 967 ["Convert Alien Buffer" bibtex-convert-alien t]) |
968 ("Operating on Multiple Buffers" | |
969 ["Validate Entries" bibtex-validate-globally 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
|
970 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
971 (easy-menu-define |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
972 bibtex-entry-menu bibtex-mode-map "Entry-Types Menu in BibTeX mode" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
973 (list "Entry-Types" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
974 ["Article in Journal" bibtex-Article t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
975 ["Article in Conference Proceedings" bibtex-InProceedings t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
976 ["Article in a Collection" bibtex-InCollection t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
977 ["Chapter or Pages in a Book" bibtex-InBook t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
978 ["Conference Proceedings" bibtex-Proceedings t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
979 ["Book" bibtex-Book t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
980 ["Booklet (Bound, but no Publisher/Institution)" bibtex-Booklet t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
981 ["PhD. Thesis" bibtex-PhdThesis t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
982 ["Master's Thesis" bibtex-MastersThesis t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
983 ["Technical Report" bibtex-TechReport t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
984 ["Technical Manual" bibtex-Manual t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
985 ["Unpublished" bibtex-Unpublished t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
986 ["Miscellaneous" bibtex-Misc t] |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
987 "--" |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
988 ["String" bibtex-String t] |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
989 ["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
|
990 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
991 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
992 ;; 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
|
993 |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
994 (defvar bibtex-pop-previous-search-point nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
995 "Next point where `bibtex-pop-previous' starts looking for a similar entry.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
996 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
997 (defvar bibtex-pop-next-search-point nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
998 "Next point where `bibtex-pop-next' starts looking for a similar entry.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
999 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1000 (defvar bibtex-field-kill-ring nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1001 "Ring of least recently killed fields. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1002 At most `bibtex-field-kill-ring-max' items are kept here.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1003 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1004 (defvar bibtex-field-kill-ring-yank-pointer nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1005 "The tail of `bibtex-field-kill-ring' whose car is the last item yanked.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1006 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1007 (defvar bibtex-entry-kill-ring nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1008 "Ring of least recently killed entries. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1009 At most `bibtex-entry-kill-ring-max' items are kept here.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1010 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1011 (defvar bibtex-entry-kill-ring-yank-pointer nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1012 "The tail of `bibtex-entry-kill-ring' whose car is the last item yanked.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1013 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1014 (defvar bibtex-last-kill-command nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1015 "Type of the last kill command (either 'field or 'entry).") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1016 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1017 (defvar bibtex-strings |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1018 (lazy-completion-table bibtex-strings |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1019 bibtex-parse-strings (bibtex-string-files-init)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1020 "Completion table for BibTeX string keys. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1021 Initialized from `bibtex-predefined-strings' and `bibtex-string-files'.") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1022 (make-variable-buffer-local 'bibtex-strings) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1023 |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1024 (defvar bibtex-reference-keys |
57815 | 1025 (lazy-completion-table bibtex-reference-keys bibtex-parse-keys nil t) |
1026 "Completion table for BibTeX reference keys. | |
1027 The CDRs of the elements are t for header keys and nil for crossref keys.") | |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1028 (make-variable-buffer-local 'bibtex-reference-keys) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1029 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1030 (defvar bibtex-buffer-last-parsed-tick nil |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1031 "Value of `buffer-modified-tick' last time buffer was parsed for keys.") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1032 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1033 (defvar bibtex-parse-idle-timer nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1034 "Stores if timer is already installed.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1035 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1036 (defvar bibtex-progress-lastperc nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1037 "Last reported percentage for the progress message.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1038 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1039 (defvar bibtex-progress-lastmes nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1040 "Last reported progress message.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1041 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1042 (defvar bibtex-progress-interval nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1043 "Interval for progress messages.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1044 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1045 (defvar bibtex-key-history nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1046 "History list for reading keys.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1047 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1048 (defvar bibtex-entry-type-history nil |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1049 "History list for reading entry types.") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1050 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1051 (defvar bibtex-field-history nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1052 "History list for reading field names.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1053 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1054 (defvar bibtex-reformat-previous-options nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1055 "Last reformat options given.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1056 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1057 (defvar bibtex-reformat-previous-reference-keys nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1058 "Last reformat reference keys option given.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1059 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1060 (defconst bibtex-field-name "[^\"#%'(),={} \t\n0-9][^\"#%'(),={} \t\n]*" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1061 "Regexp matching the name part of a BibTeX field.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1062 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1063 (defconst bibtex-entry-type (concat "@" bibtex-field-name) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1064 "Regexp matching the type part of a BibTeX entry.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1065 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1066 (defconst bibtex-reference-key "[][a-zA-Z0-9.:;?!`'/*@+|()<>&_^$-]+" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1067 "Regexp matching the reference key part of a BibTeX entry.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1068 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1069 (defconst bibtex-field-const "[][a-zA-Z0-9.:;?!`'/*@+=|<>&_^$-]+" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1070 "Regexp matching a BibTeX field constant.") |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
1071 |
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
1072 (defconst bibtex-entry-head |
15637
405b1ecbf8ba
(bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents:
15565
diff
changeset
|
1073 (concat "^[ \t]*\\(" |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1074 bibtex-entry-type |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1075 "\\)[ \t]*[({][ \t\n]*\\(" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1076 bibtex-reference-key |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1077 "\\)") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1078 "Regexp matching the header line of a BibTeX entry.") |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
1079 |
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
1080 (defconst bibtex-entry-maybe-empty-head |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1081 (concat bibtex-entry-head "?") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1082 "Regexp matching the header line of a BibTeX entry (possibly without key).") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1083 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1084 (defconst bibtex-type-in-head 1 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1085 "Regexp subexpression number of the type part in `bibtex-entry-head'.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1086 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1087 (defconst bibtex-key-in-head 2 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1088 "Regexp subexpression number of the key part in `bibtex-entry-head'.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1089 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1090 (defconst bibtex-string-maybe-empty-head |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1091 (concat "^[ \t]*\\(@String\\)[ \t]*[({]\\(" |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1092 bibtex-reference-key |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1093 "\\)?") |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1094 "Regexp matching the header line of a BibTeX String entry.") |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1095 |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1096 (defconst bibtex-entry-postfix "[ \t\n]*,?[ \t\n]*[})]" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1097 "Regexp matching the postfix of a BibTeX entry.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1098 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1099 (defvar bibtex-known-entry-type-re |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1100 (regexp-opt (mapcar 'car bibtex-entry-field-alist)) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1101 "Regexp matching the name of a BibTeX entry.") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1102 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1103 (defvar bibtex-valid-entry-re |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1104 (concat "@[ \t]*\\(" bibtex-known-entry-type-re "\\)") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1105 "Regexp matching the name of a valid BibTeX entry.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1106 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1107 (defvar bibtex-valid-entry-whitespace-re |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1108 (concat "[ \t\n]*\\(" bibtex-valid-entry-re "\\)") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1109 "Regexp matching the name of a valid BibTeX entry preceded by whitespace.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1110 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1111 (defvar bibtex-any-valid-entry-re |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1112 (concat "@[ \t]*" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1113 (regexp-opt (append '("String") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1114 (mapcar 'car bibtex-entry-field-alist)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1115 t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1116 "Regexp matching the name of any valid BibTeX entry (including string).") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1117 |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
1118 (defconst bibtex-empty-field-re "\\`\\(\"\"\\|{}\\)\\'" |
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
1119 "Regexp matching the text part (as a string) of an empty field.") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1120 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1121 (defconst bibtex-font-lock-syntactic-keywords |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1122 `((,(concat "^[ \t]*\\(" (substring bibtex-comment-start 0 1) "\\)" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1123 (substring bibtex-comment-start 1) "\\>") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1124 1 '(11)))) |
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
|
1125 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
1126 (defvar bibtex-font-lock-keywords |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1127 ;; entry type and reference key |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1128 `((,bibtex-entry-maybe-empty-head |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1129 (,bibtex-type-in-head font-lock-function-name-face) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1130 (,bibtex-key-in-head font-lock-constant-face nil t)) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1131 ;; optional field names (treated as comments) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1132 (,(concat "^[ \t]*\\(OPT" bibtex-field-name "\\)[ \t]*=") |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1133 1 font-lock-comment-face) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1134 ;; field names |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1135 (,(concat "^[ \t]*\\(" bibtex-field-name "\\)[ \t]*=") |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1136 1 font-lock-variable-name-face) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1137 ;; url |
57815 | 1138 bibtex-font-lock-url bibtex-font-lock-crossref) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1139 "*Default expressions to highlight in BibTeX mode.") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1140 |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1141 (defvar bibtex-font-lock-url-regexp |
57815 | 1142 ;; Assume that field names begin at the beginning of a line. |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
1143 (concat "^[ \t]*" |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
1144 (regexp-opt (delete-dups (mapcar 'caar bibtex-generate-url-list)) t) |
57815 | 1145 "[ \t]*=[ \t]*") |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1146 "Regexp for `bibtex-font-lock-url'.") |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1147 |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1148 (defvar bibtex-field-name-for-parsing nil |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1149 "Regexp of field name to be parsed by function `bibtex-parse-field-name'. |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1150 Passed by dynamic scoping.") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1151 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1152 (defvar bibtex-sort-entry-class-alist |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1153 (let ((i -1) alist) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1154 (dolist (class bibtex-sort-entry-class alist) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1155 (setq i (1+ i)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1156 (dolist (entry class) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1157 ;; all entry names should be downcase (for ease of comparison) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1158 (push (cons (if (stringp entry) (downcase entry) entry) i) alist)))) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1159 "Alist mapping entry types to their sorting index. |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1160 Auto-generated from `bibtex-sort-entry-class'. |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1161 Used when `bibtex-maintain-sorted-entries' is `entry-class'.") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1162 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1163 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1164 ;; Support for hideshow minor mode |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1165 (defun bibtex-hs-forward-sexp (arg) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1166 "Replacement for `forward-sexp' to be used by `hs-minor-mode'. |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1167 ARG is ignored." |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1168 (if (looking-at "@\\S(*\\s(") |
57815 | 1169 (goto-char (1- (match-end 0)))) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1170 (forward-sexp 1)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1171 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1172 (add-to-list |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1173 'hs-special-modes-alist |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1174 '(bibtex-mode "@\\S(*\\s(" "\\s)" nil bibtex-hs-forward-sexp nil)) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
1175 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1176 |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1177 (defun bibtex-parse-association (parse-lhs parse-rhs) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1178 "Parse a string of the format <left-hand-side = right-hand-side>. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1179 The functions PARSE-LHS and PARSE-RHS are used to parse the corresponding |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1180 substrings. These functions are expected to return nil if parsing is not |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
1181 successful. If both functions return non-nil, a pair containing the returned |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1182 values of the functions PARSE-LHS and PARSE-RHS is returned." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1183 (save-match-data |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1184 (save-excursion |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1185 (let ((left (funcall parse-lhs)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1186 right) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1187 (if (and left |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1188 (looking-at "[ \t\n]*=[ \t\n]*") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1189 (goto-char (match-end 0)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1190 (setq right (funcall parse-rhs))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1191 (cons left right)))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1192 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1193 (defun bibtex-parse-field-name () |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1194 "Parse the field name stored in `bibtex-field-name-for-parsing'. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1195 If the field name is found, return a triple consisting of the position of the |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1196 very first character of the match, the actual starting position of the name |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1197 part and end position of the match. Move point to end of field name. |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
1198 If `bibtex-autoadd-commas' is non-nil add missing comma at end of preceding |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1199 BibTeX field as necessary." |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1200 (cond ((looking-at ",[ \t\n]*") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1201 (let ((start (point))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1202 (goto-char (match-end 0)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1203 (when (looking-at bibtex-field-name-for-parsing) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1204 (goto-char (match-end 0)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1205 (list start (match-beginning 0) (match-end 0))))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1206 ;; Maybe add a missing comma. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1207 ((and bibtex-autoadd-commas |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1208 (looking-at (concat "[ \t\n]*\\(?:" bibtex-field-name-for-parsing |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1209 "\\)[ \t\n]*="))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1210 (skip-chars-backward " \t\n") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1211 (insert ",") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1212 (forward-char -1) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1213 ;; Now try again. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1214 (bibtex-parse-field-name)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1215 |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1216 (defconst bibtex-braced-string-syntax-table |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1217 (let ((st (make-syntax-table))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1218 (modify-syntax-entry ?\{ "(}" st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1219 (modify-syntax-entry ?\} "){" st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1220 (modify-syntax-entry ?\[ "." st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1221 (modify-syntax-entry ?\] "." st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1222 (modify-syntax-entry ?\( "." st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1223 (modify-syntax-entry ?\) "." st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1224 (modify-syntax-entry ?\\ "." st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1225 (modify-syntax-entry ?\" "." st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1226 st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1227 "Syntax-table to parse matched braces.") |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1228 |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1229 (defconst bibtex-quoted-string-syntax-table |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1230 (let ((st (make-syntax-table))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1231 (modify-syntax-entry ?\\ "\\" st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1232 (modify-syntax-entry ?\" "\"" st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1233 st) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1234 "Syntax-table to parse matched quotes.") |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1235 |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1236 (defun bibtex-parse-field-string () |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1237 "Parse a BibTeX field string enclosed by braces or quotes. |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1238 If a syntactically correct string is found, a pair containing the start and |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1239 end position of the field string is returned, nil otherwise." |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1240 (let ((end-point |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1241 (or (and (eq (following-char) ?\") |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1242 (save-excursion |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1243 (with-syntax-table bibtex-quoted-string-syntax-table |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1244 (forward-sexp 1)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1245 (point))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1246 (and (eq (following-char) ?\{) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1247 (save-excursion |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1248 (with-syntax-table bibtex-braced-string-syntax-table |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1249 (forward-sexp 1)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1250 (point)))))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1251 (if end-point |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1252 (cons (point) end-point)))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1253 |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1254 (defun bibtex-parse-field-text () |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1255 "Parse the text part of a BibTeX field. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1256 The text part is either a string, or an empty string, or a constant followed |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1257 by one or more <# (string|constant)> pairs. If a syntactically correct text |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1258 is found, a pair containing the start and end position of the text is |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1259 returned, nil otherwise. Move point to end of field text." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1260 (let ((starting-point (point)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1261 end-point failure boundaries) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1262 (while (not (or end-point failure)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1263 (cond ((looking-at bibtex-field-const) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1264 (goto-char (match-end 0))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1265 ((setq boundaries (bibtex-parse-field-string)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1266 (goto-char (cdr boundaries))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1267 ((setq failure t))) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1268 (if (looking-at "[ \t\n]*#[ \t\n]*") |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1269 (goto-char (match-end 0)) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1270 (setq end-point (point)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1271 (if (and (not failure) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1272 end-point) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1273 (cons starting-point end-point)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1274 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1275 (defun bibtex-parse-field (name) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1276 "Parse a BibTeX field of regexp NAME. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1277 If a syntactically correct field is found, a pair containing the boundaries of |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1278 the name and text parts of the field is returned." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1279 (let ((bibtex-field-name-for-parsing name)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1280 (bibtex-parse-association 'bibtex-parse-field-name |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1281 'bibtex-parse-field-text))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1282 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1283 (defun bibtex-search-forward-field (name &optional bound) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1284 "Search forward to find a BibTeX field of name NAME. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1285 If a syntactically correct field is found, a pair containing the boundaries of |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1286 the name and text parts of the field is returned. The search is limited by |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1287 optional arg BOUND. If BOUND is t the search is limited by the end of the |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1288 current entry. Do not move point." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1289 (save-match-data |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1290 (save-excursion |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1291 (unless (integer-or-marker-p bound) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1292 (setq bound (if bound |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1293 (save-excursion (bibtex-end-of-entry)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1294 (point-max)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1295 (let ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1296 (bibtex-field-name-for-parsing name) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1297 boundaries temp-boundaries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1298 (while (and (not boundaries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1299 (< (point) bound) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1300 (search-forward "," bound t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1301 (goto-char (match-beginning 0)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1302 (if (and (setq temp-boundaries |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1303 (bibtex-parse-association 'bibtex-parse-field-name |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1304 'bibtex-parse-field-text)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1305 (<= (cddr temp-boundaries) bound)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1306 (setq boundaries temp-boundaries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1307 (forward-char 1))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1308 boundaries)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1309 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1310 (defun bibtex-search-backward-field (name &optional bound) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1311 "Search backward to find a BibTeX field of name NAME. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1312 If a syntactically correct field is found, a pair containing the boundaries of |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1313 the name and text parts of the field is returned. The search is limited by |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1314 optional arg BOUND. If BOUND is t the search is limited by the beginning of the |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1315 current entry. Do not move point." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1316 (save-match-data |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1317 (save-excursion |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1318 (unless (integer-or-marker-p bound) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1319 (setq bound (if bound |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1320 (save-excursion (bibtex-beginning-of-entry)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1321 (point-min)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1322 (let ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1323 (bibtex-field-name-for-parsing name) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1324 boundaries temp-boundaries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1325 (while (and (not boundaries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1326 (>= (point) bound) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1327 (search-backward "," bound t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1328 (if (setq temp-boundaries |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1329 (bibtex-parse-association 'bibtex-parse-field-name |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1330 'bibtex-parse-field-text)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1331 (setq boundaries temp-boundaries))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1332 boundaries)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1333 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1334 (defsubst bibtex-start-of-field (bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1335 (nth 0 (car bounds))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1336 (defsubst bibtex-start-of-name-in-field (bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1337 (nth 1 (car bounds))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1338 (defsubst bibtex-end-of-name-in-field (bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1339 (nth 2 (car bounds))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1340 (defsubst bibtex-end-of-field (bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1341 (cddr bounds)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1342 (defsubst bibtex-start-of-text-in-field (bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1343 (cadr bounds)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1344 (defsubst bibtex-end-of-text-in-field (bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1345 (cddr bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1346 |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1347 (defun bibtex-name-in-field (bounds &optional remove-opt-alt) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1348 "Get content of name in BibTeX field defined via BOUNDS. |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1349 If optional arg REMOVE-OPT-ALT is non-nil remove \"OPT\" and \"ALT\"." |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1350 (let ((name (buffer-substring-no-properties (nth 1 (car bounds)) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1351 (nth 2 (car bounds))))) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1352 (if (and remove-opt-alt |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1353 (string-match "\\`\\(OPT\\|ALT\\)" name)) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1354 (substring name 3) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1355 name))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1356 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1357 (defun bibtex-text-in-field-bounds (bounds &optional remove-delim) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1358 "Get content of text in BibTeX field defined via BOUNDS. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1359 If optional arg REMOVE-DELIM is non-nil remove enclosing field delimiters |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1360 if present." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1361 (let ((content (buffer-substring-no-properties (cadr bounds) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1362 (cddr bounds)))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1363 (if remove-delim |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1364 (bibtex-remove-delimiters-string content) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1365 content))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1366 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1367 (defun bibtex-text-in-field (field &optional follow-crossref) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1368 "Get content of field FIELD of current BibTeX entry. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1369 Return nil if not found. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1370 If optional arg FOLLOW-CROSSREF is non-nil, follow crossref." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1371 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1372 (save-restriction |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1373 ;; We want to jump back and forth while searching FIELD |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1374 (bibtex-narrow-to-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1375 (goto-char (point-min)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1376 (let ((bounds (bibtex-search-forward-field field)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1377 crossref-field) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1378 (cond (bounds (bibtex-text-in-field-bounds bounds t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1379 ((and follow-crossref |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1380 (progn (goto-char (point-min)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1381 (setq bounds (bibtex-search-forward-field |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1382 "\\(OPT\\)?crossref")))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1383 (setq crossref-field (bibtex-text-in-field-bounds bounds t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1384 (widen) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1385 (if (bibtex-find-crossref crossref-field) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1386 ;; Do not pass FOLLOW-CROSSREF because we want |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1387 ;; to follow crossrefs only one level of recursion. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1388 (bibtex-text-in-field field)))))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1389 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1390 (defun bibtex-parse-string-prefix () |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1391 "Parse the prefix part of a BibTeX string entry, including reference key. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1392 If the string prefix is found, return a triple consisting of the position of |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1393 the very first character of the match, the actual starting position of the |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1394 reference key and the end position of the match." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1395 (let ((case-fold-search t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1396 (if (looking-at "^[ \t]*@string[ \t\n]*[({][ \t\n]*") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1397 (let ((start (point))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1398 (goto-char (match-end 0)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1399 (when (looking-at bibtex-reference-key) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1400 (goto-char (match-end 0)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1401 (list start |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1402 (match-beginning 0) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1403 (match-end 0))))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1404 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1405 (defun bibtex-parse-string-postfix () |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1406 "Parse the postfix part of a BibTeX string entry, including the text. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1407 If the string postfix is found, return a triple consisting of the position of |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1408 the actual starting and ending position of the text and the very last |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1409 character of the string entry. Move point past BibTeX string entry." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1410 (let* ((case-fold-search t) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1411 (bounds (bibtex-parse-field-text))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1412 (when bounds |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1413 (goto-char (cdr bounds)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1414 (when (looking-at "[ \t\n]*[})]") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1415 (goto-char (match-end 0)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1416 (list (car bounds) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1417 (cdr bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1418 (match-end 0)))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1419 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1420 (defun bibtex-parse-string () |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1421 "Parse a BibTeX string entry. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1422 If a syntactically correct entry is found, a pair containing the boundaries of |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1423 the reference key and text parts of the entry is returned. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1424 Move point past BibTeX string entry." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1425 (bibtex-parse-association 'bibtex-parse-string-prefix |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1426 'bibtex-parse-string-postfix)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1427 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1428 (defun bibtex-search-forward-string () |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1429 "Search forward to find a BibTeX string entry. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1430 If a syntactically correct entry is found, a pair containing the boundaries of |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1431 the reference key and text parts of the string is returned. Do not move point." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1432 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1433 (save-match-data |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1434 (let ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1435 boundaries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1436 (while (and (not boundaries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1437 (search-forward-regexp |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1438 "^[ \t]*@string[ \t\n]*[({][ \t\n]*" nil t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1439 (goto-char (match-beginning 0)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1440 (unless (setq boundaries (bibtex-parse-string)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1441 (forward-char 1))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1442 boundaries)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1443 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1444 (defun bibtex-search-backward-string () |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1445 "Search backward to find a BibTeX string entry. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1446 If a syntactically correct entry is found, a pair containing the boundaries of |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1447 the reference key and text parts of the field is returned. Do not move point." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1448 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1449 (save-match-data |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1450 (let ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1451 boundaries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1452 (while (and (not boundaries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1453 (search-backward-regexp |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1454 "^[ \t]*@string[ \t\n]*[({][ \t\n]*" nil t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1455 (goto-char (match-beginning 0)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1456 (setq boundaries (bibtex-parse-string))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1457 boundaries)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1458 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1459 (defun bibtex-reference-key-in-string (bounds) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1460 (buffer-substring-no-properties (nth 1 (car bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1461 (nth 2 (car bounds)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1462 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1463 (defun bibtex-text-in-string (bounds &optional remove-delim) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1464 "Get content of text in BibTeX string field defined via BOUNDS. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1465 If optional arg REMOVE-DELIM is non-nil remove enclosing field |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1466 delimiters if present." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1467 (let ((content (buffer-substring-no-properties (nth 0 (cdr bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1468 (nth 1 (cdr bounds))))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1469 (if remove-delim |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1470 (bibtex-remove-delimiters-string content) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1471 content))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1472 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1473 (defsubst bibtex-start-of-text-in-string (bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1474 (nth 0 (cdr bounds))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1475 (defsubst bibtex-end-of-text-in-string (bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1476 (nth 1 (cdr bounds))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1477 (defsubst bibtex-end-of-string (bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1478 (nth 2 (cdr bounds))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1479 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1480 (defsubst bibtex-type-in-head () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1481 "Extract BibTeX type in head." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1482 ;; ignore @ |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1483 (buffer-substring-no-properties (1+ (match-beginning bibtex-type-in-head)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1484 (match-end bibtex-type-in-head))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1485 |
57815 | 1486 (defsubst bibtex-key-in-head (&optional empty) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1487 "Extract BibTeX key in head. Return optional arg EMPTY if key is empty." |
57815 | 1488 (or (match-string-no-properties bibtex-key-in-head) |
1489 empty)) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1490 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
1491 ;; 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
|
1492 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
1493 (defun bibtex-remove-delimiters-string (str) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
1494 "Remove delimiters of string STR." |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
1495 (if (and (memq (aref str 0) '(?\{ ?\")) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
1496 (memq (aref str (1- (length str))) '(?\} ?\"))) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
1497 (substring str 1 -1) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
1498 str)) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
1499 |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1500 (defsubst bibtex-string= (str1 str2) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1501 "Return t if STR1 and STR2 are equal, ignoring case." |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1502 (eq t (compare-strings str1 0 nil str2 0 nil t))) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1503 |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
1504 (defun bibtex-delete-whitespace () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1505 "Delete all whitespace starting at point." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1506 (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
|
1507 (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
|
1508 |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
1509 (defun bibtex-current-line () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1510 "Compute line number of point regardless whether the buffer is narrowed." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1511 (+ (count-lines 1 (point)) |
57815 | 1512 (if (bolp) 1 0))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1513 |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
1514 (defun bibtex-skip-to-valid-entry (&optional backward) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1515 "Move point to beginning of the next valid BibTeX entry. |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1516 Do not move if we are already at beginning of a valid BibTeX entry. |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1517 With optional argument BACKWARD non-nil, move backward to |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1518 beginning of previous valid one. A valid entry is a syntactical correct one |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1519 with type contained in `bibtex-entry-field-alist' or, if |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1520 `bibtex-sort-ignore-string-entries' is nil, a syntactical correct string |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1521 entry. Return buffer position of beginning and ending of entry if a valid |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1522 entry is found, nil otherwise." |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1523 (interactive "P") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1524 (let ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1525 found) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1526 (while (not (or found (if backward (bobp) (eobp)))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1527 (let ((pnt (point)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1528 bounds) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1529 (cond ((or (and (looking-at bibtex-valid-entry-re) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1530 (setq found (bibtex-search-entry nil nil t)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1531 (equal (match-beginning 0) pnt)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1532 (and (not bibtex-sort-ignore-string-entries) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1533 (setq bounds (bibtex-parse-string)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1534 (setq found (cons (bibtex-start-of-field bounds) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1535 (bibtex-end-of-string bounds))))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1536 (goto-char pnt)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1537 (backward |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1538 (if (re-search-backward "^[ \t]*\\(@\\)" nil 'move) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1539 (goto-char (match-beginning 1)))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1540 (t (if (re-search-forward "\n[ \t]*@" nil 'move) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1541 (forward-char -1)))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1542 found)) |
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
|
1543 |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
1544 (defun bibtex-map-entries (fun) |
57815 | 1545 "Call FUN for each BibTeX entry in buffer (possibly narrowed). |
1546 FUN is called with three arguments, the key of the entry and the buffer | |
1547 positions (marker) of beginning and end of entry. Point is inside the entry. | |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
1548 If `bibtex-sort-ignore-string-entries' is non-nil, FUN is not called for |
57815 | 1549 @String entries." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1550 (let ((case-fold-search t)) |
57815 | 1551 (save-excursion |
1552 (goto-char (point-min)) | |
1553 (while (re-search-forward bibtex-entry-head nil t) | |
1554 (let ((entry-type (bibtex-type-in-head)) | |
1555 (key (bibtex-key-in-head "")) | |
1556 (beg (copy-marker (match-beginning 0))) | |
1557 (end (copy-marker (save-excursion (bibtex-end-of-entry))))) | |
1558 (save-excursion | |
1559 (if (or (and (not bibtex-sort-ignore-string-entries) | |
1560 (bibtex-string= entry-type "string")) | |
1561 (assoc-string entry-type bibtex-entry-field-alist t)) | |
1562 (funcall fun key beg end))) | |
1563 (goto-char end)))))) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1564 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1565 (defun bibtex-progress-message (&optional flag interval) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1566 "Echo a message about progress of current buffer. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1567 If FLAG is a string, the message is initialized (in this case a |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1568 value for INTERVAL may be given as well (if not this is set to 5)). |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1569 If FLAG is `done', the message is deinitialized. |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1570 If FLAG is nil, a message is echoed if point was incremented at least |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1571 `bibtex-progress-interval' percent since last message was echoed." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1572 (cond ((stringp flag) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1573 (setq bibtex-progress-lastmes flag |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1574 bibtex-progress-interval (or interval 5) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1575 bibtex-progress-lastperc 0)) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1576 ((eq flag 'done) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1577 (message "%s (done)" bibtex-progress-lastmes) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1578 (setq bibtex-progress-lastmes nil)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1579 (t |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1580 (let* ((size (- (point-max) (point-min))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1581 (perc (if (= size 0) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1582 100 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1583 (/ (* 100 (- (point) (point-min))) size)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1584 (when (>= perc (+ bibtex-progress-lastperc |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1585 bibtex-progress-interval)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1586 (setq bibtex-progress-lastperc perc) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1587 (message "%s (%d%%)" bibtex-progress-lastmes perc)))))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1588 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1589 (defun bibtex-field-left-delimiter () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1590 "Return a string dependent on `bibtex-field-delimiters'." |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1591 (if (eq bibtex-field-delimiters 'braces) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1592 "{" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1593 "\"")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1594 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1595 (defun bibtex-field-right-delimiter () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1596 "Return a string dependent on `bibtex-field-delimiters'." |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1597 (if (eq bibtex-field-delimiters 'braces) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1598 "}" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1599 "\"")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1600 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1601 (defun bibtex-entry-left-delimiter () |
57815 | 1602 "Return a string dependent on `bibtex-entry-delimiters'." |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1603 (if (eq bibtex-entry-delimiters 'braces) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1604 "{" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1605 "(")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1606 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1607 (defun bibtex-entry-right-delimiter () |
57815 | 1608 "Return a string dependent on `bibtex-entry-delimiters'." |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1609 (if (eq bibtex-entry-delimiters 'braces) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1610 "}" |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1611 ")")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1612 |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1613 (defun bibtex-search-entry (empty-head &optional bound noerror backward) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1614 "Search for a BibTeX entry (maybe without reference key if EMPTY-HEAD is t). |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1615 BOUND and NOERROR are exactly as in `re-search-forward'. If BACKWARD |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1616 is non-nil, search in reverse direction. Move point past the closing |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1617 delimiter (at the beginning of entry if BACKWARD is non-nil). |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1618 Return a cons pair with buffer positions of beginning and end of entry. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1619 After call to this function MATCH-BEGINNING and MATCH-END functions |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1620 are defined, but only for the head part of the entry |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1621 \(especially (match-end 0) just gives the end of the head part)." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1622 (let ((pnt (point)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1623 (entry-head-re (if empty-head |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1624 bibtex-entry-maybe-empty-head |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1625 bibtex-entry-head))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1626 (if backward |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1627 (let (found) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1628 (while (and (not found) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1629 (re-search-backward entry-head-re bound noerror)) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
1630 (setq found (bibtex-search-entry empty-head pnt t))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1631 (if found |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1632 (progn (goto-char (match-beginning 0)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1633 found) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1634 (cond ((not noerror) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1635 ;; yell |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1636 (error "Backward search of BibTeX entry failed")) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1637 ((eq noerror t) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1638 ;; don't move |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1639 (goto-char pnt))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1640 nil)) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1641 (let (found) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1642 (unless bound (setq bound (point-max))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1643 (while (and (not found) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1644 (re-search-forward entry-head-re bound noerror)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1645 (save-match-data |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1646 (let ((entry-closer |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1647 (if (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1648 (goto-char (match-end bibtex-type-in-head)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1649 (looking-at "[ \t]*(")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1650 ;; entry opened with parenthesis |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1651 ?\) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1652 ?\})) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1653 (infix-start (point)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1654 finished bounds) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1655 (while (not finished) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1656 (skip-chars-forward " \t\n" bound) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1657 (if (and (setq bounds (bibtex-parse-field bibtex-field-name)) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1658 (<= (bibtex-end-of-field bounds) bound)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1659 (setq infix-start (bibtex-end-of-field bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1660 (setq finished t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1661 (goto-char infix-start)) |
57815 | 1662 ;; This matches the infix* part. The AND construction assures |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1663 ;; that BOUND is respected. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1664 (when (and (looking-at bibtex-entry-postfix) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1665 (eq (char-before (match-end 0)) entry-closer) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1666 (<= (match-end 0) bound)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1667 (goto-char (match-end 0)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1668 (setq found t))))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1669 (if found |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1670 (cons (match-beginning 0) (point)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1671 (cond ((not noerror) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1672 ;; yell |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1673 (error "Search of BibTeX entry failed")) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1674 ((eq noerror t) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1675 ;; don't move |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1676 (goto-char pnt))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1677 nil))))) |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
1678 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1679 (defun bibtex-flash-head () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1680 "Flash at BibTeX entry head before point, if exists." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1681 (let ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1682 flash) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
1683 (cond ((re-search-backward bibtex-entry-head nil t) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1684 (goto-char (match-beginning bibtex-type-in-head)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1685 (setq flash (match-end bibtex-key-in-head))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1686 (t |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1687 (end-of-line) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1688 (skip-chars-backward " \t") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1689 (setq flash (point)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1690 (beginning-of-line) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1691 (skip-chars-forward " \t"))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1692 (if (pos-visible-in-window-p (point)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1693 (sit-for 1) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1694 (message "From: %s" |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1695 (buffer-substring (point) flash))))) |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
1696 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1697 (defun bibtex-make-optional-field (field) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1698 "Make an optional field named FIELD in current BibTeX entry." |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1699 (if (consp field) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1700 (bibtex-make-field (cons (concat "OPT" (car field)) (cdr field))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1701 (bibtex-make-field (concat "OPT" field)))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1702 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1703 (defun bibtex-move-outside-of-entry () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1704 "Make sure point is outside of a BibTeX entry." |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
1705 (let ((orig-point (point))) |
26711
eac840d283b6
(bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents:
25444
diff
changeset
|
1706 (bibtex-end-of-entry) |
52891
a6806242012a
(bibtex-move-outside-of-entry):
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
1707 (when (< (point) orig-point) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1708 ;; We moved backward, so we weren't inside an entry to begin with. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1709 ;; Leave point at the beginning of a line, and preferably |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1710 ;; at the beginning of a paragraph. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1711 (goto-char orig-point) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1712 (beginning-of-line 1) |
52891
a6806242012a
(bibtex-move-outside-of-entry):
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
1713 (unless (= ?\n (char-before (1- (point)))) |
a6806242012a
(bibtex-move-outside-of-entry):
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
1714 (re-search-forward "^[ \t]*[@\n]" nil 'move) |
a6806242012a
(bibtex-move-outside-of-entry):
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
1715 (backward-char 1))) |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
1716 (skip-chars-forward " \t\n"))) |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
1717 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1718 (defun bibtex-beginning-of-first-entry () |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1719 "Go to the beginning of the first BibTeX entry in buffer. Return point." |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
1720 (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
|
1721 (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
|
1722 (beginning-of-line)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1723 (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1724 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1725 (defun bibtex-beginning-of-last-entry () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1726 "Go to the beginning of the last BibTeX entry in buffer." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1727 (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
|
1728 (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
|
1729 (beginning-of-line)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1730 (point)) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1731 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1732 (defun bibtex-inside-field () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1733 "Try to avoid point being at end of a BibTeX field." |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1734 (end-of-line) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1735 (skip-chars-backward " \t") |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1736 (if (= (preceding-char) ?,) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1737 (forward-char -2)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1738 (if (or (= (preceding-char) ?}) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1739 (= (preceding-char) ?\")) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1740 (forward-char -1))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
1741 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1742 (defun bibtex-enclosing-field (&optional noerr) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1743 "Search for BibTeX field enclosing point. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1744 Unless NOERR is non-nil, signal an error if no enclosing field is found. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1745 On success return bounds, nil otherwise. Do not move point." |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1746 (let ((bounds (bibtex-search-backward-field bibtex-field-name t))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1747 (if (and bounds |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1748 (<= (bibtex-start-of-field bounds) (point)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1749 (>= (bibtex-end-of-field bounds) (point))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1750 bounds |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1751 (unless noerr |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1752 (error "Can't find enclosing BibTeX field"))))) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
1753 |
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
1754 (defun bibtex-enclosing-entry-maybe-empty-head () |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
1755 "Search for BibTeX entry enclosing point. Move point to end of entry. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1756 Beginning (but not end) of entry is given by (`match-beginning' 0)." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1757 (let ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1758 (old-point (point))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1759 (unless (re-search-backward bibtex-entry-maybe-empty-head nil t) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1760 (goto-char old-point) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1761 (error "Can't find beginning of enclosing BibTeX entry")) |
13728
4b7903cfa7ee
(bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents:
12770
diff
changeset
|
1762 (goto-char (match-beginning bibtex-type-in-head)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1763 (unless (bibtex-search-entry t nil t) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1764 (goto-char old-point) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1765 (error "Can't find end of enclosing BibTeX entry")))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1766 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1767 (defun bibtex-insert-kill (n) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1768 "Reinsert the Nth stretch of killed BibTeX text." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1769 (if (not bibtex-last-kill-command) |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
1770 (error "BibTeX kill ring is empty") |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1771 (let* ((kr (if (eq bibtex-last-kill-command 'field) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1772 '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
|
1773 'bibtex-entry-kill-ring)) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1774 (kryp (if (eq bibtex-last-kill-command 'field) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1775 '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
|
1776 'bibtex-entry-kill-ring-yank-pointer)) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1777 (current (car (set kryp (nthcdr (mod (- n (length (eval kryp))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1778 (length (eval kr))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1779 (eval kr)))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1780 (if (eq bibtex-last-kill-command 'field) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1781 (let (bibtex-help-message) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1782 (bibtex-find-text) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1783 (if (looking-at "[}\"]") |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1784 (forward-char)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1785 (set-mark (point)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1786 (message "Mark set") |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1787 (bibtex-make-field current t)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1788 (unless (eobp) (bibtex-beginning-of-entry)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1789 (set-mark (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1790 (message "Mark set") |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1791 (insert current))))) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
1792 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1793 (defun bibtex-format-entry () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1794 "Helper function for `bibtex-clean-entry'. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1795 Formats current entry according to variable `bibtex-entry-format'." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1796 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1797 (save-restriction |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1798 (bibtex-narrow-to-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1799 (let ((case-fold-search t) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1800 (format (if (eq bibtex-entry-format t) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1801 '(realign opts-or-alts required-fields |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1802 numerical-fields |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1803 last-comma page-dashes delimiters |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1804 unify-case inherit-booktitle) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1805 bibtex-entry-format)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1806 crossref-key bounds alternatives-there non-empty-alternative |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1807 entry-list req-field-list field-list) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1808 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1809 ;; identify entry type |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1810 (goto-char (point-min)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1811 (re-search-forward bibtex-entry-type) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1812 (let ((beg-type (1+ (match-beginning 0))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1813 (end-type (match-end 0))) |
55730
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1814 (setq entry-list (assoc-string (buffer-substring-no-properties |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1815 beg-type end-type) |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1816 bibtex-entry-field-alist |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1817 t)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1818 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1819 ;; unify case of entry name |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1820 (when (memq 'unify-case format) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1821 (delete-region beg-type end-type) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1822 (insert (car entry-list))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1823 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1824 ;; update left entry delimiter |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1825 (when (memq 'delimiters format) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1826 (goto-char end-type) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1827 (skip-chars-forward " \t\n") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1828 (delete-char 1) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1829 (insert (bibtex-entry-left-delimiter)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1830 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1831 ;; determine if entry has crossref field and if at least |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1832 ;; one alternative is non-empty |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1833 (goto-char (point-min)) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1834 (let* ((fields-alist (bibtex-parse-entry)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1835 (field (assoc-string "crossref" fields-alist t))) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1836 (setq crossref-key (and field |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1837 (not (string-match bibtex-empty-field-re |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1838 (cdr field))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1839 (bibtex-remove-delimiters-string (cdr field))) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1840 req-field-list (if crossref-key |
57815 | 1841 (nth 0 (nth 2 entry-list)) ; crossref part |
1842 (nth 0 (nth 1 entry-list)))) ; required part | |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1843 |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1844 (dolist (rfield req-field-list) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1845 (when (nth 3 rfield) ; we should have an alternative |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1846 (setq alternatives-there t |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1847 field (assoc-string (car rfield) fields-alist t)) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1848 (if (and field |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1849 (not (string-match bibtex-empty-field-re |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1850 (cdr field)))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1851 (cond ((not non-empty-alternative) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1852 (setq non-empty-alternative t)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1853 ((memq 'required-fields format) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1854 (error "More than one non-empty alternative"))))))) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1855 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
1856 (if (and alternatives-there |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1857 (not non-empty-alternative) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1858 (memq 'required-fields format)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1859 (error "All alternatives are empty")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1860 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1861 ;; process all fields |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1862 (goto-char (point-min)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1863 (while (setq bounds (bibtex-search-forward-field bibtex-field-name)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1864 (let* ((beg-field (copy-marker (bibtex-start-of-field bounds))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1865 (end-field (copy-marker (bibtex-end-of-field bounds) t)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1866 (beg-name (copy-marker (bibtex-start-of-name-in-field bounds))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1867 (end-name (copy-marker (bibtex-end-of-name-in-field bounds))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1868 (beg-text (copy-marker (bibtex-start-of-text-in-field bounds))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1869 (end-text (copy-marker (bibtex-end-of-text-in-field bounds) t)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1870 (opt-alt (string-match "OPT\\|ALT" |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1871 (buffer-substring-no-properties |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1872 beg-name (+ beg-name 3)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1873 (field-name (buffer-substring-no-properties |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1874 (if opt-alt (+ beg-name 3) beg-name) end-name)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1875 (empty-field (string-match bibtex-empty-field-re |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1876 (buffer-substring-no-properties |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
1877 beg-text end-text))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1878 deleted) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1879 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1880 ;; We have more elegant high-level functions for several |
57815 | 1881 ;; tasks done by bibtex-format-entry. However, they contain |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1882 ;; quite some redundancy compared with what we need to do |
57815 | 1883 ;; anyway. So for speed-up we avoid using them. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1884 |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1885 (if (memq 'opts-or-alts format) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1886 (cond ((and empty-field |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1887 (or opt-alt |
55730
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1888 (let ((field (assoc-string |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1889 field-name req-field-list t))) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1890 (or (not field) ; OPT field |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1891 (nth 3 field))))) ; ALT field |
57815 | 1892 ;; Either it is an empty ALT field. Then we have checked |
1893 ;; already that we have one non-empty alternative. Or it | |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1894 ;; is an empty OPT field that we do not miss anyway. |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1895 ;; So we can safely delete this field. |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1896 (delete-region beg-field end-field) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1897 (setq deleted t)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1898 ;; otherwise: not empty, delete "OPT" or "ALT" |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1899 (opt-alt |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1900 (goto-char beg-name) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1901 (delete-char 3)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1902 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1903 (unless deleted |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1904 (push field-name field-list) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1905 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1906 ;; remove delimiters from purely numerical fields |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1907 (when (and (memq 'numerical-fields format) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1908 (progn (goto-char beg-text) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1909 (looking-at "\\(\"[0-9]+\"\\)\\|\\({[0-9]+}\\)"))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1910 (goto-char end-text) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1911 (delete-char -1) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1912 (goto-char beg-text) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1913 (delete-char 1)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1914 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1915 ;; update delimiters |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1916 (when (memq 'delimiters format) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1917 (goto-char beg-text) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1918 (when (looking-at "[{\"]") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1919 (delete-char 1) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1920 (insert (bibtex-field-left-delimiter))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1921 (goto-char (1- (marker-position end-text))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1922 (when (looking-at "[}\"]") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1923 (delete-char 1) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1924 (insert (bibtex-field-right-delimiter)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1925 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1926 ;; update page dashes |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1927 (if (and (memq 'page-dashes format) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1928 (bibtex-string= field-name "pages") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1929 (progn (goto-char beg-text) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1930 (looking-at |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1931 "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)"))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1932 (replace-match "\\1-\\2")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1933 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1934 ;; use book title of crossref'd entry |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1935 (if (and (memq 'inherit-booktitle format) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1936 empty-field |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1937 (bibtex-string= field-name "booktitle") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1938 crossref-key) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1939 (let ((title (save-excursion |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1940 (save-restriction |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1941 (widen) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1942 (if (bibtex-find-entry crossref-key t) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
1943 (bibtex-text-in-field "title")))))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1944 (when title |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1945 (setq empty-field nil) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1946 (goto-char (1+ beg-text)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1947 (insert title)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1948 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1949 ;; Use booktitle to set a missing title. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1950 (if (and empty-field |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
1951 (bibtex-string= field-name "title")) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1952 (let ((booktitle (bibtex-text-in-field "booktitle"))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1953 (when booktitle |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1954 (setq empty-field nil) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1955 (goto-char (1+ beg-text)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
1956 (insert booktitle)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1957 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1958 ;; if empty field, complain |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1959 (if (and empty-field |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1960 (memq 'required-fields format) |
55730
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1961 (assoc-string field-name req-field-list t)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1962 (error "Mandatory field `%s' is empty" field-name)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1963 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1964 ;; unify case of field name |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1965 (if (memq 'unify-case format) |
55730
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1966 (let ((fname (car (assoc-string |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1967 field-name |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1968 (append (nth 0 (nth 1 entry-list)) |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1969 (nth 1 (nth 1 entry-list)) |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1970 bibtex-user-optional-fields) |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
1971 t)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1972 (if fname |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1973 (progn |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1974 (delete-region beg-name end-name) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1975 (goto-char beg-name) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1976 (insert fname)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1977 ;; there are no rules we could follow |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1978 (downcase-region beg-name end-name)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1979 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1980 ;; update point |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1981 (goto-char end-field)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1982 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1983 ;; check whether all required fields are present |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1984 (if (memq 'required-fields format) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1985 (let ((found 0) altlist) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
1986 (dolist (fname req-field-list) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1987 (if (nth 3 fname) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1988 (push (car fname) altlist)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1989 (unless (or (member (car fname) field-list) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1990 (nth 3 fname)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1991 (error "Mandatory field `%s' is missing" (car fname)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1992 (when altlist |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1993 (dolist (fname altlist) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1994 (if (member fname field-list) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1995 (setq found (1+ found)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1996 (cond ((= found 0) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1997 (error "Alternative mandatory field `%s' is missing" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1998 altlist)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
1999 ((> found 1) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2000 (error "Alternative fields `%s' are defined %s times" |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2001 altlist found)))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2002 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2003 ;; update point |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2004 (if (looking-at (bibtex-field-right-delimiter)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2005 (forward-char)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2006 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2007 ;; update comma after last field |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2008 (if (memq 'last-comma format) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2009 (cond ((and bibtex-comma-after-last-field |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2010 (not (looking-at ","))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2011 (insert ",")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2012 ((and (not bibtex-comma-after-last-field) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2013 (looking-at ",")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2014 (delete-char 1)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2015 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2016 ;; update right entry delimiter |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2017 (if (looking-at ",") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2018 (forward-char)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2019 (when (memq 'delimiters format) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2020 (skip-chars-forward " \t\n") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2021 (delete-char 1) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2022 (insert (bibtex-entry-right-delimiter))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2023 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2024 ;; fill entry |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2025 (if (memq 'realign format) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2026 (bibtex-fill-entry)))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2027 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2028 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
2029 (defun bibtex-autokey-abbrev (string len) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2030 "Return an abbreviation of STRING with at least LEN characters. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2031 If LEN is positive the abbreviation is terminated only after a consonant |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2032 or at the word end. If LEN is negative the abbreviation is strictly |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2033 enforced using abs (LEN) characters. If LEN is not a number, STRING |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2034 is returned unchanged." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2035 (cond ((or (not (numberp len)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2036 (<= (length string) (abs len))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2037 string) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2038 ((equal len 0) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2039 "") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2040 ((< len 0) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2041 (substring string 0 (abs len))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2042 (t (let* ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2043 (abort-char (string-match "[^aeiou]" string (1- len)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2044 (if abort-char |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2045 (substring string 0 (1+ abort-char)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2046 string))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2047 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2048 (defun bibtex-autokey-get-field (field &optional change-list) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2049 "Get content of BibTeX field FIELD. Return empty string if not found. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2050 Optional arg CHANGE-LIST is a list of substitution patterns that is |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2051 applied to the content of FIELD. It is an alist with pairs |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2052 \(OLD-REGEXP . NEW-STRING\)." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2053 (let ((content (bibtex-text-in-field field bibtex-autokey-use-crossref)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2054 case-fold-search) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2055 (unless content (setq content "")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2056 (dolist (pattern change-list content) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2057 (setq content (replace-regexp-in-string (car pattern) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2058 (cdr pattern) |
57815 | 2059 content t))))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2060 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2061 (defun bibtex-autokey-get-names () |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2062 "Get contents of the name field of the current entry. |
57815 | 2063 Do some modifications based on `bibtex-autokey-name-change-strings'. |
2064 Return the names as a concatenated string obeying `bibtex-autokey-names' | |
2065 and `bibtex-autokey-names-stretch'." | |
2066 (let ((names (bibtex-autokey-get-field "author\\|editor" | |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2067 bibtex-autokey-name-change-strings))) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2068 ;; Some entries do not have a name field. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2069 (if (string= "" names) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2070 names |
57815 | 2071 (let* ((case-fold-search t) |
2072 (name-list (mapcar 'bibtex-autokey-demangle-name | |
2073 (split-string names "[ \t\n]+and[ \t\n]+"))) | |
2074 additional-names) | |
2075 (unless (or (not (numberp bibtex-autokey-names)) | |
2076 (<= (length name-list) | |
2077 (+ bibtex-autokey-names | |
2078 bibtex-autokey-names-stretch))) | |
2079 ;; Take bibtex-autokey-names elements from beginning of name-list | |
2080 (setq name-list (nreverse (nthcdr (- (length name-list) | |
2081 bibtex-autokey-names) | |
2082 (nreverse name-list))) | |
2083 additional-names bibtex-autokey-additional-names)) | |
2084 (concat (mapconcat 'identity name-list | |
2085 bibtex-autokey-name-separator) | |
2086 additional-names))))) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2087 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2088 (defun bibtex-autokey-demangle-name (fullname) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2089 "Get the last part from a well-formed FULLNAME and perform abbreviations." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2090 (let* (case-fold-search |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2091 (name (cond ((string-match "\\([A-Z][^, ]*\\)[^,]*," fullname) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2092 ;; Name is of the form "von Last, First" or |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2093 ;; "von Last, Jr, First" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2094 ;; --> Take the first capital part before the comma |
51416
83476384bebd
(bibtex-member-of-regexp, bibtex-assoc-of-regexp, bibtex-format-entry)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51415
diff
changeset
|
2095 (match-string 1 fullname)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2096 ((string-match "\\([^, ]*\\)," fullname) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2097 ;; Strange name: we have a comma, but nothing capital |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2098 ;; So we accept even lowercase names |
51416
83476384bebd
(bibtex-member-of-regexp, bibtex-assoc-of-regexp, bibtex-format-entry)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51415
diff
changeset
|
2099 (match-string 1 fullname)) |
83476384bebd
(bibtex-member-of-regexp, bibtex-assoc-of-regexp, bibtex-format-entry)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51415
diff
changeset
|
2100 ((string-match "\\(\\<[a-z][^ ]* +\\)+\\([A-Z][^ ]*\\)" |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2101 fullname) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2102 ;; name is of the form "First von Last", "von Last", |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2103 ;; "First von von Last", or "d'Last" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2104 ;; --> take the first capital part after the "von" parts |
51416
83476384bebd
(bibtex-member-of-regexp, bibtex-assoc-of-regexp, bibtex-format-entry)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51415
diff
changeset
|
2105 (match-string 2 fullname)) |
83476384bebd
(bibtex-member-of-regexp, bibtex-assoc-of-regexp, bibtex-format-entry)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51415
diff
changeset
|
2106 ((string-match "\\([^ ]+\\) *\\'" fullname) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2107 ;; name is of the form "First Middle Last" or "Last" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2108 ;; --> take the last token |
51416
83476384bebd
(bibtex-member-of-regexp, bibtex-assoc-of-regexp, bibtex-format-entry)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51415
diff
changeset
|
2109 (match-string 1 fullname)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2110 (t (error "Name `%s' is incorrectly formed" fullname))))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2111 (funcall bibtex-autokey-name-case-convert |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2112 (bibtex-autokey-abbrev name bibtex-autokey-name-length)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2113 |
57815 | 2114 (defun bibtex-autokey-get-year () |
2115 "Return year field contents as a string obeying `bibtex-autokey-year-length'." | |
2116 (let ((yearfield (bibtex-autokey-get-field "year"))) | |
2117 (substring yearfield (max 0 (- (length yearfield) | |
2118 bibtex-autokey-year-length))))) | |
2119 | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2120 (defun bibtex-autokey-get-title () |
57815 | 2121 "Get title field contents up to a terminator. |
2122 Return the result as a string" | |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2123 (let ((case-fold-search t) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2124 (titlestring |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2125 (bibtex-autokey-get-field "title" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2126 bibtex-autokey-titleword-change-strings))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2127 ;; ignore everything past a terminator |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2128 (if (string-match bibtex-autokey-title-terminators titlestring) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2129 (setq titlestring (substring titlestring 0 (match-beginning 0)))) |
57815 | 2130 ;; gather words from titlestring into a list. Ignore |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2131 ;; specific words and use only a specific amount of words. |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2132 (let ((counter 0) |
57815 | 2133 titlewords titlewords-extra word) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2134 (while (and (or (not (numberp bibtex-autokey-titlewords)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2135 (< counter (+ bibtex-autokey-titlewords |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2136 bibtex-autokey-titlewords-stretch))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2137 (string-match "\\b\\w+" titlestring)) |
57815 | 2138 (setq word (match-string 0 titlestring) |
2139 titlestring (substring titlestring (match-end 0))) | |
2140 ;; Ignore words matched by one of the elements of | |
2141 ;; bibtex-autokey-titleword-ignore | |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2142 (unless (let ((lst bibtex-autokey-titleword-ignore)) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2143 (while (and lst |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2144 (not (string-match (concat "\\`\\(?:" (car lst) |
57815 | 2145 "\\)\\'") word))) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2146 (setq lst (cdr lst))) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2147 lst) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2148 (setq counter (1+ counter)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2149 (if (or (not (numberp bibtex-autokey-titlewords)) |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
2150 (<= counter bibtex-autokey-titlewords)) |
57815 | 2151 (push word titlewords) |
2152 (push word titlewords-extra)))) | |
2153 ;; Obey bibtex-autokey-titlewords-stretch: | |
2154 ;; If by now we have processed all words in titlestring, we include | |
2155 ;; titlewords-extra in titlewords. Otherwise, we ignore titlewords-extra. | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2156 (unless (string-match "\\b\\w+" titlestring) |
57815 | 2157 (setq titlewords (append titlewords-extra titlewords))) |
2158 (mapconcat 'bibtex-autokey-demangle-title (nreverse titlewords) | |
2159 bibtex-autokey-titleword-separator)))) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2160 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2161 (defun bibtex-autokey-demangle-title (titleword) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2162 "Do some abbreviations on TITLEWORD. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2163 The rules are defined in `bibtex-autokey-titleword-abbrevs' |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2164 and `bibtex-autokey-titleword-length'." |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2165 (let ((case-fold-search t) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2166 (alist bibtex-autokey-titleword-abbrevs)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2167 (while (and alist |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2168 (not (string-match (concat "\\`\\(?:" (caar alist) "\\)\\'") |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2169 titleword))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2170 (setq alist (cdr alist))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2171 (if alist |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2172 (cdar alist) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2173 (funcall bibtex-autokey-titleword-case-convert |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2174 (bibtex-autokey-abbrev titleword bibtex-autokey-titleword-length))))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
2175 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
2176 (defun bibtex-generate-autokey () |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2177 "Generate automatically a key for a BibTeX entry. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2178 Use the author/editor, the year and the title field. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2179 The algorithm works as follows. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2180 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2181 The name part: |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2182 1. Use the author or editor field to generate the name part of the key. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2183 2. Change the content of the name field according to |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2184 `bibtex-autokey-name-change-strings' (see there for further detail). |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2185 3. Use the first `bibtex-autokey-names' names in the name field. If there |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2186 are up to `bibtex-autokey-names' + `bibtex-autokey-names-stretch' names, |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2187 use all names. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2188 4. Use only the last names to form the name part. From these last names, |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2189 take at least `bibtex-autokey-name-length' characters (truncate only |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2190 after a consonant or at a word end). |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2191 5. Convert all last names using the function |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
2192 `bibtex-autokey-name-case-convert'. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2193 6. Build the name part of the key by concatenating all abbreviated last |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2194 names with the string `bibtex-autokey-name-separator' between any two. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2195 If there are more names in the name field than names used in the name |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2196 part, append the string `bibtex-autokey-additional-names'. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2197 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2198 The year part: |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2199 1. Build the year part of the key by truncating the content of the year |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2200 field to the rightmost `bibtex-autokey-year-length' digits (useful |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2201 values are 2 and 4). |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2202 2. If the year field (or any other field required to generate the key) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2203 is absent, but the entry has a valid crossref field and |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2204 `bibtex-autokey-use-crossref' is non-nil, use the field of the |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2205 crossreferenced entry instead. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2206 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2207 The title part |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2208 1. Change the content of the title field according to |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2209 `bibtex-autokey-titleword-change-strings' (see there for further detail). |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2210 2. Truncate the title before the first match of |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2211 `bibtex-autokey-title-terminators' and delete those words which appear |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2212 in `bibtex-autokey-titleword-ignore'. Build the title part using the |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2213 first `bibtex-autokey-titlewords' words from this truncated title. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2214 If the truncated title ends after up to `bibtex-autokey-titlewords' + |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2215 `bibtex-autokey-titlewords-stretch' words, use all words from the |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2216 truncated title. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2217 3. For every title word that appears in `bibtex-autokey-titleword-abbrevs' |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2218 use the corresponding abbreviation (see documentation of this variable |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2219 for further detail). |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2220 4. From every title word not generated by an abbreviation, take at least |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2221 `bibtex-autokey-titleword-length' characters (truncate only after |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2222 a consonant or at a word end). |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2223 5. Convert all title words using the function |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
2224 `bibtex-autokey-titleword-case-convert'. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2225 6. Build the title part by concatenating all abbreviated title words with |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2226 the string `bibtex-autokey-titleword-separator' between any two. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2227 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2228 Concatenate the key: |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2229 1. Concatenate `bibtex-autokey-prefix-string', the name part, the year |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2230 part and the title part. If the name part and the year part are both |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2231 non-empty insert `bibtex-autokey-name-year-separator' between the two. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2232 If the title part and the year (or name) part are non-empty, insert |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2233 `bibtex-autokey-year-title-separator' between the two. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2234 2. If `bibtex-autokey-before-presentation-function' is non-nil, it must be |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2235 a function taking one argument. Call this function with the generated |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2236 key as the argument. Use the return value of this function (a string) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2237 as the key. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2238 3. If `bibtex-autokey-edit-before-use' is non-nil, present the key in the |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2239 minibuffer to the user for editing. Insert the key given by the user." |
57815 | 2240 (let* ((names (bibtex-autokey-get-names)) |
2241 (year (bibtex-autokey-get-year)) | |
2242 (title (bibtex-autokey-get-title)) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2243 (autokey (concat bibtex-autokey-prefix-string |
57815 | 2244 names |
2245 (unless (or (equal names "") | |
2246 (equal year "")) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2247 bibtex-autokey-name-year-separator) |
57815 | 2248 year |
2249 (unless (or (and (equal names "") | |
2250 (equal year "")) | |
2251 (equal title "")) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2252 bibtex-autokey-year-title-separator) |
57815 | 2253 title))) |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
2254 (if bibtex-autokey-before-presentation-function |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2255 (funcall bibtex-autokey-before-presentation-function autokey) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2256 autokey))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2257 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2258 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2259 (defun bibtex-global-key-alist () |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2260 "Return global key alist based on `bibtex-files'." |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2261 (if bibtex-files |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2262 (apply 'append |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2263 (mapcar (lambda (buf) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2264 (with-current-buffer buf bibtex-reference-keys)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2265 (bibtex-files-expand t))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2266 bibtex-reference-keys)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2267 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2268 (defun bibtex-read-key (prompt &optional key global) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2269 "Read BibTeX key from minibuffer using PROMPT and default KEY. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2270 If optional arg GLOBAL is non-nil, completion is based on the keys in |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2271 `bibtex-reference-keys' of `bibtex-files'," |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2272 (let (completion-ignore-case) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2273 (completing-read prompt (if global (bibtex-global-key-alist) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2274 bibtex-reference-keys) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2275 nil nil key 'bibtex-key-history))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2276 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2277 (defun bibtex-read-string-key (&optional key) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2278 "Read BibTeX string key from minibuffer using default KEY." |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2279 (let ((completion-ignore-case t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2280 (completing-read "String key: " bibtex-strings |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2281 nil nil key 'bibtex-key-history))) |
57815 | 2282 |
2283 (defun bibtex-parse-keys (&optional abortable verbose) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2284 "Set `bibtex-reference-keys' to the keys used in the whole buffer. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2285 Find both entry keys and crossref entries. If ABORTABLE is non-nil abort |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2286 on user input. If VERBOSE is non-nil give messages about progress. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2287 Return alist of keys if parsing was completed, `aborted' otherwise." |
57815 | 2288 (let (ref-keys crossref-keys) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2289 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2290 (save-match-data |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2291 (if verbose |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2292 (bibtex-progress-message |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2293 (concat (buffer-name) ": parsing reference keys"))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2294 (catch 'userkey |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2295 (goto-char (point-min)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2296 (if bibtex-parse-keys-fast |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2297 (let ((case-fold-search t) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2298 (re (concat bibtex-entry-head "\\|" |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2299 ",[ \t\n]*crossref[ \t\n]*=[ \t\n]*" |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2300 "\\(\"[^\"]*\"\\|{[^}]*}\\)[ \t\n]*[,})]"))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2301 (while (re-search-forward re nil t) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2302 (if (and abortable (input-pending-p)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2303 ;; user has aborted by typing a key --> return `aborted' |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2304 (throw 'userkey 'aborted)) |
57815 | 2305 (cond ((match-end 3) |
2306 ;; This is a crossref. | |
2307 (let ((key (buffer-substring-no-properties | |
2308 (1+ (match-beginning 3)) (1- (match-end 3))))) | |
2309 (unless (assoc key crossref-keys) | |
2310 (push (list key) crossref-keys)))) | |
2311 ;; only keys of known entries | |
2312 ((assoc-string (bibtex-type-in-head) | |
2313 bibtex-entry-field-alist t) | |
2314 ;; This is an entry. | |
2315 (let ((key (bibtex-key-in-head))) | |
2316 (unless (assoc key ref-keys) | |
2317 (push (cons key t) ref-keys))))))) | |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2318 |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2319 (let (;; ignore @String entries because they are handled |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2320 ;; separately by bibtex-parse-strings |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2321 (bibtex-sort-ignore-string-entries t) |
57815 | 2322 bounds) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2323 (bibtex-map-entries |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2324 (lambda (key beg end) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2325 (if (and abortable |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2326 (input-pending-p)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2327 ;; user has aborted by typing a key --> return `aborted' |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2328 (throw 'userkey 'aborted)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2329 (if verbose (bibtex-progress-message)) |
57815 | 2330 (unless (assoc key ref-keys) |
2331 (push (cons key t) ref-keys)) | |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2332 (if (and (setq bounds (bibtex-search-forward-field "crossref" end)) |
57815 | 2333 (setq key (bibtex-text-in-field-bounds bounds t)) |
2334 (not (assoc key crossref-keys))) | |
2335 (push (list key) crossref-keys)))))) | |
2336 | |
2337 (dolist (key crossref-keys) | |
2338 (unless (assoc (car key) ref-keys) (push key ref-keys))) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2339 (if verbose |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2340 (bibtex-progress-message 'done)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2341 ;; successful operation --> return `bibtex-reference-keys' |
57815 | 2342 (setq bibtex-reference-keys ref-keys)))))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2343 |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2344 (defun bibtex-parse-strings (&optional add abortable) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2345 "Set `bibtex-strings' to the string definitions in the whole buffer. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2346 If ADD is non-nil add the new strings to `bibtex-strings' instead of |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2347 simply resetting it. If ADD is an alist of strings, also add ADD to |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2348 `bibtex-strings'. If ABORTABLE is non-nil abort on user input. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2349 Return alist of strings if parsing was completed, `aborted' otherwise." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2350 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2351 (save-match-data |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2352 (goto-char (point-min)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2353 (let ((strings (if (and add |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2354 (listp bibtex-strings)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2355 bibtex-strings)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2356 bounds key) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2357 (if (listp add) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2358 (dolist (string add) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2359 (unless (assoc-string (car string) strings t) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2360 (push string strings)))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2361 (catch 'userkey |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2362 (while (setq bounds (bibtex-search-forward-string)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2363 (if (and abortable |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2364 (input-pending-p)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2365 ;; user has aborted by typing a key --> return `aborted' |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2366 (throw 'userkey 'aborted)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2367 (setq key (bibtex-reference-key-in-string bounds)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2368 (unless (assoc-string key strings t) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2369 (push (cons key (bibtex-text-in-string bounds t)) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2370 strings)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2371 (goto-char (bibtex-end-of-text-in-string bounds))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2372 ;; successful operation --> return `bibtex-strings' |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2373 (setq bibtex-strings strings)))))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2374 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2375 (defun bibtex-string-files-init () |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2376 "Return initialization for `bibtex-strings'. |
57815 | 2377 Use `bibtex-predefined-strings' and BibTeX files `bibtex-string-files'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2378 (save-match-data |
57815 | 2379 (let ((dirlist (split-string (or bibtex-string-file-path default-directory) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2380 ":+")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2381 (case-fold-search) |
57815 | 2382 string-files fullfilename compl bounds found) |
2383 ;; collect absolute file names of valid string files | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2384 (dolist (filename bibtex-string-files) |
51416
83476384bebd
(bibtex-member-of-regexp, bibtex-assoc-of-regexp, bibtex-format-entry)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51415
diff
changeset
|
2385 (unless (string-match "\\.bib\\'" filename) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2386 (setq filename (concat filename ".bib"))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2387 ;; test filenames |
57815 | 2388 (if (file-name-absolute-p filename) |
2389 (if (file-readable-p filename) | |
2390 (push filename string-files) | |
2391 (error "BibTeX strings file %s not found" filename)) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2392 (dolist (dir dirlist) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2393 (when (file-readable-p |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2394 (setq fullfilename (expand-file-name filename dir))) |
57815 | 2395 (push fullfilename string-files) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2396 (setq found t))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2397 (unless found |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2398 (error "File %s not in paths defined via bibtex-string-file-path" |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2399 filename)))) |
57815 | 2400 ;; parse string files |
2401 (dolist (filename string-files) | |
2402 (with-temp-buffer | |
2403 (insert-file-contents filename) | |
2404 (goto-char (point-min)) | |
2405 (while (setq bounds (bibtex-search-forward-string)) | |
2406 (push (cons (bibtex-reference-key-in-string bounds) | |
2407 (bibtex-text-in-string bounds t)) | |
2408 compl) | |
2409 (goto-char (bibtex-end-of-string bounds))))) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2410 (append bibtex-predefined-strings (nreverse compl))))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
2411 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2412 (defun bibtex-parse-buffers-stealthily () |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2413 "Parse buffer in the background during idle time. |
57815 | 2414 Called by `run-with-idle-timer'. Whenever Emacs has been idle |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2415 for `bibtex-parse-keys-timeout' seconds, parse all BibTeX buffers |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2416 which have been modified after last parsing. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2417 Parsing initializes `bibtex-reference-keys' and `bibtex-strings'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2418 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2419 (let ((buffers (buffer-list)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2420 (strings-init (bibtex-string-files-init))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2421 (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
|
2422 (set-buffer (car buffers)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2423 (if (and (eq major-mode 'bibtex-mode) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2424 (not (eq (buffer-modified-tick) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2425 bibtex-buffer-last-parsed-tick))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2426 (save-restriction |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2427 (widen) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2428 ;; Output no progress messages in bibtex-parse-keys |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2429 ;; because when in y-or-n-p that can hide the question. |
57815 | 2430 (if (and (listp (bibtex-parse-keys t)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2431 ;; update bibtex-strings |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2432 (listp (bibtex-parse-strings strings-init t))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2433 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2434 ;; remember that parsing was successful |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2435 (setq bibtex-buffer-last-parsed-tick (buffer-modified-tick))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2436 (setq buffers (cdr buffers)))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2437 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2438 (defun bibtex-files-expand (&optional current force) |
57815 | 2439 "Return an expanded list of BibTeX buffers based on `bibtex-files'. |
2440 Initialize in these buffers `bibtex-reference-keys' if not yet set. | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2441 List of BibTeX buffers includes current buffer if CURRENT is non-nil. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2442 If FORCE is non-nil, (re)initialize `bibtex-reference-keys' even if |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2443 already set." |
57815 | 2444 (let ((file-path (split-string (or bibtex-file-path default-directory) ":+")) |
2445 file-list dir-list buffer-list) | |
2446 (dolist (file bibtex-files) | |
2447 (cond ((eq file 'bibtex-file-path) | |
2448 (setq dir-list (append dir-list file-path))) | |
2449 ((file-accessible-directory-p file) | |
2450 (push file dir-list)) | |
2451 ((progn (unless (string-match "\\.bib\\'" file) | |
2452 (setq file (concat file ".bib"))) | |
2453 (file-name-absolute-p file)) | |
2454 (push file file-list)) | |
2455 (t | |
2456 (let (fullfilename found) | |
2457 (dolist (dir file-path) | |
2458 (when (file-readable-p | |
2459 (setq fullfilename (expand-file-name file dir))) | |
2460 (push fullfilename file-list) | |
2461 (setq found t))) | |
2462 (unless found | |
2463 (error "File %s not in paths defined via bibtex-file-path" | |
2464 file)))))) | |
2465 (dolist (file file-list) | |
2466 (unless (file-readable-p file) | |
2467 (error "BibTeX file %s not found" file))) | |
2468 ;; expand dir-list | |
2469 (dolist (dir dir-list) | |
2470 (setq file-list | |
2471 (append file-list (directory-files dir t "\\.bib\\'" t)))) | |
2472 (delete-dups file-list) | |
2473 (dolist (file file-list) | |
2474 (when (file-readable-p file) | |
2475 (push (find-file-noselect file) buffer-list) | |
2476 (with-current-buffer (car buffer-list) | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2477 (if (or force (not (listp bibtex-reference-keys))) |
57815 | 2478 (bibtex-parse-keys))))) |
2479 (cond ((and current (not (memq (current-buffer) buffer-list))) | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2480 (push (current-buffer) buffer-list) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2481 (if force (bibtex-parse-keys))) |
57815 | 2482 ((and (not current) (memq (current-buffer) buffer-list)) |
2483 (setq buffer-list (delq (current-buffer) buffer-list)))) | |
2484 buffer-list)) | |
2485 | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2486 (defun bibtex-complete-internal (completions) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2487 "Complete word fragment before point to longest prefix of COMPLETIONS. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2488 COMPLETIONS is an alist of strings. If point is not after the part |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2489 of a word, all strings are listed. Return completion." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2490 (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
|
2491 (beg (save-excursion |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2492 (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
|
2493 (forward-char) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2494 (point))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2495 (end (point)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2496 (part-of-word (buffer-substring-no-properties beg end)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2497 (completion (try-completion part-of-word completions))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2498 (cond ((not completion) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2499 (error "Can't find completion for `%s'" part-of-word)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2500 ((eq completion t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2501 part-of-word) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2502 ((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
|
2503 (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
|
2504 (insert completion) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2505 completion) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2506 (t |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2507 (message "Making completion list...") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2508 (with-output-to-temp-buffer "*Completions*" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2509 (display-completion-list (all-completions part-of-word |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2510 completions))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2511 (message "Making completion list...done") |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2512 ;; return value is handled by choose-completion-string-functions |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2513 nil)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2514 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2515 (defun bibtex-complete-string-cleanup (str compl) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2516 "Cleanup after inserting string STR. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2517 Remove enclosing field delimiters for STR. Display message with |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2518 expansion of STR using expansion list COMPL." |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2519 (save-excursion |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2520 (bibtex-inside-field) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2521 (let ((bounds (bibtex-enclosing-field)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2522 (abbr (cdr (if (stringp str) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2523 (assoc-string str compl t))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2524 (if abbr (message "Abbreviation for `%s'" abbr)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2525 (goto-char (bibtex-start-of-text-in-field bounds)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2526 (let ((boundaries (bibtex-parse-field-string))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2527 (if (and boundaries |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2528 (equal (cdr boundaries) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2529 (bibtex-end-of-text-in-field bounds))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2530 (bibtex-remove-delimiters)))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2531 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2532 (defun bibtex-complete-crossref-cleanup (key) |
57815 | 2533 "Display summary message on entry KEY after completion of a crossref key. |
2534 Use `bibtex-summary-function' to generate summary." | |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2535 (save-excursion |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2536 (if (and (stringp key) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2537 (bibtex-find-entry key t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2538 (message "Ref: %s" (funcall bibtex-summary-function key))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2539 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2540 (defun bibtex-copy-summary-as-kill () |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2541 "Push summery of current BibTeX entry to kill ring. |
57815 | 2542 Use `bibtex-summary-function' to generate summary." |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2543 (interactive) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2544 (let ((key (save-excursion |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2545 (bibtex-beginning-of-entry) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2546 (if (looking-at bibtex-entry-maybe-empty-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2547 (bibtex-key-in-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2548 (error "No key found"))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2549 (kill-new (message "%s" (funcall bibtex-summary-function key))))) |
57815 | 2550 |
2551 (defun bibtex-summary (key) | |
2552 "Return summary of BibTeX entry KEY. | |
2553 Used as default value of `bibtex-summary-function'." | |
2554 ;; It would be neat to customize this function. How? | |
2555 (save-excursion | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2556 (if (bibtex-find-entry key t) |
57815 | 2557 (let* ((bibtex-autokey-name-case-convert 'identity) |
2558 (bibtex-autokey-name-length 'infty) | |
2559 (bibtex-autokey-names 1) | |
2560 (bibtex-autokey-names-stretch 0) | |
2561 (bibtex-autokey-name-separator " ") | |
2562 (bibtex-autokey-additional-names " etal") | |
2563 (names (bibtex-autokey-get-names)) | |
2564 (bibtex-autokey-year-length 4) | |
2565 (year (bibtex-autokey-get-year)) | |
2566 (bibtex-autokey-titlewords 5) | |
2567 (bibtex-autokey-titlewords-stretch 2) | |
2568 (bibtex-autokey-titleword-case-convert 'identity) | |
2569 (bibtex-autokey-titleword-length 5) | |
2570 (bibtex-autokey-titleword-separator " ") | |
2571 (title (bibtex-autokey-get-title)) | |
2572 (journal (bibtex-autokey-get-field | |
2573 "journal" bibtex-autokey-transcriptions)) | |
2574 (volume (bibtex-autokey-get-field "volume")) | |
2575 (pages (bibtex-autokey-get-field "pages" '(("-.*\\'" . ""))))) | |
2576 (mapconcat (lambda (arg) | |
2577 (if (not (string= "" (cdr arg))) | |
2578 (concat (car arg) (cdr arg)))) | |
2579 `((" " . ,names) (" " . ,year) (": " . ,title) | |
2580 (", " . ,journal) (" " . ,volume) (":" . ,pages)) | |
2581 "")) | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2582 (error "Key `%s' not found" key)))) |
257 | 2583 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2584 (defun bibtex-pop (arg direction) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2585 "Fill current field from the ARGth same field's text in DIRECTION. |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2586 Generic function used by `bibtex-pop-previous' and `bibtex-pop-next'." |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2587 (let (bibtex-help-message) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2588 (bibtex-find-text)) |
257 | 2589 (save-excursion |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2590 ;; parse current field |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2591 (bibtex-inside-field) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
2592 (let* ((case-fold-search t) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2593 (bounds (bibtex-enclosing-field)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2594 (start-old-text (bibtex-start-of-text-in-field bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2595 (stop-old-text (bibtex-end-of-text-in-field bounds)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2596 (field-name (bibtex-name-in-field bounds t))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2597 ;; if executed several times in a row, start each search where |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2598 ;; the last one was finished |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2599 (unless (eq last-command 'bibtex-pop) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2600 (bibtex-enclosing-entry-maybe-empty-head) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2601 (setq bibtex-pop-previous-search-point (match-beginning 0) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2602 bibtex-pop-next-search-point (point))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2603 (if (eq direction 'previous) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2604 (goto-char bibtex-pop-previous-search-point) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2605 (goto-char bibtex-pop-next-search-point)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2606 ;; Now search for arg'th previous/next similar field |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2607 (let (bounds failure new-text) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2608 (while (and (not failure) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2609 (> arg 0)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2610 (cond ((eq direction 'previous) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2611 (if (setq bounds (bibtex-search-backward-field field-name)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2612 (goto-char (bibtex-start-of-field bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2613 (setq failure t))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2614 ((eq direction 'next) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2615 (if (setq bounds (bibtex-search-forward-field field-name)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2616 (goto-char (bibtex-end-of-field bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2617 (setq failure t)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2618 (setq arg (- arg 1))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2619 (if failure |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2620 (error "No %s matching BibTeX field" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2621 (if (eq direction 'previous) "previous" "next")) |
57815 | 2622 ;; Found a matching field. Remember boundaries. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2623 (setq bibtex-pop-previous-search-point (bibtex-start-of-field bounds) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2624 bibtex-pop-next-search-point (bibtex-end-of-field bounds) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2625 new-text (bibtex-text-in-field-bounds bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2626 (bibtex-flash-head) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2627 ;; Go back to where we started, delete old text, and pop new. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2628 (goto-char stop-old-text) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2629 (delete-region start-old-text stop-old-text) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2630 (insert new-text))))) |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2631 (let (bibtex-help-message) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2632 (bibtex-find-text)) |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2633 (setq this-command 'bibtex-pop)) |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
2634 |
57815 | 2635 (defun bibtex-beginning-of-field () |
2636 "Move point backward to beginning of field. | |
2637 This function uses a simple, fast algorithm assuming that the field | |
2638 begins at the beginning of a line. We use this function for font-locking." | |
2639 (let ((field-reg (concat "^[ \t]*" bibtex-field-name "[ \t]*="))) | |
2640 (beginning-of-line) | |
2641 (unless (looking-at field-reg) | |
2642 (re-search-backward field-reg nil t)))) | |
2643 | |
2644 (defun bibtex-font-lock-url (bound) | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2645 "Font-lock for URLs. BOUND limits the search." |
57815 | 2646 (let ((case-fold-search t) |
2647 (pnt (point)) | |
2648 field bounds start end found) | |
2649 (bibtex-beginning-of-field) | |
2650 (while (and (not found) | |
2651 (prog1 (re-search-forward bibtex-font-lock-url-regexp bound t) | |
2652 (setq field (match-string-no-properties 1))) | |
2653 (setq bounds (bibtex-parse-field-text)) | |
2654 (progn | |
2655 (setq start (car bounds) end (cdr bounds)) | |
2656 ;; Always ignore field delimiters | |
2657 (if (memq (char-before end) '(?\} ?\")) | |
2658 (setq end (1- end))) | |
2659 (if (memq (char-after start) '(?\{ ?\")) | |
2660 (setq start (1+ start))) | |
2661 (>= bound start))) | |
2662 (let ((lst bibtex-generate-url-list) url) | |
2663 (goto-char start) | |
2664 (while (and (not found) | |
2665 (setq url (caar lst))) | |
2666 (setq found (and (bibtex-string= field (car url)) | |
2667 (re-search-forward (cdr url) end t) | |
2668 (>= (match-beginning 0) pnt)) | |
2669 lst (cdr lst)))) | |
2670 (goto-char end)) | |
2671 (if found (bibtex-button (match-beginning 0) (match-end 0) | |
2672 'bibtex-url (match-beginning 0))) | |
2673 found)) | |
2674 | |
2675 (defun bibtex-font-lock-crossref (bound) | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2676 "Font-lock for crossref fields. BOUND limits the search." |
57815 | 2677 (let ((case-fold-search t) |
2678 (pnt (point)) | |
2679 (crossref-reg (concat "^[ \t]*crossref[ \t]*=[ \t\n]*" | |
2680 "\\(\"[^\"]*\"\\|{[^}]*}\\)[ \t\n]*[,})]")) | |
2681 start end found) | |
2682 (bibtex-beginning-of-field) | |
2683 (while (and (not found) | |
2684 (re-search-forward crossref-reg bound t)) | |
2685 (setq start (1+ (match-beginning 1)) | |
2686 end (1- (match-end 1)) | |
2687 found (>= start pnt))) | |
2688 (if found (bibtex-button start end 'bibtex-find-crossref | |
2689 (buffer-substring-no-properties start end) | |
2690 start t)) | |
2691 found)) | |
2692 | |
2693 (defun bibtex-button-action (button) | |
2694 "Call BUTTON's BibTeX function." | |
2695 (apply (button-get button 'bibtex-function) | |
2696 (button-get button 'bibtex-args))) | |
2697 | |
2698 (define-button-type 'bibtex-url | |
2699 'action 'bibtex-button-action | |
2700 'bibtex-function 'bibtex-url | |
2701 'help-echo (purecopy "mouse-2, RET: follow URL")) | |
2702 | |
2703 (define-button-type 'bibtex-find-crossref | |
2704 'action 'bibtex-button-action | |
2705 'bibtex-function 'bibtex-find-crossref | |
2706 'help-echo (purecopy "mouse-2, RET: follow crossref")) | |
2707 | |
2708 (defun bibtex-button (beg end type &rest args) | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2709 "Make a BibTeX button from BEG to END of type TYPE in the current buffer." |
57815 | 2710 (make-text-button beg end 'type type 'bibtex-args args)) |
2711 | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2712 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2713 ;; Interactive Functions: |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2714 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2715 ;;;###autoload |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2716 (defun bibtex-mode () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2717 "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
|
2718 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2719 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
|
2720 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2721 Use commands such as \\[bibtex-Book] to get a template for a specific entry. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2722 Then fill in all desired fields using \\[bibtex-next-field] to jump from field |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2723 to field. After having filled in all desired fields in the entry, clean the |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2724 new entry with the command \\[bibtex-clean-entry]. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2725 |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2726 Some features of BibTeX mode are available only by setting the variable |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
2727 `bibtex-maintain-sorted-entries' to non-nil. However, then BibTeX mode |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
2728 works only with buffers containing valid (syntactical correct) and sorted |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
2729 entries. This is usually the case, if you have created a buffer completely |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
2730 with BibTeX mode and finished every new entry with \\[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
|
2731 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2732 For third party BibTeX files, call the function `bibtex-convert-alien' |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2733 to fully take advantage of all features of BibTeX mode. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2734 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2735 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2736 Special information: |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2737 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
2738 A command such as \\[bibtex-Book] outlines the fields for a BibTeX book entry. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2739 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2740 The names of optional fields start with the string OPT, and are thus ignored |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2741 by BibTeX. The names of alternative fields from which only one is required |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2742 start with the string ALT. The OPT or ALT string may be removed from |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2743 the name of a field with \\[bibtex-remove-OPT-or-ALT]. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2744 \\[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
|
2745 \\[bibtex-kill-field] kills the current field entirely. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2746 \\[bibtex-yank] yanks the last recently killed field after the current field. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2747 \\[bibtex-remove-delimiters] removes the double-quotes or braces around the text of the current field. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2748 \\[bibtex-empty-field] replaces the text of the current field with the default \"\" or {}. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2749 \\[bibtex-find-text] moves point to the end of the current field. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2750 \\[bibtex-complete] completes word fragment before point according to context. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2751 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2752 The command \\[bibtex-clean-entry] cleans the current entry, i.e. it removes OPT/ALT |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2753 from the names of all non-empty optional or alternative fields, checks that |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2754 no required fields are empty, and does some formatting dependent on the value |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2755 of `bibtex-entry-format'. Furthermore, it can automatically generate a key |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2756 for the BibTeX entry, see `bibtex-generate-autokey'. |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
2757 Note: some functions in BibTeX mode depend on entries being in a special |
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
2758 format (all fields beginning on separate lines), so it is usually a bad |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2759 idea to remove `realign' from `bibtex-entry-format'. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2760 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2761 BibTeX mode supports Imenu and hideshow minor mode (`hs-minor-mode'). |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2762 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2763 ---------------------------------------------------------- |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2764 Entry to BibTeX mode calls the value of `bibtex-mode-hook' |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2765 if that value is non-nil. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2766 |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
2767 \\{bibtex-mode-map}" |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2768 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2769 (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
|
2770 (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
|
2771 (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
|
2772 (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
|
2773 (set-syntax-table bibtex-mode-syntax-table) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2774 (make-local-variable 'bibtex-buffer-last-parsed-tick) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2775 ;; Install stealthy parse function if not already installed |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2776 (unless bibtex-parse-idle-timer |
57815 | 2777 (setq bibtex-parse-idle-timer (run-with-idle-timer |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2778 bibtex-parse-keys-timeout t |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2779 'bibtex-parse-buffers-stealthily))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2780 (set (make-local-variable 'paragraph-start) "[ \f\n\t]*$") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2781 (set (make-local-variable 'comment-start) bibtex-comment-start) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2782 (set (make-local-variable 'comment-start-skip) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2783 (concat (regexp-quote bibtex-comment-start) "\\>[ \t]*")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2784 (set (make-local-variable 'comment-column) 0) |
51416
83476384bebd
(bibtex-member-of-regexp, bibtex-assoc-of-regexp, bibtex-format-entry)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51415
diff
changeset
|
2785 (set (make-local-variable 'defun-prompt-regexp) "^[ \t]*@[a-zA-Z0-9]+[ \t]*") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2786 (set (make-local-variable 'outline-regexp) "[ \t]*@") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2787 (set (make-local-variable 'fill-paragraph-function) 'bibtex-fill-field) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2788 (set (make-local-variable 'fill-prefix) (make-string (+ bibtex-entry-offset |
57815 | 2789 bibtex-contline-indentation) |
2790 ? )) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2791 (set (make-local-variable 'font-lock-defaults) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2792 '(bibtex-font-lock-keywords |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2793 nil t ((?$ . "\"") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2794 ;; Mathematical expressions should be fontified as strings |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2795 (?\" . ".") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2796 ;; Quotes are field delimiters and quote-delimited |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2797 ;; entries should be fontified in the same way as |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2798 ;; brace-delimited ones |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2799 ) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2800 nil |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2801 (font-lock-syntactic-keywords . bibtex-font-lock-syntactic-keywords) |
57815 | 2802 (font-lock-extra-managed-props . (category)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2803 (font-lock-mark-block-function |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2804 . (lambda () |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2805 (set-mark (bibtex-end-of-entry)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2806 (bibtex-beginning-of-entry))))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2807 (setq imenu-generic-expression |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2808 (list (list nil bibtex-entry-head bibtex-key-in-head)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2809 imenu-case-fold-search t) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2810 (make-local-variable 'choose-completion-string-functions) |
20907
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
2811 ;; XEmacs needs easy-menu-add, Emacs does not care |
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
2812 (easy-menu-add bibtex-edit-menu) |
9a55a557cb5a
(bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents:
20866
diff
changeset
|
2813 (easy-menu-add bibtex-entry-menu) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2814 (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
|
2815 |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2816 (defun bibtex-field-list (entry-type) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2817 "Return list of allowed fields for entry ENTRY-TYPE. |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2818 More specifically, the return value is a cons pair (REQUIRED . OPTIONAL), |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2819 where REQUIRED and OPTIONAL are lists of the required and optional field |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2820 names for ENTRY-TYPE according to `bibtex-entry-field-alist', |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2821 `bibtex-include-OPTkey', `bibtex-include-OPTcrossref', |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2822 and `bibtex-user-optional-fields'." |
55730
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
2823 (let ((e (assoc-string entry-type bibtex-entry-field-alist t)) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2824 required optional) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2825 (unless e |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
2826 (error "BibTeX entry type %s not defined" entry-type)) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2827 (if (and (member-ignore-case entry-type bibtex-include-OPTcrossref) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2828 (nth 2 e)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2829 (setq required (nth 0 (nth 2 e)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2830 optional (nth 1 (nth 2 e))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2831 (setq required (nth 0 (nth 1 e)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2832 optional (nth 1 (nth 1 e)))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2833 (if bibtex-include-OPTkey |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2834 (push (list "key" |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2835 "Used for reference key creation if author and editor fields are missing" |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2836 (if (or (stringp bibtex-include-OPTkey) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2837 (fboundp bibtex-include-OPTkey)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2838 bibtex-include-OPTkey)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2839 optional)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2840 (if (member-ignore-case entry-type bibtex-include-OPTcrossref) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2841 (push '("crossref" "Reference key of the cross-referenced entry") |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2842 optional)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2843 (setq optional (append optional bibtex-user-optional-fields)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2844 (cons required optional))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2845 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2846 (defun bibtex-entry (entry-type) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2847 "Insert a new BibTeX entry of type ENTRY-TYPE. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2848 After insertion call the value of `bibtex-add-entry-hook' if that value |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2849 is non-nil." |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2850 (interactive |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2851 (let ((completion-ignore-case t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2852 (list (completing-read "Entry Type: " bibtex-entry-field-alist |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2853 nil t nil 'bibtex-entry-type-history)))) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2854 (let ((key (if bibtex-maintain-sorted-entries |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2855 (bibtex-read-key (format "%s key: " entry-type)))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2856 (field-list (bibtex-field-list entry-type))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2857 (unless (bibtex-prepare-new-entry (list key nil entry-type)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2858 (error "Entry with key `%s' already exists" key)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2859 (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
|
2860 (insert "@" entry-type (bibtex-entry-left-delimiter)) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2861 (if key (insert key)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2862 (save-excursion |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2863 (mapc 'bibtex-make-field (car field-list)) |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
2864 (mapc 'bibtex-make-optional-field (cdr field-list)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2865 (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
|
2866 (insert ",")) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2867 (insert "\n") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2868 (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
|
2869 (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
|
2870 (bibtex-next-field t) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2871 (if (member-ignore-case entry-type bibtex-autofill-types) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2872 (bibtex-autofill-entry)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2873 (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
|
2874 |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2875 (defun bibtex-entry-update () |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2876 "Update an existing BibTeX entry. |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2877 In the BibTeX entry at point, make new fields for those items that may occur |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2878 according to `bibtex-field-list', but are not yet present." |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2879 (interactive) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2880 (save-excursion |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2881 (bibtex-beginning-of-entry) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2882 ;; For inserting new fields, we use the fact that |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2883 ;; bibtex-parse-entry moves point to the end of the last field. |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2884 (let* ((fields-alist (bibtex-parse-entry)) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2885 (field-list (bibtex-field-list |
57815 | 2886 (cdr (assoc "=type=" fields-alist))))) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2887 (dolist (field (car field-list)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2888 (unless (assoc-string (car field) fields-alist t) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2889 (bibtex-make-field field))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2890 (dolist (field (cdr field-list)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2891 (unless (assoc-string (car field) fields-alist t) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2892 (bibtex-make-optional-field field)))))) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2893 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2894 (defun bibtex-parse-entry () |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2895 "Parse entry at point, return an alist. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2896 The alist elements have the form (FIELD . TEXT), where FIELD can also be |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2897 the special strings \"=type=\" and \"=key=\". For the FIELD \"=key=\" |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2898 TEXT may be nil. Remove \"OPT\" and \"ALT\" from FIELD. |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2899 Move point to the end of the last field." |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2900 (let (alist bounds) |
55880
1b2cb608f18e
(bibtex-format-entry): Fix regexps.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55730
diff
changeset
|
2901 (when (looking-at bibtex-entry-maybe-empty-head) |
57815 | 2902 (push (cons "=type=" (bibtex-type-in-head)) alist) |
2903 (push (cons "=key=" (bibtex-key-in-head)) alist) | |
55880
1b2cb608f18e
(bibtex-format-entry): Fix regexps.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55730
diff
changeset
|
2904 (goto-char (match-end 0)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2905 (while (setq bounds (bibtex-parse-field bibtex-field-name)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2906 (push (cons (bibtex-name-in-field bounds t) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2907 (bibtex-text-in-field-bounds bounds)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2908 alist) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2909 (goto-char (bibtex-end-of-field bounds)))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2910 alist)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2911 |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2912 (defun bibtex-autofill-entry () |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2913 "Try to fill fields of current BibTeX entry based on neighboring entries. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2914 The current entry must have a key. Determine the neighboring entry |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2915 \(previouse or next\) whose key is more similar to the key of the current |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2916 entry. For all empty fields of the current entry insert the corresponding |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2917 field contents of the neighboring entry. Finally try to update the text |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2918 based on the difference between the keys of the neighboring and the current |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2919 entry (for example, the year parts of the keys)." |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2920 (interactive) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2921 (undo-boundary) ;So you can easily undo it, if it didn't work right. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2922 (bibtex-beginning-of-entry) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2923 (when (looking-at bibtex-entry-head) |
57815 | 2924 (let ((type (bibtex-type-in-head)) |
2925 (key (bibtex-key-in-head)) | |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2926 (key-end (match-end bibtex-key-in-head)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2927 (case-fold-search t) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2928 tmp other-key other bounds) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2929 ;; The fields we want to change start right after the key. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2930 (goto-char key-end) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2931 ;; First see whether to use the previous or the next entry |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2932 ;; for "inspiration". |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2933 (save-excursion |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2934 (goto-char (1- (match-beginning 0))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2935 (bibtex-beginning-of-entry) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2936 (if (and (looking-at bibtex-entry-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2937 (bibtex-string= type (bibtex-type-in-head)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2938 ;; In case we found ourselves :-( |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2939 (not (equal key (setq tmp (bibtex-key-in-head))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2940 (setq other-key tmp |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2941 other (point)))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2942 (save-excursion |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2943 (bibtex-end-of-entry) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2944 (bibtex-skip-to-valid-entry) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2945 (if (and (looking-at bibtex-entry-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2946 (bibtex-string= type (bibtex-type-in-head)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2947 ;; In case we found ourselves :-( |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2948 (not (equal key (setq tmp (bibtex-key-in-head)))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2949 (or (not other-key) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2950 ;; Check which is the best match. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2951 (< (length (try-completion "" (list key other-key))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2952 (length (try-completion "" (list key tmp)))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2953 (setq other-key tmp |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
2954 other (point)))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2955 ;; Then fill the new entry's fields with the chosen other entry. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2956 (when other |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2957 (setq other (save-excursion (goto-char other) (bibtex-parse-entry))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2958 (setq key-end (point)) ;In case parse-entry changed the buffer. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2959 (while (setq bounds (bibtex-parse-field bibtex-field-name)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2960 (let ((text (assoc-string (bibtex-name-in-field bounds t) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2961 other t))) |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
2962 (if (not (and text |
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
2963 (string-match bibtex-empty-field-re |
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
2964 (buffer-substring-no-properties |
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
2965 (bibtex-start-of-text-in-field bounds) |
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
2966 (bibtex-end-of-text-in-field bounds))))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2967 (goto-char (bibtex-end-of-field bounds)) |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
2968 (goto-char (bibtex-start-of-text-in-field bounds)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2969 (delete-region (point) (bibtex-end-of-text-in-field bounds)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2970 (insert (cdr text))))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2971 ;; Finally try to update the text based on the difference between |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2972 ;; the two keys. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2973 (let* ((prefix (try-completion "" (list key other-key))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2974 ;; If the keys are foo91 and foo92, don't replace 1 for 2 |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2975 ;; but 91 for 92 instead. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2976 (_ (if (string-match "[0-9]+\\'" prefix) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2977 (setq prefix (substring prefix 0 (match-beginning 0))))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2978 (suffix (substring key (length prefix))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2979 (other-suffix (substring other-key (length prefix)))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2980 (while (re-search-backward (regexp-quote other-suffix) key-end 'move) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2981 (replace-match suffix))))))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
2982 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2983 (defun bibtex-print-help-message () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2984 "Print helpful information about current field in current BibTeX entry." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2985 (interactive) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2986 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2987 (let* ((case-fold-search t) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
2988 (field-name (bibtex-name-in-field (bibtex-enclosing-field) t)) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2989 (field-list (bibtex-field-list (progn (re-search-backward |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2990 bibtex-entry-maybe-empty-head nil t) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2991 (bibtex-type-in-head)))) |
55730
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
2992 (comment (assoc-string field-name |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
2993 (append (car field-list) |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
2994 (cdr field-list)) |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
2995 t))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2996 (if comment |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
2997 (message (nth 1 comment)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
2998 (message "No comment available"))))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
2999 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3000 (defun bibtex-make-field (field &optional move interactive) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3001 "Make a field named FIELD in current BibTeX entry. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3002 FIELD is either a string or a list of the form |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3003 \(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
3004 `bibtex-entry-field-alist'. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3005 If MOVE is non-nil, move point past the present field before making |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3006 the new field. If INTERACTIVE is non-nil, move point to the end of |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3007 the new field. Otherwise move point past the new field. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3008 MOVE and INTERACTIVE are t when called interactively." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3009 (interactive |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
3010 (list (let ((completion-ignore-case t) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
3011 (field-list (bibtex-field-list |
57815 | 3012 (save-excursion |
3013 (bibtex-enclosing-entry-maybe-empty-head) | |
3014 (bibtex-type-in-head))))) | |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
3015 (completing-read "BibTeX field name: " |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
3016 (append (car field-list) (cdr field-list)) |
57819
cc6cd5062afb
(bibtex-make-field): Don't use interactive-p.
Richard M. Stallman <rms@gnu.org>
parents:
57815
diff
changeset
|
3017 nil nil nil bibtex-field-history)) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3018 t t)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3019 (unless (consp field) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3020 (setq field (list field))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3021 (if move |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3022 (let (bibtex-help-message) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3023 (bibtex-find-text) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3024 (if (looking-at "[}\"]") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3025 (forward-char)))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3026 (insert ",\n") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3027 (indent-to-column (+ bibtex-entry-offset bibtex-field-indentation)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3028 (if (nth 3 field) (insert "ALT")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3029 (insert (car field) " ") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3030 (if bibtex-align-at-equal-sign |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3031 (indent-to-column (+ bibtex-entry-offset |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3032 (- bibtex-text-indentation 2)))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3033 (insert "= ") |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3034 (unless bibtex-align-at-equal-sign |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3035 (indent-to-column (+ bibtex-entry-offset |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3036 bibtex-text-indentation))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3037 (let ((init (nth 2 field))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3038 (insert (cond ((stringp init) init) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3039 ((fboundp init) (funcall init)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3040 (t (concat (bibtex-field-left-delimiter) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3041 (bibtex-field-right-delimiter)))))) |
57833
1a602333ec1d
(bibtex-make-field): Fix typo.
John Paul Wallington <jpw@pobox.com>
parents:
57819
diff
changeset
|
3042 (when interactive |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
3043 (forward-char -1) |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
3044 (bibtex-print-help-message))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3045 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3046 (defun bibtex-beginning-of-entry () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3047 "Move to beginning of BibTeX entry (beginning of line). |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3048 If inside an entry, move to the beginning of it, otherwise move to the |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
3049 beginning of the previous entry. If point is ahead of all BibTeX entries |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
3050 move point to the beginning of buffer. Return the new location of point." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3051 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3052 (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
|
3053 (if (looking-at "@") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3054 (forward-char)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3055 (re-search-backward "^[ \t]*@" nil 'move) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3056 (point)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3057 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3058 (defun bibtex-end-of-entry () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3059 "Move to end of BibTeX entry (past the closing brace). |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3060 If inside an entry, move to the end of it, otherwise move to the end |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
3061 of the previous entry. Do not move if ahead of first entry. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3062 Return the new location of point." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3063 (interactive) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3064 (let ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3065 (org (point)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3066 (pnt (bibtex-beginning-of-entry)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3067 err bounds) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3068 (cond ((looking-at bibtex-valid-entry-whitespace-re) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3069 (bibtex-search-entry t nil t) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3070 (unless (equal (match-beginning 0) pnt) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3071 (setq err t))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3072 ((setq bounds (bibtex-parse-string)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3073 (goto-char (bibtex-end-of-string bounds))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3074 ((looking-at "[ \t]*@[ \t]*preamble[ \t\n]*") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3075 (goto-char (match-end 0)) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3076 (if (looking-at "[({]") |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3077 (forward-sexp 1) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3078 (setq err t))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3079 (t |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3080 (if (interactive-p) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3081 (message "Not on a known BibTeX entry.")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3082 (goto-char org))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3083 (when err |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3084 (goto-char pnt) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3085 (error "Syntactically incorrect BibTeX entry starts here"))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3086 (point)) |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
3087 |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3088 (defun bibtex-goto-line (arg) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3089 "Goto line ARG, counting from beginning of (narrowed) buffer." |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3090 ;; code adapted from `goto-line' |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3091 (goto-char (point-min)) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3092 (if (eq selective-display t) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3093 (re-search-forward "[\n\C-m]" nil 'end (1- arg)) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3094 (forward-line (1- arg)))) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3095 |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3096 (defun bibtex-reposition-window () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3097 "Make the current BibTeX entry visible. |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3098 If entry is smaller than `window-body-height', entry is centered in window. |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3099 Otherwise display the beginning of entry." |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3100 (interactive) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3101 (let ((pnt (point)) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3102 (beg (line-number-at-pos (bibtex-beginning-of-entry))) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3103 (end (line-number-at-pos (bibtex-end-of-entry)))) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3104 (if (> (window-body-height) (- end beg)) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3105 ;; entry fits in current window |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3106 (progn |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3107 (bibtex-goto-line (/ (+ 1 beg end) 2)) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3108 (recenter) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3109 (goto-char pnt)) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3110 ;; entry too large for current window |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3111 (bibtex-goto-line beg) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3112 (recenter 0) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3113 (if (> (1+ (- (line-number-at-pos pnt) beg)) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3114 (window-body-height)) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3115 (bibtex-goto-line beg) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3116 (goto-char pnt))))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3117 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3118 (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
|
3119 "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
|
3120 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3121 (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
|
3122 (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
|
3123 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3124 (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
|
3125 "Count number of entries in current buffer or region. |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3126 With prefix argument COUNT-STRING-ENTRIES count all entries, |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3127 otherwise count all entries except @String entries. |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3128 If mark is active count entries in region, if not in whole buffer." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3129 (interactive "P") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3130 (let ((number 0) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3131 (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
|
3132 (not count-string-entries))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3133 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3134 (save-restriction |
57815 | 3135 (narrow-to-region (if mark-active (region-beginning) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3136 (bibtex-beginning-of-first-entry)) |
57815 | 3137 (if mark-active (region-end) (point-max))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3138 (bibtex-map-entries (lambda (key beg end) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3139 (setq number (1+ number)))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3140 (message "%s contains %d entries." |
57815 | 3141 (if mark-active "Region" "Buffer") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3142 number))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3143 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3144 (defun bibtex-ispell-entry () |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3145 "Check BibTeX entry for spelling errors." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3146 (interactive) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3147 (ispell-region (save-excursion (bibtex-beginning-of-entry)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3148 (save-excursion (bibtex-end-of-entry)))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3149 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3150 (defun bibtex-ispell-abstract () |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3151 "Check abstract of BibTeX entry for spelling errors." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3152 (interactive) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3153 (let ((bounds (save-excursion |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3154 (bibtex-beginning-of-entry) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3155 (bibtex-search-forward-field "abstract" t)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3156 (if bounds |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3157 (ispell-region (bibtex-start-of-text-in-field bounds) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3158 (bibtex-end-of-text-in-field bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3159 (error "No abstract in entry")))) |
18212
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-narrow-to-entry () |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3162 "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
|
3163 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3164 (save-excursion |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3165 (widen) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3166 (narrow-to-region (bibtex-beginning-of-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3167 (bibtex-end-of-entry)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3168 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3169 (defun bibtex-entry-index () |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3170 "Return index of BibTeX entry head at or past position of point. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3171 The index is a list (KEY CROSSREF-KEY ENTRY-NAME) that is used for sorting |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3172 the entries of the BibTeX buffer. CROSSREF-KEY is nil unless the value |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3173 of `bibtex-maintain-sorted-entries' is `crossref'. Move point to the end |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3174 of the head of the entry found. Return nil if no entry found." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3175 (let ((case-fold-search t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3176 (if (re-search-forward bibtex-entry-maybe-empty-head nil t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3177 (let ((key (bibtex-key-in-head)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3178 ;; all entry names should be downcase (for ease of comparison) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3179 (entry-name (downcase (bibtex-type-in-head)))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3180 ;; Don't search CROSSREF-KEY if we don't need it. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3181 (if (eq bibtex-maintain-sorted-entries 'crossref) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3182 (let ((bounds (bibtex-search-forward-field |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3183 "\\(OPT\\)?crossref" t))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3184 (list key |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3185 (if bounds (bibtex-text-in-field-bounds bounds t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3186 entry-name)) |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
3187 (list key nil entry-name)))))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3188 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3189 (defun bibtex-lessp (index1 index2) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3190 "Predicate for sorting BibTeX entries with indices INDEX1 and INDEX2. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3191 Each index is a list (KEY CROSSREF-KEY ENTRY-NAME). |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
3192 The predicate depends on the variable `bibtex-maintain-sorted-entries'. |
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
3193 If its value is nil use plain sorting." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3194 (cond ((not index1) (not index2)) ; indices can be nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3195 ((not index2) nil) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3196 ((eq bibtex-maintain-sorted-entries 'crossref) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3197 (if (nth 1 index1) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3198 (if (nth 1 index2) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3199 (or (string-lessp (nth 1 index1) (nth 1 index2)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3200 (and (string-equal (nth 1 index1) (nth 1 index2)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3201 (string-lessp (nth 0 index1) (nth 0 index2)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3202 (not (string-lessp (nth 0 index2) (nth 1 index1)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3203 (if (nth 1 index2) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3204 (string-lessp (nth 0 index1) (nth 1 index2)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3205 (string-lessp (nth 0 index1) (nth 0 index2))))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3206 ((eq bibtex-maintain-sorted-entries 'entry-class) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3207 (let ((n1 (cdr (or (assoc (nth 2 index1) bibtex-sort-entry-class-alist) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3208 (assoc 'catch-all bibtex-sort-entry-class-alist) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3209 '(nil . 1000)))) ; if there is nothing else |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3210 (n2 (cdr (or (assoc (nth 2 index2) bibtex-sort-entry-class-alist) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3211 (assoc 'catch-all bibtex-sort-entry-class-alist) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3212 '(nil . 1000))))) ; if there is nothing else |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3213 (or (< n1 n2) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3214 (and (= n1 n2) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3215 (string-lessp (car index1) (car index2)))))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3216 (t ; (eq bibtex-maintain-sorted-entries 'plain) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3217 (string-lessp (car index1) (car index2))))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3218 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3219 (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
|
3220 "Sort BibTeX buffer alphabetically by key. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3221 The predicate for sorting is defined via `bibtex-maintain-sorted-entries'. |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
3222 If its value is nil use plain sorting. Text outside of BibTeX entries is not |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
3223 affected. If `bibtex-sort-ignore-string-entries' is non-nil, @String entries |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3224 are ignored." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3225 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3226 (save-restriction |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3227 (narrow-to-region (bibtex-beginning-of-first-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3228 (save-excursion (goto-char (point-max)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3229 (bibtex-end-of-entry))) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3230 (bibtex-skip-to-valid-entry) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3231 (sort-subr nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3232 'bibtex-skip-to-valid-entry ; NEXTREC function |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3233 'bibtex-end-of-entry ; ENDREC function |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3234 'bibtex-entry-index ; STARTKEY function |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3235 nil ; ENDKEY function |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3236 'bibtex-lessp))) ; PREDICATE |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3237 |
57815 | 3238 (defun bibtex-find-crossref (crossref-key &optional pnt split) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3239 "Move point to the beginning of BibTeX entry CROSSREF-KEY. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3240 If `bibtex-files' is non-nil, search all these files. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3241 Otherwise the search is limited to the current buffer. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3242 Return position of entry if CROSSREF-KEY is found or nil otherwise. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3243 If CROSSREF-KEY is in the same buffer like current entry but before it |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3244 an error is signaled. Optional arg PNT is the position of the referencing |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3245 entry. It defaults to position of point. If optional arg SPLIT is non-nil, |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3246 split window so that both the referencing and the crossrefed entry are |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3247 displayed. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3248 If called interactively, CROSSREF-KEY defaults to crossref key of current |
57815 | 3249 entry and SPLIT is t." |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3250 (interactive |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3251 (let ((crossref-key |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3252 (save-excursion |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3253 (bibtex-beginning-of-entry) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3254 (let ((bounds (bibtex-search-forward-field "crossref" t))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3255 (if bounds |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3256 (bibtex-text-in-field-bounds bounds t)))))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3257 (list (bibtex-read-key "Find crossref key: " crossref-key t) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3258 (point) t))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3259 (let (buffer pos eqb) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3260 (save-excursion |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3261 (setq pos (bibtex-find-entry crossref-key t) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3262 buffer (current-buffer))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3263 (setq eqb (eq buffer (current-buffer))) |
57815 | 3264 (cond ((not pos) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3265 (if split (message "Crossref key `%s' not found" crossref-key))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3266 (split ; called (quasi) interactively |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3267 (unless pnt (setq pnt (point))) |
57815 | 3268 (goto-char pnt) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3269 (if eqb (select-window (split-window)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3270 (pop-to-buffer buffer)) |
57815 | 3271 (goto-char pos) |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3272 (bibtex-reposition-window) |
57815 | 3273 (beginning-of-line) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3274 (if (and eqb (> pnt pos)) |
59733
96d73eb02751
(bibtex-format-entry): Use `bibtex-empty-field-re' only on the text of
Lute Kamstra <lute@gnu.org>
parents:
58772
diff
changeset
|
3275 (error "The referencing entry must precede the crossrefed entry!"))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3276 ;; `bibtex-find-crossref' is called noninteractively during |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3277 ;; clean-up of an entry. Then it is not possible to check |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3278 ;; whether the current entry and the crossrefed entry have |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3279 ;; the correct sorting order. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3280 (eqb (goto-char pos)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3281 (t (set-buffer buffer) (goto-char pos))) |
57815 | 3282 pos)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3283 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3284 (defun bibtex-find-entry (key &optional global start display) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3285 "Move point to the beginning of BibTeX entry named KEY. |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3286 Return position of entry if KEY is found or nil if not found. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3287 With prefix arg GLOBAL non-nil, search KEY in `bibtex-files'. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3288 Otherwise the search is limited to the current buffer. |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3289 Optional arg START is buffer position where the search starts. |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3290 If it is nil, start search at beginning of buffer. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3291 If DISPLAY is non-nil, display the buffer containing KEY. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3292 Otherwise, use `set-buffer'. DISPLAY is t when called interactively." |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3293 (interactive (list (bibtex-read-key "Find key: " nil current-prefix-arg) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3294 current-prefix-arg nil t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3295 (if (and global bibtex-files) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3296 (let ((buffer-list (bibtex-files-expand t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3297 buffer found) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3298 (while (and (not found) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3299 (setq buffer (pop buffer-list))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3300 (with-current-buffer buffer |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3301 (if (cdr (assoc-string key bibtex-reference-keys)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3302 ;; `bibtex-find-entry' moves point if key found |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3303 (setq found (bibtex-find-entry key))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3304 (cond ((and found display) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3305 (let ((same-window-buffer-names |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3306 (cons (buffer-name buffer) same-window-buffer-names))) |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3307 (pop-to-buffer buffer) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3308 (bibtex-reposition-window))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3309 (found (set-buffer buffer)) |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3310 (display (message "Key `%s' not found" key))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3311 found) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3312 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3313 (let* (case-fold-search |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3314 (pnt (save-excursion |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3315 (goto-char (or start (point-min))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3316 (if (re-search-forward (concat "^[ \t]*\\(" |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3317 bibtex-entry-type |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3318 "\\)[ \t]*[({][ \t\n]*\\(" |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3319 (regexp-quote key) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3320 "\\)[ \t\n]*[,=]") |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3321 nil t) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3322 (match-beginning 0))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3323 (cond (pnt |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3324 (goto-char pnt) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3325 (if display (bibtex-reposition-window))) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3326 (display (message "Key `%s' not found" key))) |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3327 pnt))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3328 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3329 (defun bibtex-prepare-new-entry (index) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3330 "Prepare a new BibTeX entry with index INDEX. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3331 INDEX is a list (KEY CROSSREF-KEY ENTRY-NAME). |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3332 Move point where the entry KEY should be placed. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3333 If `bibtex-maintain-sorted-entries' is non-nil, perform a binary |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3334 search to look for place for KEY. This requires that buffer is sorted, |
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3335 see \\[bibtex-validate].) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3336 Return t if preparation was successful or nil if entry KEY already exists." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3337 (let ((key (nth 0 index)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3338 key-exist) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3339 (cond ((or (null key) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3340 (and (stringp key) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3341 (string-equal key "")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3342 (and (not (setq key-exist (bibtex-find-entry key))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3343 (not bibtex-maintain-sorted-entries))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3344 (bibtex-move-outside-of-entry)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3345 ;; if key-exist is non-nil due to the previous cond clause |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3346 ;; then point will be at beginning of entry named key. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3347 (key-exist) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3348 (t ; bibtex-maintain-sorted-entries is non-nil |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3349 (let* ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3350 (left (save-excursion (bibtex-beginning-of-first-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3351 (bibtex-skip-to-valid-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3352 (point))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3353 (right (save-excursion (bibtex-beginning-of-last-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3354 (bibtex-end-of-entry))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3355 (found (if (>= left right) left)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3356 actual-index new) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3357 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3358 ;; Binary search |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3359 (while (not found) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3360 (goto-char (/ (+ left right) 2)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3361 (bibtex-skip-to-valid-entry t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3362 (setq actual-index (bibtex-entry-index)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3363 (cond ((bibtex-lessp index actual-index) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3364 (setq new (bibtex-beginning-of-entry)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3365 (if (equal right new) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3366 (setq found right) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3367 (setq right new))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3368 (t |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3369 (bibtex-end-of-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3370 (bibtex-skip-to-valid-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3371 (setq new (point)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3372 (if (equal left new) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3373 (setq found right) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3374 (setq left new)))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3375 (goto-char found) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3376 (bibtex-beginning-of-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3377 (setq actual-index (save-excursion (bibtex-entry-index))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3378 (when (or (not actual-index) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3379 (bibtex-lessp actual-index index)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3380 ;; buffer contains no valid entries or |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3381 ;; greater than last entry --> append |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3382 (bibtex-end-of-entry) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3383 (unless (bobp) (newline (forward-line 2))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3384 (beginning-of-line))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3385 (unless key-exist t))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3386 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3387 (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
|
3388 "Validate if buffer or region is syntactically correct. |
57815 | 3389 Check also for duplicate keys and correct sort order provided |
3390 `bibtex-maintain-sorted-entries' is non-nil. | |
3391 With optional argument TEST-THOROUGHLY non-nil check also for | |
3392 the absence of required fields and for questionable month fields. | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3393 If mark is active, validate current region, if not the whole buffer. |
57815 | 3394 Only check known entry types, so you can put comments outside of entries. |
3395 Return t if test was successful, nil otherwise." | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3396 (interactive "P") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3397 (let* ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3398 error-list syntax-error) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3399 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3400 (save-restriction |
57815 | 3401 (narrow-to-region (if mark-active (region-beginning) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3402 (bibtex-beginning-of-first-entry)) |
57815 | 3403 (if mark-active (region-end) (point-max))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3404 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3405 ;; looking if entries fit syntactical structure |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3406 (goto-char (point-min)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3407 (bibtex-progress-message "Checking syntactical structure") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3408 (let (bibtex-sort-ignore-string-entries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3409 (while (re-search-forward "^[ \t]*@" nil t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3410 (bibtex-progress-message) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3411 (forward-char -1) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3412 (let ((pnt (point))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3413 (if (not (looking-at bibtex-any-valid-entry-re)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3414 (forward-char) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3415 (bibtex-skip-to-valid-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3416 (if (equal (point) pnt) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3417 (forward-char) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3418 (goto-char pnt) |
57815 | 3419 (push (cons (bibtex-current-line) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3420 "Syntax error (check esp. commas, braces, and quotes)") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3421 error-list) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3422 (forward-char)))))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3423 (bibtex-progress-message 'done) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3424 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3425 (if error-list |
57815 | 3426 ;; proceed only if there were no syntax errors. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3427 (setq syntax-error t) |
57815 | 3428 |
3429 ;; looking for duplicate keys and correct sort order | |
3430 (let (previous current key-list) | |
3431 (bibtex-progress-message "Checking for duplicate keys") | |
3432 (bibtex-map-entries | |
3433 (lambda (key beg end) | |
3434 (bibtex-progress-message) | |
3435 (goto-char beg) | |
3436 (setq current (bibtex-entry-index)) | |
3437 (cond ((not previous)) | |
3438 ((member key key-list) | |
3439 (push (cons (bibtex-current-line) | |
3440 (format "Duplicate key `%s'" key)) | |
3441 error-list)) | |
3442 ((and bibtex-maintain-sorted-entries | |
3443 (not (bibtex-lessp previous current))) | |
3444 (push (cons (bibtex-current-line) | |
3445 "Entries out of order") | |
3446 error-list))) | |
3447 (push key key-list) | |
3448 (setq previous current))) | |
3449 (bibtex-progress-message 'done)) | |
3450 | |
3451 ;; Check for duplicate keys in `bibtex-files'. | |
3452 (bibtex-parse-keys) | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3453 ;; We don't want to be fooled by outdated `bibtex-reference-keys'. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3454 (dolist (buffer (bibtex-files-expand nil t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3455 (dolist (key (with-current-buffer buffer bibtex-reference-keys)) |
57815 | 3456 (when (and (cdr key) |
3457 (cdr (assoc-string (car key) bibtex-reference-keys))) | |
3458 (bibtex-find-entry (car key)) | |
3459 (push (cons (bibtex-current-line) | |
3460 (format "Duplicate key `%s' in %s" (car key) | |
3461 (abbreviate-file-name (buffer-file-name buffer)))) | |
3462 error-list)))) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3463 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3464 (when test-thoroughly |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3465 (bibtex-progress-message |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3466 "Checking required fields and month fields") |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3467 (let ((bibtex-sort-ignore-string-entries t)) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3468 (bibtex-map-entries |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3469 (lambda (key beg end) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3470 (bibtex-progress-message) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3471 (let* ((entry-list (progn |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3472 (goto-char beg) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3473 (bibtex-search-entry nil end) |
55730
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
3474 (assoc-string (bibtex-type-in-head) |
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
3475 bibtex-entry-field-alist t))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3476 (req (copy-sequence (elt (elt entry-list 1) 0))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3477 (creq (copy-sequence (elt (elt entry-list 2) 0))) |
57815 | 3478 crossref-there bounds alt-there field) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3479 (goto-char beg) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3480 (while (setq bounds (bibtex-search-forward-field |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3481 bibtex-field-name end)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3482 (goto-char (bibtex-start-of-text-in-field bounds)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3483 (let ((field-name (bibtex-name-in-field bounds))) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3484 (if (and (bibtex-string= field-name "month") |
57815 | 3485 ;; Check only abbreviated month fields. |
3486 (let ((month (bibtex-text-in-field-bounds bounds))) | |
3487 (not (or (string-match "\\`[\"{].+[\"}]\\'" month) | |
3488 (assoc-string | |
3489 month | |
3490 bibtex-predefined-month-strings t))))) | |
3491 (push (cons (bibtex-current-line) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3492 "Questionable month field") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3493 error-list)) |
57815 | 3494 (setq field (assoc-string field-name req t)) |
3495 (if (nth 3 field) | |
3496 (if alt-there (push (cons (bibtex-current-line) | |
3497 "More than one non-empty alternative") | |
3498 error-list) | |
3499 (setq alt-there t))) | |
3500 (setq req (delete field req) | |
55730
b4eeb441c089
Use assoc-string, not assoc-ignore-case.
Richard M. Stallman <rms@gnu.org>
parents:
55348
diff
changeset
|
3501 creq (delete (assoc-string field-name creq t) creq)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3502 (if (bibtex-string= field-name "crossref") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3503 (setq crossref-there t)))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3504 (if crossref-there |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3505 (setq req creq)) |
57815 | 3506 (let (alt) |
3507 (dolist (field req) | |
3508 (if (nth 3 field) | |
3509 (push (car field) alt) | |
3510 (push (cons (save-excursion (goto-char beg) | |
3511 (bibtex-current-line)) | |
3512 (format "Required field `%s' missing" | |
3513 (car field))) | |
3514 error-list))) | |
3515 ;; The following fails if there are more than two | |
3516 ;; alternatives in a BibTeX entry, which isn't | |
3517 ;; the case momentarily. | |
3518 (if (cdr alt) | |
3519 (push (cons (save-excursion (goto-char beg) | |
3520 (bibtex-current-line)) | |
3521 (format "Alternative fields `%s'/`%s' missing" | |
3522 (car alt) (cadr alt))) | |
3523 error-list))))))) | |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3524 (bibtex-progress-message 'done))))) |
57815 | 3525 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3526 (if error-list |
57815 | 3527 (let ((file (file-name-nondirectory (buffer-file-name))) |
3528 (dir default-directory) | |
3529 (err-buf "*BibTeX validation errors*")) | |
3530 (setq error-list (sort error-list 'car-less-than-car)) | |
3531 (with-current-buffer (get-buffer-create err-buf) | |
3532 (setq default-directory dir) | |
3533 (unless (eq major-mode 'compilation-mode) (compilation-mode)) | |
3534 (toggle-read-only -1) | |
3535 (delete-region (point-min) (point-max)) | |
3536 (insert "BibTeX mode command `bibtex-validate'\n" | |
3537 (if syntax-error | |
3538 "Maybe undetected errors due to syntax errors. Correct and validate again.\n" | |
3539 "\n")) | |
3540 (dolist (err error-list) | |
3541 (insert (format "%s:%d: %s\n" file (car err) (cdr err)))) | |
3542 (set-buffer-modified-p nil) | |
3543 (toggle-read-only 1) | |
3544 (goto-line 3)) ; first error message | |
3545 (display-buffer err-buf) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3546 ;; return nil |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3547 nil) |
57815 | 3548 (message "%s is syntactically correct" |
3549 (if mark-active "Region" "Buffer")) | |
3550 t))) | |
3551 | |
3552 (defun bibtex-validate-globally (&optional strings) | |
3553 "Check for duplicate keys in `bibtex-files'. | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3554 With optional prefix arg STRINGS, check for duplicate strings, too. |
57815 | 3555 Return t if test was successful, nil otherwise." |
3556 (interactive "P") | |
3557 (let ((buffer-list (bibtex-files-expand t)) | |
3558 buffer-key-list current-buf current-keys error-list) | |
3559 ;; Check for duplicate keys within BibTeX buffer | |
3560 (dolist (buffer buffer-list) | |
3561 (save-excursion | |
3562 (set-buffer buffer) | |
3563 (let (entry-type key key-list) | |
3564 (goto-char (point-min)) | |
3565 (while (re-search-forward bibtex-entry-head nil t) | |
3566 (setq entry-type (bibtex-type-in-head) | |
3567 key (bibtex-key-in-head)) | |
3568 (if (or (and strings (bibtex-string= entry-type "string")) | |
3569 (assoc-string entry-type bibtex-entry-field-alist t)) | |
3570 (if (member key key-list) | |
3571 (push (format "%s:%d: Duplicate key `%s'\n" | |
3572 (buffer-file-name) | |
3573 (bibtex-current-line) key) | |
3574 error-list) | |
3575 (push key key-list)))) | |
3576 (push (cons buffer key-list) buffer-key-list)))) | |
3577 | |
3578 ;; Check for duplicate keys among BibTeX buffers | |
3579 (while (setq current-buf (pop buffer-list)) | |
3580 (setq current-keys (cdr (assq current-buf buffer-key-list))) | |
3581 (with-current-buffer current-buf | |
3582 (dolist (buffer buffer-list) | |
3583 (dolist (key (cdr (assq buffer buffer-key-list))) | |
3584 (when (assoc-string key current-keys) | |
3585 (bibtex-find-entry key) | |
3586 (push (format "%s:%d: Duplicat key `%s' in %s\n" | |
3587 (buffer-file-name) (bibtex-current-line) key | |
3588 (abbreviate-file-name (buffer-file-name buffer))) | |
3589 error-list)))))) | |
3590 | |
3591 ;; Process error list | |
3592 (if error-list | |
3593 (let ((err-buf "*BibTeX validation errors*")) | |
3594 (with-current-buffer (get-buffer-create err-buf) | |
3595 (unless (eq major-mode 'compilation-mode) (compilation-mode)) | |
3596 (toggle-read-only -1) | |
3597 (delete-region (point-min) (point-max)) | |
3598 (insert "BibTeX mode command `bibtex-validate-globally'\n\n") | |
3599 (dolist (err (sort error-list 'string-lessp)) (insert err)) | |
3600 (set-buffer-modified-p nil) | |
3601 (toggle-read-only 1) | |
3602 (goto-line 3)) ; first error message | |
3603 (display-buffer err-buf) | |
3604 ;; return nil | |
3605 nil) | |
3606 (message "No duplicate keys.") | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3607 t))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3608 |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3609 (defun bibtex-next-field (begin) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3610 "Move point to end of text of next BibTeX field. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3611 With prefix BEGIN non-nil, move point to its beginning." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3612 (interactive "P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3613 (bibtex-inside-field) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3614 (let ((start (point))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3615 (condition-case () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3616 (let ((bounds (bibtex-enclosing-field))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3617 (goto-char (bibtex-end-of-field bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3618 (forward-char 2)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3619 (error |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3620 (goto-char start) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3621 (end-of-line) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3622 (forward-char)))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3623 (bibtex-find-text begin)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3624 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3625 (defun bibtex-find-text (&optional begin noerror) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3626 "Move point to end of text of current BibTeX field. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3627 With optional prefix BEGIN non-nil, move point to its beginning. |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3628 Unless NOERROR is non-nil, an error is signaled if point is not |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3629 on a BibTeX field." |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3630 (interactive "P") |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3631 (let* ((pnt (point)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3632 (_ (bibtex-inside-field)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3633 (bounds (bibtex-enclosing-field t))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3634 (beginning-of-line) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3635 (cond (bounds |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3636 (if begin |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3637 (progn (goto-char (bibtex-start-of-text-in-field bounds)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3638 (if (looking-at "[{\"]") |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3639 (forward-char))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3640 (goto-char (bibtex-end-of-text-in-field bounds)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3641 (if (or (= (preceding-char) ?}) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3642 (= (preceding-char) ?\")) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3643 (forward-char -1))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3644 (if bibtex-help-message |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3645 (bibtex-print-help-message))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3646 ((setq bounds (bibtex-parse-string)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3647 (goto-char (if begin |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3648 (1+ (bibtex-start-of-text-in-string bounds)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3649 (1- (bibtex-end-of-text-in-string bounds))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3650 ((looking-at bibtex-entry-maybe-empty-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3651 (goto-char (if begin |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3652 (match-beginning bibtex-key-in-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3653 (match-end 0)))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3654 (t |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3655 (goto-char pnt) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3656 (unless noerror (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
|
3657 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3658 (defun bibtex-remove-OPT-or-ALT () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3659 "Remove the string starting optional/alternative fields. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3660 Align text and go thereafter to end of text." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3661 (interactive) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3662 (bibtex-inside-field) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3663 (let ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3664 (bounds (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
|
3665 (save-excursion |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3666 (goto-char (bibtex-start-of-name-in-field bounds)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3667 (when (looking-at "OPT\\|ALT") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3668 (delete-region (match-beginning 0) (match-end 0)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3669 ;; make field non-OPT |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3670 (search-forward "=") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3671 (forward-char -1) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3672 (delete-horizontal-space) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3673 (if bibtex-align-at-equal-sign |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3674 (indent-to-column (- bibtex-text-indentation 2)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3675 (insert " ")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3676 (search-forward "=") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3677 (delete-horizontal-space) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3678 (if bibtex-align-at-equal-sign |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3679 (insert " ") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3680 (indent-to-column bibtex-text-indentation)))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3681 (bibtex-inside-field))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3682 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3683 (defun bibtex-remove-delimiters () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3684 "Remove \"\" or {} around string." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3685 (interactive) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3686 (save-excursion |
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3687 (bibtex-inside-field) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3688 (let* ((bounds (bibtex-enclosing-field)) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3689 (end (bibtex-end-of-text-in-field bounds)) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3690 (start (bibtex-start-of-text-in-field bounds))) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3691 (if (memq (char-before end) '(?\} ?\")) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3692 (delete-region (1- end) end)) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3693 (if (memq (char-after start) '(?\{ ?\")) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3694 (delete-region start (1+ start)))))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3695 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3696 (defun bibtex-kill-field (&optional copy-only) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3697 "Kill the entire enclosing BibTeX field. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3698 With prefix arg COPY-ONLY, copy the current field to `bibtex-field-kill-ring', |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3699 but do not actually kill it." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3700 (interactive "P") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3701 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3702 (bibtex-inside-field) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3703 (let* ((case-fold-search t) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3704 (bounds (bibtex-enclosing-field)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3705 (end (bibtex-end-of-field bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3706 (beg (bibtex-start-of-field bounds))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3707 (goto-char end) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3708 (skip-chars-forward " \t\n,") |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3709 (push (list (bibtex-name-in-field bounds) nil |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3710 (bibtex-text-in-field-bounds bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3711 bibtex-field-kill-ring) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3712 (if (> (length bibtex-field-kill-ring) bibtex-field-kill-ring-max) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3713 (setcdr (nthcdr (1- bibtex-field-kill-ring-max) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3714 bibtex-field-kill-ring) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3715 nil)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3716 (setq bibtex-field-kill-ring-yank-pointer bibtex-field-kill-ring) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3717 (unless copy-only |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3718 (delete-region beg end)))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3719 (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
|
3720 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3721 (defun bibtex-copy-field-as-kill () |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3722 "Copy the BibTeX field at point to the kill ring." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3723 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3724 (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
|
3725 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3726 (defun bibtex-kill-entry (&optional copy-only) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3727 "Kill the entire enclosing BibTeX entry. |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3728 With prefix arg COPY-ONLY, copy the current entry to `bibtex-entry-kill-ring', |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3729 but do not actually kill it." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3730 (interactive "P") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3731 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3732 (let* ((case-fold-search t) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3733 (beg (bibtex-beginning-of-entry)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3734 (end (progn (bibtex-end-of-entry) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3735 (if (re-search-forward |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3736 bibtex-entry-maybe-empty-head nil 'move) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3737 (goto-char (match-beginning 0))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3738 (point)))) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3739 (push (buffer-substring-no-properties beg end) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3740 bibtex-entry-kill-ring) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3741 (if (> (length bibtex-entry-kill-ring) bibtex-entry-kill-ring-max) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3742 (setcdr (nthcdr (1- bibtex-entry-kill-ring-max) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3743 bibtex-entry-kill-ring) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3744 nil)) |
57815 | 3745 (setq bibtex-entry-kill-ring-yank-pointer bibtex-entry-kill-ring) |
3746 (unless copy-only | |
3747 (delete-region beg end)))) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3748 (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
|
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-copy-entry-as-kill () |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3751 "Copy the entire enclosing BibTeX entry to `bibtex-entry-kill-ring'." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3752 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3753 (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
|
3754 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3755 (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
|
3756 "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
|
3757 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
|
3758 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
|
3759 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
|
3760 (interactive "*p") |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3761 (bibtex-insert-kill (1- n)) |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
3762 (setq this-command 'bibtex-yank)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3763 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3764 (defun bibtex-yank-pop (n) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3765 "Replace just-yanked killed BibTeX item with a different item. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3766 This command is allowed only immediately after a `bibtex-yank' or a |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3767 `bibtex-yank-pop'. At such a time, the region contains a reinserted |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3768 previously killed BibTeX item. `bibtex-yank-pop' deletes that item |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3769 and inserts in its place a different killed BibTeX item. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3770 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3771 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
|
3772 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
|
3773 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
|
3774 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3775 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
|
3776 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
|
3777 (interactive "*p") |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3778 (unless (eq last-command 'bibtex-yank) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3779 (error "Previous command was not a BibTeX yank")) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3780 (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
|
3781 (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
|
3782 (delete-region (point) (mark t)) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3783 (bibtex-insert-kill n))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3784 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3785 (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
|
3786 "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
|
3787 (interactive) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3788 (bibtex-inside-field) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3789 (let ((bounds (bibtex-enclosing-field))) |
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3790 (goto-char (bibtex-start-of-text-in-field bounds)) |
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3791 (delete-region (point) (bibtex-end-of-text-in-field bounds)) |
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3792 (insert (concat (bibtex-field-left-delimiter) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3793 (bibtex-field-right-delimiter)) ) |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3794 (bibtex-find-text t))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3795 |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3796 (defun bibtex-pop-previous (arg) |
19461 | 3797 "Replace text of current field with the similar field in previous entry. |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
3798 With arg, goes up ARG entries. Repeated, goes up so many times. May be |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3799 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
|
3800 (interactive "p") |
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3801 (bibtex-pop arg 'previous)) |
257 | 3802 |
3803 (defun bibtex-pop-next (arg) | |
3804 "Replace text of current field with the text of similar field in next entry. | |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
3805 With arg, goes down ARG entries. Repeated, goes down so many times. May be |
257 | 3806 intermixed with \\[bibtex-pop-previous] (bibtex-pop-previous)." |
3807 (interactive "p") | |
14789
d68b71228abd
(bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents:
14410
diff
changeset
|
3808 (bibtex-pop arg 'next)) |
257 | 3809 |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3810 (defun bibtex-clean-entry (&optional new-key called-by-reformat) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3811 "Finish editing the current BibTeX entry and clean it up. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3812 Check that no required fields are empty and formats entry dependent |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3813 on the value of `bibtex-entry-format'. |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
3814 If the reference key of the entry is empty or a prefix argument is given, |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
3815 calculate a new reference key. (Note: this works only if fields in entry |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3816 begin on separate lines prior to calling `bibtex-clean-entry' or if |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3817 'realign is contained in `bibtex-entry-format'.) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3818 Don't call `bibtex-clean-entry' on @Preamble entries. |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3819 At end of the cleaning process, the functions in |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3820 `bibtex-clean-entry-hook' are called with region narrowed to entry." |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3821 ;; Opt. arg called-by-reformat is t if bibtex-clean-entry |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3822 ;; is called by bibtex-reformat |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
3823 (interactive "P") |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3824 (let ((case-fold-search t) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3825 (start (bibtex-beginning-of-entry)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3826 (_ (looking-at bibtex-entry-maybe-empty-head)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3827 (entry-type (bibtex-type-in-head)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3828 (key (bibtex-key-in-head))) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3829 ;; formatting |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3830 (cond ((bibtex-string= entry-type "preamble") |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3831 ;; (bibtex-format-preamble) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3832 (error "No clean up of @Preamble entries")) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3833 ((bibtex-string= entry-type "string") |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3834 (setq entry-type 'string)) |
57815 | 3835 ;; (bibtex-format-string) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3836 (t (bibtex-format-entry))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3837 ;; set key |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3838 (when (or new-key (not key)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3839 (setq key (bibtex-generate-autokey)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3840 ;; Sometimes bibtex-generate-autokey returns an empty string |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3841 (if (or bibtex-autokey-edit-before-use (string= "" key)) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3842 (setq key (if (eq entry-type 'string) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3843 (bibtex-read-string-key key) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3844 (bibtex-read-key "Key to use: " key)))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3845 (save-excursion |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3846 (re-search-forward (if (eq entry-type 'string) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3847 bibtex-string-maybe-empty-head |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3848 bibtex-entry-maybe-empty-head)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3849 (if (match-beginning bibtex-key-in-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3850 (delete-region (match-beginning bibtex-key-in-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3851 (match-end bibtex-key-in-head))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3852 (insert key))) |
57815 | 3853 |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3854 (unless called-by-reformat |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3855 (let* ((end (save-excursion |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3856 (bibtex-end-of-entry) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3857 (if (re-search-forward |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3858 bibtex-entry-maybe-empty-head nil 'move) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3859 (goto-char (match-beginning 0))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3860 (point))) |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3861 (entry (buffer-substring start end)) |
57815 | 3862 ;; include the crossref key in index |
3863 (index (let ((bibtex-maintain-sorted-entries 'crossref)) | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3864 (bibtex-entry-index))) ; moves point to end of head |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3865 error) |
57815 | 3866 ;; sorting |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3867 (if (and bibtex-maintain-sorted-entries |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3868 (not (and bibtex-sort-ignore-string-entries |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3869 (eq entry-type 'string)))) |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3870 (progn |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3871 (delete-region start end) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3872 (setq error (not (bibtex-prepare-new-entry index)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3873 start (point)) ; update start |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3874 (save-excursion (insert entry))) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3875 (bibtex-find-entry key) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3876 (setq error (or (/= (point) start) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3877 (bibtex-find-entry key nil end)))) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
3878 (if error |
57815 | 3879 (error "New inserted entry yields duplicate key")) |
3880 (dolist (buffer (bibtex-files-expand)) | |
3881 (with-current-buffer buffer | |
3882 (if (cdr (assoc-string key bibtex-reference-keys)) | |
3883 (error "Duplicate key in %s" (buffer-file-name))))) | |
3884 | |
3885 ;; Only update the list of keys if it has been built already. | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3886 (cond ((eq entry-type 'string) |
57815 | 3887 (if (and (listp bibtex-strings) |
3888 (not (assoc key bibtex-strings))) | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3889 (push (cons key (bibtex-text-in-string |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3890 (save-excursion (bibtex-parse-string)) t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
3891 bibtex-strings))) |
57815 | 3892 ;; We have a normal entry. |
3893 ((listp bibtex-reference-keys) | |
3894 (cond ((not (assoc key bibtex-reference-keys)) | |
3895 (push (cons key t) bibtex-reference-keys)) | |
3896 ((not (cdr (assoc key bibtex-reference-keys))) | |
3897 ;; Turn a crossref key into a header key | |
3898 (setq bibtex-reference-keys | |
3899 (cons (cons key t) | |
3900 (delete (list key) bibtex-reference-keys))))) | |
3901 ;; Handle crossref key. | |
3902 (if (and (nth 1 index) | |
3903 (not (assoc (nth 1 index) bibtex-reference-keys))) | |
3904 (push (list (nth 1 index)) bibtex-reference-keys))))) | |
3905 | |
3906 ;; final clean up | |
3907 (if bibtex-clean-entry-hook | |
3908 (save-excursion | |
3909 (save-restriction | |
3910 (bibtex-narrow-to-entry) | |
3911 (run-hooks 'bibtex-clean-entry-hook))))))) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3912 |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3913 (defun bibtex-fill-field-bounds (bounds justify &optional move) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3914 "Fill BibTeX field delimited by BOUNDS. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3915 If JUSTIFY is non-nil justify as well. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3916 If optional arg MOVE is non-nil move point to end of field." |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3917 (let ((end-field (copy-marker (bibtex-end-of-field bounds)))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3918 (goto-char (bibtex-start-of-field bounds)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3919 (if justify |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3920 (progn |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3921 (forward-char) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3922 (bibtex-delete-whitespace) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3923 (open-line 1) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3924 (forward-char) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3925 (indent-to-column (+ bibtex-entry-offset |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3926 bibtex-field-indentation)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3927 (re-search-forward "[ \t\n]*=" end-field) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3928 (replace-match "=") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3929 (forward-char -1) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3930 (if bibtex-align-at-equal-sign |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3931 (indent-to-column |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3932 (+ bibtex-entry-offset (- bibtex-text-indentation 2))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3933 (insert " ")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3934 (forward-char) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3935 (bibtex-delete-whitespace) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3936 (if bibtex-align-at-equal-sign |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3937 (insert " ") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3938 (indent-to-column bibtex-text-indentation))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3939 (re-search-forward "[ \t\n]*=[ \t\n]*" end-field)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3940 (while (re-search-forward "[ \t\n]+" end-field 'move) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3941 (replace-match " ")) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3942 (do-auto-fill) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3943 (if move (goto-char end-field)))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3944 |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3945 (defun bibtex-fill-field (&optional justify) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3946 "Like \\[fill-paragraph], but fill current BibTeX field. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3947 Optional prefix arg JUSTIFY non-nil means justify as well. |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3948 In BibTeX mode this function is bound to `fill-paragraph-function'." |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3949 (interactive "*P") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3950 (let ((pnt (copy-marker (point))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3951 (bounds (bibtex-enclosing-field))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3952 (when bounds |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3953 (bibtex-fill-field-bounds bounds justify) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3954 (goto-char pnt)))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3955 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3956 (defun bibtex-fill-entry () |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3957 "Fill current BibTeX entry. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3958 Realign entry, so that every field starts on a separate line. Field |
19461 | 3959 names appear in column `bibtex-field-indentation', field text starts in |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
3960 column `bibtex-text-indentation' and continuation lines start here, too. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3961 If `bibtex-align-at-equal-sign' is non-nil, align equal signs, too." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3962 (interactive "*") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3963 (let ((pnt (copy-marker (point))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3964 (end (copy-marker (bibtex-end-of-entry))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3965 bounds) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3966 (bibtex-beginning-of-entry) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3967 (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
|
3968 (indent-to-column bibtex-entry-offset) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
3969 (while (setq bounds (bibtex-search-forward-field bibtex-field-name end)) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
3970 (bibtex-fill-field-bounds bounds t t)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3971 (if (looking-at ",") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3972 (forward-char)) |
18247
ae094c1a4334
(bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents:
18212
diff
changeset
|
3973 (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
|
3974 (open-line 1) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3975 (forward-char) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3976 (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
|
3977 (goto-char pnt))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
3978 |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3979 (defun bibtex-realign () |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3980 "Realign BibTeX entries such that they are separated by one blank line." |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3981 (goto-char (point-min)) |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3982 (let ((case-fold-search t)) |
57815 | 3983 ;; No blank lines prior to the first valid entry if there no |
3984 ;; non-white characters in front of it. | |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3985 (when (looking-at bibtex-valid-entry-whitespace-re) |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3986 (replace-match "\\1")) |
57815 | 3987 ;; Valid entries are separated by one blank line. |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3988 (while (re-search-forward bibtex-valid-entry-whitespace-re nil t) |
57815 | 3989 (replace-match "\n\n\\1")) |
3990 ;; One blank line past the last valid entry if it is followed by | |
3991 ;; non-white characters, no blank line otherwise. | |
3992 (beginning-of-line) | |
3993 (when (re-search-forward bibtex-valid-entry-re nil t) | |
3994 (bibtex-end-of-entry) | |
3995 (bibtex-delete-whitespace) | |
3996 (open-line (if (eobp) 1 2))))) | |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3997 |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
3998 (defun bibtex-reformat (&optional read-options) |
19461 | 3999 "Reformat all BibTeX entries in buffer or region. |
57815 | 4000 Without prefix argument, reformatting is based on `bibtex-entry-format'. |
19461 | 4001 With prefix argument, read options for reformatting from minibuffer. |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4002 With \\[universal-argument] \\[universal-argument] prefix argument, reuse previous answers (if any) again. |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4003 If mark is active reformat entries in region, if not in whole buffer." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4004 (interactive "*P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4005 (let* ((pnt (point)) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4006 (use-previous-options |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4007 (and (equal (prefix-numeric-value read-options) 16) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4008 (or bibtex-reformat-previous-options |
27701
5e135f0faf1d
(bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents:
26711
diff
changeset
|
4009 bibtex-reformat-previous-reference-keys))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4010 (bibtex-entry-format |
57815 | 4011 (cond (read-options |
4012 (if use-previous-options | |
4013 bibtex-reformat-previous-options | |
4014 (setq bibtex-reformat-previous-options | |
4015 (mapcar (lambda (option) | |
4016 (if (y-or-n-p (car option)) (cdr option))) | |
4017 `(("Realign entries (recommended)? " . 'realign) | |
4018 ("Remove empty optional and alternative fields? " . 'opts-or-alts) | |
4019 ("Remove delimiters around pure numerical fields? " . 'numerical-fields) | |
4020 (,(concat (if bibtex-comma-after-last-field "Insert" "Remove") | |
4021 " comma at end of entry? ") . 'last-comma) | |
4022 ("Replace double page dashes by single ones? " . 'page-dashes) | |
4023 ("Inherit booktitle? " . 'inherit-booktitle) | |
4024 ("Force delimiters? " . 'delimiters) | |
4025 ("Unify case of entry types and field names? " . 'unify-case)))))) | |
4026 ;; Do not include required-fields because `bibtex-reformat' | |
4027 ;; cannot handle the error messages of `bibtex-format-entry'. | |
4028 ;; Use `bibtex-validate' to check for required fields. | |
4029 ((eq t bibtex-entry-format) | |
4030 '(realign opts-or-alts numerical-fields delimiters | |
4031 last-comma page-dashes unify-case inherit-booktitle)) | |
4032 (t | |
4033 (remove 'required-fields (push 'realign bibtex-entry-format))))) | |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4034 (reformat-reference-keys |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4035 (if read-options |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4036 (if use-previous-options |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4037 bibtex-reformat-previous-reference-keys |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4038 (setq bibtex-reformat-previous-reference-keys |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4039 (y-or-n-p "Generate new reference keys automatically? "))))) |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4040 (bibtex-sort-ignore-string-entries t) |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4041 bibtex-autokey-edit-before-use) |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4042 |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4043 (save-restriction |
57815 | 4044 (narrow-to-region (if mark-active (region-beginning) (point-min)) |
4045 (if mark-active (region-end) (point-max))) | |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4046 (if (memq 'realign bibtex-entry-format) |
57815 | 4047 (bibtex-realign)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4048 (bibtex-progress-message "Formatting" 1) |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
4049 (bibtex-map-entries (lambda (key beg end) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4050 (bibtex-progress-message) |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4051 (bibtex-clean-entry reformat-reference-keys t))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4052 (bibtex-progress-message 'done)) |
57815 | 4053 (when reformat-reference-keys |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4054 (kill-local-variable 'bibtex-reference-keys) |
57815 | 4055 (when bibtex-maintain-sorted-entries |
4056 (bibtex-progress-message "Sorting" 1) | |
4057 (bibtex-sort-buffer) | |
4058 (bibtex-progress-message 'done))) | |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4059 (goto-char pnt))) |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4060 |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4061 (defun bibtex-convert-alien (&optional read-options) |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
4062 "Make an alien BibTeX buffer fully usable by BibTeX mode. |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4063 If a file does not conform with all standards used by BibTeX mode, |
58772
4de7ab2c086e
(bibtex-font-lock-url-regexp):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58556
diff
changeset
|
4064 some of the high-level features of BibTeX mode are not available. |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4065 This function tries to convert current buffer to conform with these standards. |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4066 With prefix argument READ-OPTIONS non-nil, read options for reformatting |
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4067 entries from minibuffer." |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4068 (interactive "*P") |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4069 (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
|
4070 (sit-for 1 nil t) |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4071 (bibtex-realign) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4072 (message |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4073 "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
|
4074 (sit-for 5 nil t) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4075 (deactivate-mark) ; So bibtex-validate works on the whole buffer. |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4076 (when (let (bibtex-maintain-sorted-entries) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4077 (bibtex-validate)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4078 (message "Starting to reformat entries...") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4079 (sit-for 2 nil t) |
55312
3b7a4fa9b2d8
(bibtex-sort-buffer): Remove error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52891
diff
changeset
|
4080 (bibtex-reformat read-options) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4081 (goto-char (point-max)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4082 (message "Buffer is now parsable. Please save it."))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4083 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4084 (defun bibtex-complete () |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4085 "Complete word fragment before point according to context. |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
4086 If point is inside key or crossref field perform key completion based on |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4087 `bibtex-reference-keys'. Inside a month field perform key completion |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4088 based on `bibtex-predefined-month-strings'. Inside any other field |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4089 perform string completion based on `bibtex-strings'. An error is |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4090 signaled if point is outside key or BibTeX field." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4091 (interactive) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4092 (let ((pnt (point)) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4093 (case-fold-search t) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4094 bounds name compl) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4095 (save-excursion |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4096 (if (and (setq bounds (bibtex-enclosing-field t)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4097 (>= pnt (bibtex-start-of-text-in-field bounds)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4098 (<= pnt (bibtex-end-of-text-in-field bounds))) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4099 (setq name (bibtex-name-in-field bounds t) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4100 compl (cond ((bibtex-string= name "crossref") |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4101 ;; point is in crossref field |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4102 'crossref-key) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4103 ((bibtex-string= name "month") |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4104 ;; point is in month field |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4105 bibtex-predefined-month-strings) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4106 ;; point is in other field |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4107 (t (if (listp bibtex-strings) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4108 bibtex-strings |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4109 ;; so that bibtex-complete-string-cleanup |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4110 ;; can do its job |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4111 (bibtex-parse-strings |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4112 (bibtex-string-files-init)))))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4113 (bibtex-beginning-of-entry) |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4114 (cond ((and (looking-at bibtex-string-maybe-empty-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4115 ;; point is inside a string key |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4116 (or (and (match-beginning bibtex-key-in-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4117 (>= pnt (match-beginning bibtex-key-in-head)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4118 (<= pnt (match-end bibtex-key-in-head))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4119 ;; or point is on empty string key |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4120 (and (not (match-beginning bibtex-key-in-head)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4121 (= pnt (match-end 0))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4122 (setq compl 'string)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4123 ((and (looking-at bibtex-entry-maybe-empty-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4124 ;; point is inside a key |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4125 (or (and (match-beginning bibtex-key-in-head) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4126 (>= pnt (match-beginning bibtex-key-in-head)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4127 (<= pnt (match-end bibtex-key-in-head))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4128 ;; or point is on empty key |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4129 (and (not (match-beginning bibtex-key-in-head)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4130 (= pnt (match-end 0))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4131 (setq compl 'key))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4132 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4133 (cond ((eq compl 'key) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4134 ;; key completion: no cleanup needed |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4135 (let (completion-ignore-case) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4136 (bibtex-complete-internal (bibtex-global-key-alist)))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4137 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4138 ((eq compl 'crossref-key) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4139 ;; crossref key completion |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4140 (let (completion-ignore-case) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4141 (setq choose-completion-string-functions |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4142 (lambda (choice buffer mini-p base-size) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4143 (let ((choose-completion-string-functions nil)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4144 (choose-completion-string choice buffer base-size)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4145 (bibtex-complete-crossref-cleanup choice) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4146 ;; return t (needed by choose-completion-string-functions) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4147 t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4148 (bibtex-complete-crossref-cleanup (bibtex-complete-internal |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4149 (bibtex-global-key-alist))))) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4150 |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4151 ((eq compl 'string) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4152 ;; string key completion: no cleanup needed |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4153 (let ((completion-ignore-case t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4154 (bibtex-complete-internal bibtex-strings))) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4155 |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4156 (compl |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4157 ;; string completion |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4158 (let ((completion-ignore-case t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4159 (setq choose-completion-string-functions |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4160 `(lambda (choice buffer mini-p base-size) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4161 (let ((choose-completion-string-functions nil)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4162 (choose-completion-string choice buffer base-size)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4163 (bibtex-complete-string-cleanup choice ',compl) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4164 ;; return t (needed by choose-completion-string-functions) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4165 t)) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4166 (bibtex-complete-string-cleanup (bibtex-complete-internal compl) |
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4167 compl))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4168 |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4169 (t (error "Point outside key or BibTeX field"))))) |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4170 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4171 (defun bibtex-Article () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4172 "Insert a new BibTeX @Article entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4173 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4174 (bibtex-entry "Article")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4175 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4176 (defun bibtex-Book () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4177 "Insert a new BibTeX @Book entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4178 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4179 (bibtex-entry "Book")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4180 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4181 (defun bibtex-Booklet () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4182 "Insert a new BibTeX @Booklet entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4183 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4184 (bibtex-entry "Booklet")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4185 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4186 (defun bibtex-InBook () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4187 "Insert a new BibTeX @InBook entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4188 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4189 (bibtex-entry "InBook")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4190 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4191 (defun bibtex-InCollection () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4192 "Insert a new BibTeX @InCollection entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4193 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4194 (bibtex-entry "InCollection")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4195 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4196 (defun bibtex-InProceedings () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4197 "Insert a new BibTeX @InProceedings entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4198 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4199 (bibtex-entry "InProceedings")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4200 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4201 (defun bibtex-Manual () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4202 "Insert a new BibTeX @Manual entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4203 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4204 (bibtex-entry "Manual")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4205 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4206 (defun bibtex-MastersThesis () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4207 "Insert a new BibTeX @MastersThesis entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4208 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4209 (bibtex-entry "MastersThesis")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4210 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4211 (defun bibtex-Misc () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4212 "Insert a new BibTeX @Misc entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4213 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4214 (bibtex-entry "Misc")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4215 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4216 (defun bibtex-PhdThesis () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4217 "Insert a new BibTeX @PhdThesis entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4218 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4219 (bibtex-entry "PhdThesis")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4220 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4221 (defun bibtex-Proceedings () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4222 "Insert a new BibTeX @Proceedings entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4223 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4224 (bibtex-entry "Proceedings")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4225 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4226 (defun bibtex-TechReport () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4227 "Insert a new BibTeX @TechReport entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4228 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4229 (bibtex-entry "TechReport")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4230 |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4231 (defun bibtex-Unpublished () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4232 "Insert a new BibTeX @Unpublished entry; see also `bibtex-entry'." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4233 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4234 (bibtex-entry "Unpublished")) |
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4235 |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4236 (defun bibtex-String (&optional key) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4237 "Insert a new BibTeX @String entry with key KEY." |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4238 (interactive (list (bibtex-read-string-key))) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4239 (let ((bibtex-maintain-sorted-entries |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4240 (unless bibtex-sort-ignore-string-entries |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4241 bibtex-maintain-sorted-entries)) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4242 endpos) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4243 (unless (bibtex-prepare-new-entry (list key nil "String")) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4244 (error "Entry with key `%s' already exists" key)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4245 (if (zerop (length key)) (setq key nil)) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4246 (indent-to-column bibtex-entry-offset) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4247 (insert "@String" |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4248 (bibtex-entry-left-delimiter)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4249 (if key |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4250 (insert key) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4251 (setq endpos (point))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4252 (insert " = " |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4253 (bibtex-field-left-delimiter)) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4254 (if key |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4255 (setq endpos (point))) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4256 (insert (bibtex-field-right-delimiter) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4257 (bibtex-entry-right-delimiter) |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4258 "\n") |
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4259 (goto-char endpos))) |
18212
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4260 |
3864648e9b4f
(bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents:
17700
diff
changeset
|
4261 (defun bibtex-Preamble () |
22563
2e2a71dfec63
Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents:
21169
diff
changeset
|
4262 "Insert a new BibTeX @Preamble entry." |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4263 (interactive "*") |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4264 (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
|
4265 (indent-to-column bibtex-entry-offset) |
51415
762217a72cae
Long overdue merge.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49599
diff
changeset
|
4266 (insert "@Preamble" |
51743
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
4267 (bibtex-entry-left-delimiter)) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
4268 (let ((endpos (point))) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
4269 (insert (bibtex-entry-right-delimiter) |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
4270 "\n") |
f63c242330b2
2003-06-30 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
51416
diff
changeset
|
4271 (goto-char endpos))) |
257 | 4272 |
57815 | 4273 (defun bibtex-url (&optional pos) |
4274 "Browse a URL for the BibTeX entry at point. | |
4275 Optional POS is the location of the BibTeX entry. | |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4276 The URL is generated using the schemes defined in `bibtex-generate-url-list' |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
4277 \(see there\). Then the URL is passed to `browse-url'." |
57815 | 4278 (interactive) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4279 (save-excursion |
57815 | 4280 (if pos (goto-char pos)) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4281 (bibtex-beginning-of-entry) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4282 (let ((fields-alist (bibtex-parse-entry)) |
57815 | 4283 ;; Always ignore case, |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4284 (case-fold-search t) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4285 (lst bibtex-generate-url-list) |
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4286 field url scheme) |
57815 | 4287 (while (setq scheme (pop lst)) |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
4288 (when (and (setq field (cdr (assoc-string (caar scheme) |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
4289 fields-alist t))) |
57815 | 4290 ;; Always remove field delimiters |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4291 (progn (setq field (bibtex-remove-delimiters-string field)) |
57815 | 4292 (string-match (cdar scheme) field))) |
4293 (setq lst nil) | |
57070
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
4294 (if (null (cdr scheme)) |
3d9707888790
(bibtex-generate-url-list): Change format. Provide a sample complex default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57054
diff
changeset
|
4295 (setq url (match-string 0 field))) |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4296 (dolist (step (cdr scheme)) |
57815 | 4297 (cond ((stringp step) |
4298 (setq url (concat url step))) | |
4299 ((setq field (cdr (assoc-string (car step) fields-alist t))) | |
4300 ;; Always remove field delimiters | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4301 (setq field (bibtex-remove-delimiters-string field)) |
57815 | 4302 (if (string-match (nth 1 step) field) |
4303 (setq field (cond | |
4304 ((functionp (nth 2 step)) | |
4305 (funcall (nth 2 step) field)) | |
4306 ((numberp (nth 2 step)) | |
4307 (match-string (nth 2 step) field)) | |
4308 (t | |
58556
8ff63943e93e
(bibtex-sort-entry-class)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57833
diff
changeset
|
4309 (replace-match (nth 2 step) t nil field)))) |
57815 | 4310 ;; If the scheme is set up correctly, |
4311 ;; we should never reach this point | |
4312 (error "Match failed: %s" field)) | |
4313 (setq url (concat url field))) | |
4314 ;; If the scheme is set up correctly, | |
4315 ;; we should never reach this point | |
4316 (t (error "Step failed: %s" step)))) | |
4317 (message "%s" url) | |
4318 (browse-url url))) | |
4319 (unless url (message "No URL known."))))) | |
57054
0b058857c704
(bibtex-mark-active, bibtex-run-with-idle-timer): Move `if' inside the defun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55880
diff
changeset
|
4320 |
257 | 4321 |
12700
b3a8ee2da96a
Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents:
12028
diff
changeset
|
4322 ;; Make BibTeX a Feature |
257 | 4323 |
10219
d97313bb6f39
(bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents:
10106
diff
changeset
|
4324 (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
|
4325 |
55348
c1f70dc19ce5
(bibtex-progress-message): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55312
diff
changeset
|
4326 ;; arch-tag: ee2be3af-caad-427f-b42a-d20fad630d04 |
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
|
4327 ;;; bibtex.el ends here |