1 ;;; bibtex.el --- BibTeX mode for GNU Emacs
3 ;; Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
5 ;; Author: Stefan Schoef <schoef@informatik.uni-oldenburg.de>
6 ;; Bengt Martensson <ubrinf!mond!bengt>
7 ;; Mark Shapiro <shapiro@corto.inria.fr>
8 ;; Mike Newton <newton@gumby.cs.caltech.edu>
9 ;; Aaron Larson <alarson@src.honeywell.com>
10 ;; Maintainer: Stefan Schoef <schoef@informatik.uni-oldenburg.de>
11 ;; Keywords: BibTeX, LaTeX, TeX
13 ;; This file is part of GNU Emacs.
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
20 ;; GNU Emacs is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;; GNU General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to
27 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
30 ;; Major mode for editing and validating BibTeX files.
33 ;; See documentation for function bibtex-mode (or type "\M-x describe-mode"
34 ;; when you are in bibtex-mode).
37 ;; Distribute texinfo file.
40 ;; 1. using regular expressions to match the entire BibTeX entry dies
41 ;; on long entries (e.g. those containing abstracts) since
42 ;; the length of regular expression matches is fairly limited.
43 ;; 2. Calling bibtex-find-text in a string entry results in the
44 ;; error message "Can't find enclosing Bibtex field" instead of
45 ;; moving to the empty string. [reported by gernot@cs.unsw.oz.au]
47 ;; (current keeper: schoef@informatik.uni-oldenburg.de
48 ;; previous: alarson@src.honeywell.com)
53 (defvar bibtex-field-left-delimiter "{"
54 "*Set this to { or \" according to your personal preferences.
55 This variable is buffer local.")
56 (make-variable-buffer-local 'bibtex-field-left-delimiter)
58 (defvar bibtex-field-right-delimiter "}"
59 "*Set this to } or \" according to your personal preferences.
60 This variable is buffer local.")
61 (make-variable-buffer-local 'bibtex-field-right-delimiter)
63 (defvar bibtex-include-OPTcrossref '("InProceedings" "InCollection")
64 "*All entries listed here will have an OPTcrossref field.")
66 (defvar bibtex-include-OPTkey t
67 "*If non-nil, all entries will have an OPTkey field.")
69 (defvar bibtex-include-OPTannote t
70 "*If non-nil, all entries will have an OPTannote field.")
72 (defvar bibtex-mode-user-optional-fields nil
73 "*List of optional fields the user wants to have always present.
74 Entries should be lists of strings with two elements (first element =
75 name of the field, second element = comment to appear in the echo area).")
77 (defvar bibtex-clean-entry-zap-empty-opts t
78 "*If non-nil, bibtex-clean-entry will delete all empty optional fields.")
80 (defvar bibtex-sort-ignore-string-entries t
81 "*If true, BibTeX @STRING entries are not sort-significant.
82 That means they are ignored when determining ordering of the buffer
83 (e.g. sorting, locating alphabetical position for new entries, etc.).")
85 (defvar bibtex-maintain-sorted-entries nil
86 "*If true, bibtex-mode maintains all BibTeX entries in sorted order.
87 Setting this variable to nil will strip off some comfort (e.g. TAB
88 completion for reference keys) from bibtex-mode.")
90 (defvar bibtex-entry-field-alist
92 ("Article" . (((("author" "Author1 [and Author2 ...] [and others]")
93 ("title" "Title of the article (will be converted to lowercase)")
94 ("journal" "Name of the journal (use string, remove braces)")
95 ("year" "Year of publication"))
96 (("volume" "Volume of the journal")
97 ("number" "Number of the journal")
98 ("month" "Month of the publication as a string (remove braces)")
99 ("pages" "Pages in the journal")
100 ("note" "Remarks to be put at the end of the \\bibitem")))
101 ((("author" "Author1 [and Author2 ...] [and others]")
102 ("title" "Title of the article (will be converted to lowercase)"))
103 (("journal" "Name of the journal (use string, remove braces)")
104 ("year" "Year of publication")
105 ("volume" "Volume of the journal")
106 ("number" "Number of the journal")
107 ("month" "Month of the publication as a string (remove braces)")
108 ("pages" "Pages in the journal")
109 ("note" "Remarks to be put at the end of the \\bibitem")))))
110 ("Book" . (((("author" "Author1 [and Author2 ...] [and others]")
111 ("title" "Title of the book")
112 ("publisher" "Publishing company")
113 ("year" "Year of publication"))
114 (("editor" "Editor1 [and Editor2 ...] [and others]")
115 ("volume" "Volume of the book in the series")
116 ("number" "Number of the book in a small series (overwritten by volume)")
117 ("series" "Series in which the book appeared")
118 ("address" "Address of the publisher")
119 ("edition" "Edition of the book as a capitalized English word")
120 ("month" "Month of the publication as a string (remove braces)")
121 ("note" "Remarks to be put at the end of the \\bibitem")))))
122 ("Booklet" . (((("title" "Title of the booklet (will be converted to lowercase)"))
123 (("author" "Author1 [and Author2 ...] [and others]")
124 ("howpublished" "The way in which the booklet was published")
125 ("address" "Address of the publisher")
126 ("year" "Year of publication")
127 ("month" "Month of the publication as a string (remove braces)")
128 ("note" "Remarks to be put at the end of the \\bibitem")))))
129 ("InBook" . (((("author" "Author1 [and Author2 ...] [and others]")
130 ("title" "Title of the book")
131 ("chapter" "Chapter in the book")
132 ("publisher" "Publishing company")
133 ("year" "Year of publication"))
134 (("editor" "Editor1 [and Editor2 ...] [and others]")
135 ("volume" "Volume of the book in the series")
136 ("number" "Number of the book in a small series (overwritten by volume)")
137 ("series" "Series in which the book appeared")
138 ("address" "Address of the publisher")
139 ("edition" "Edition of the book as a capitalized English word")
140 ("month" "Month of the publication as a string (remove braces)")
141 ("pages" "Pages in the book")
142 ("type" "Word to use instead of \"chapter\"")
143 ("note" "Remarks to be put at the end of the \\bibitem")))
144 ((("author" "Author1 [and Author2 ...] [and others]")
145 ("title" "Title of the book")
146 ("chapter" "Chapter in the book"))
147 (("publisher" "Publishing company")
148 ("year" "Year of publication")
149 ("editor" "Editor1 [and Editor2 ...] [and others]")
150 ("volume" "Volume of the book in the series")
151 ("number" "Number of the book in a small series (overwritten by volume)")
152 ("series" "Series in which the book appeared")
153 ("address" "Address of the publisher")
154 ("edition" "Edition of the book as a capitalized English word")
155 ("month" "Month of the publication as a string (remove braces)")
156 ("pages" "Pages in the book")
157 ("type" "Word to use instead of \"chapter\"")
158 ("note" "Remarks to be put at the end of the \\bibitem")))))
159 ("InCollection" . (((("author" "Author1 [and Author2 ...] [and others]")
160 ("title" "Title of the article in book (will be converted to lowercase)")
161 ("booktitle" "Name of the book")
162 ("publisher" "Publishing company")
163 ("year" "Year of publication"))
164 (("editor" "Editor1 [and Editor2 ...] [and others]")
165 ("volume" "Volume of the book in the series")
166 ("number" "Number of the book in a small series (overwritten by volume)")
167 ("series" "Series in which the book appeared")
168 ("chapter" "Chapter in the book")
169 ("type" "Word to use instead of \"chapter\"")
170 ("address" "Address of the publisher")
171 ("edition" "Edition of the book as a capitalized English word")
172 ("month" "Month of the publication as a string (remove braces)")
173 ("pages" "Pages in the book")
174 ("note" "Remarks to be put at the end of the \\bibitem")))
175 ((("author" "Author1 [and Author2 ...] [and others]")
176 ("title" "Title of the article in book (will be converted to lowercase)")
177 ("booktitle" "Name of the book"))
178 (("publisher" "Publishing company")
179 ("year" "Year of publication")
180 ("editor" "Editor1 [and Editor2 ...] [and others]")
181 ("volume" "Volume of the book in the series")
182 ("number" "Number of the book in a small series (overwritten by volume)")
183 ("series" "Series in which the book appeared")
184 ("chapter" "Chapter in the book")
185 ("type" "Word to use instead of \"chapter\"")
186 ("address" "Address of the publisher")
187 ("edition" "Edition of the book as a capitalized English word")
188 ("month" "Month of the publication as a string (remove braces)")
189 ("pages" "Pages in the book")
190 ("note" "Remarks to be put at the end of the \\bibitem")))))
191 ("InProceedings" . (((("author" "Author1 [and Author2 ...] [and others]")
192 ("title" "Title of the article in proceedings (will be converted to lowercase)")
193 ("booktitle" "Name of the conference proceedings")
194 ("year" "Year of publication"))
195 (("editor" "Editor1 [and Editor2 ...] [and others]")
196 ("volume" "Volume of the conference proceedings in the series")
197 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
198 ("series" "Series in which the conference proceedings appeared")
199 ("organization" "Sponsoring organization of the conference")
200 ("publisher" "Publishing company, its location")
201 ("address" "Location of the Proceedings")
202 ("month" "Month of the publication as a string (remove braces)")
203 ("pages" "Pages in the conference proceedings")
204 ("note" "Remarks to be put at the end of the \\bibitem")))
205 ((("author" "Author1 [and Author2 ...] [and others]")
206 ("title" "Title of the article in proceedings (will be converted to lowercase)")
207 ("booktitle" "Name of the conference proceedings"))
208 (("editor" "Editor1 [and Editor2 ...] [and others]")
209 ("volume" "Volume of the conference proceedings in the series")
210 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
211 ("series" "Series in which the conference proceedings appeared")
212 ("year" "Year of publication")
213 ("organization" "Sponsoring organization of the conference")
214 ("publisher" "Publishing company, its location")
215 ("address" "Location of the Proceedings")
216 ("month" "Month of the publication as a string (remove braces)")
217 ("pages" "Pages in the conference proceedings")
218 ("note" "Remarks to be put at the end of the \\bibitem")))))
219 ("Manual" . (((("title" "Title of the manual"))
220 (("author" "Author1 [and Author2 ...] [and others]")
221 ("organization" "Publishing organization of the manual")
222 ("address" "Address of the organization")
223 ("edition" "Edition of the manual as a capitalized English word")
224 ("year" "Year of publication")
225 ("month" "Month of the publication as a string (remove braces)")
226 ("note" "Remarks to be put at the end of the \\bibitem")))))
228 ("MastersThesis" . (((("author" "Author1 [and Author2 ...] [and others]")
229 ("title" "Title of the master\'s thesis (will be converted to lowercase)")
230 ("school" "School where the master\'s thesis was written")
231 ("year" "Year of publication"))
232 (("address" "Address of the school (if not part of field \"school\") or country")
233 ("type" "Type of the master\'s thesis")
234 ("month" "Month of the publication as a string (remove braces)")
235 ("note" "Remarks to be put at the end of the \\bibitem")))))
237 (("author" "Author1 [and Author2 ...] [and others]")
238 ("title" "Title of the reference (will be converted to lowercase)")
239 ("howpublished" "The way in which the reference was published")
240 ("year" "Year of publication")
241 ("month" "Month of the publication as a string (remove braces)")
242 ("note" "Remarks to be put at the end of the \\bibitem")))))
243 ("PhdThesis" . (((("author" "Author1 [and Author2 ...] [and others]")
244 ("title" "Title of the PhD. thesis")
245 ("school" "School where the PhD. thesis was written")
246 ("year" "Year of publication"))
247 (("address" "Address of the school (if not part of field \"school\") or country")
248 ("type" "Type of the PhD. thesis")
249 ("month" "Month of the publication as a string (remove braces)")
250 ("note" "Remarks to be put at the end of the \\bibitem")))))
251 ("Proceedings" . (((("title" "Title of the conference proceedings")
252 ("year" "Year of publication"))
253 (("editor" "Editor1 [and Editor2 ...] [and others]")
254 ("volume" "Volume of the conference proceedings in the series")
255 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
256 ("series" "Series in which the conference proceedings appeared")
257 ("publisher" "Publishing company, its location")
258 ("organization" "Sponsoring organization of the conference")
259 ("address" "Location of the Proceedings")
260 ("month" "Month of the publication as a string (remove braces)")
261 ("note" "Remarks to be put at the end of the \\bibitem")))))
262 ("TechReport" . (((("author" "Author1 [and Author2 ...] [and others]")
263 ("title" "Title of the technical report (will be converted to lowercase)")
264 ("institution" "Sponsoring institution of the report")
265 ("year" "Year of publication"))
266 (("type" "Type of the report (if other than \"technical report\")")
267 ("number" "Number of the technical report")
268 ("address" "Address of the institution (if not part of field \"institution\") or country")
269 ("month" "Month of the publication as a string (remove braces)")
270 ("note" "Remarks to be put at the end of the \\bibitem")))))
271 ("Unpublished" . (((("author" "Author1 [and Author2 ...] [and others]")
272 ("title" "Title of the unpublished reference (will be converted to lowercase)")
273 ("note" "Remarks to be put at the end of the \\bibitem"))
274 (("year" "Year of publication")
275 ("month" "Month of the publication as a string (remove braces)")))))
278 "Defines reference types and their associated fields.
280 (entry-name (required optional) (crossref-required crossref-optional))
282 If the third element is nil, the first pair is always to be used.
283 If not, the second pair is to be used in the case of presence of a
284 crossref field and the third in the case of absence.
285 Required , optional, crossref-required and crossref-optional are lists.
286 Each element of these lists is a list of strings with two elements
287 (first element = name of the field,
288 second element = comment to appear in the echo area).")
290 (defvar bibtex-predefined-strings
292 ("jan") ("feb") ("mar") ("apr") ("may") ("jun") ("jul") ("aug")
293 ("sep") ("oct") ("nov") ("dec")
294 ("acmcs") ("acta") ("cacm") ("ibmjrd") ("ibmsj") ("ieeese")
295 ("ieeetc") ("ieeetcad") ("ipl") ("jacm") ("jcss") ("scp")
296 ("sicomp") ("tcs") ("tocs") ("tods") ("tog") ("toms") ("toois")
299 "Alist of string definitions.
300 Should contain the strings defined in the BibTeX style files. Each
301 element is a list with just one element: the string.")
303 (defvar bibtex-string-files nil
304 "*List of BibTeX files containing string definitions.
305 Those files must be specified using pathnames relative to the
306 directories specified in $BIBINPUTS. This variable is only evaluated
307 when bibtex-mode is entered (i. e. when loading the BibTeX file).")
309 (defvar bibtex-help-message t
310 "*If not nil print help messages in the echo area on entering a new field.")
312 (defvar bibtex-autokey-names 1
313 "*Number of names to use for the automatically generated reference key.
314 If this is set to anything but a number, all names are used.
315 See the documentation of function bibtex-generate-autokey for further detail.")
317 (defvar bibtex-autokey-name-change-strings
318 '(("\\\\\\\"a" "ae") ("\\\\\\\"o" "oe") ("\\\\\\\"u" "ue")
320 ("\\\\\\\"A" "Ae") ("\\\\\\\"O" "Oe") ("\\\\\\\"U" "Ue")
322 "Alist of (old-regexp new-string) pairs.
323 Any part of name matching a old-regexp is replaced by new-string.
324 Case of the old-regexp is significant. All regexps are tried in the
325 order in which they appear in the list, so be sure to avoid recursion here.
326 See the documentation of function bibtex-generate-autokey for further detail.")
328 (defvar bibtex-autokey-name-length 'infty
329 "*Number of characters from name to incorporate into key.
330 If this is set to anything but a number, all characters are used.
331 See the documentation of function bibtex-generate-autokey for further detail.")
333 (defvar bibtex-autokey-name-separator ""
334 "*String that comes between any two names in the key.
335 See the documentation of function bibtex-generate-autokey for further detail.")
337 (defvar bibtex-autokey-year-length 2
338 "*Number of rightmost digits from the year field yo incorporate into key.
339 See the documentation of function bibtex-generate-autokey for further detail.")
341 (defvar bibtex-autokey-titlewords 5
342 "*Number of title words to use for the automatically generated reference key.
343 If this is set to anything but a number, all title words are used.
344 See the documentation of function bibtex-generate-autokey for further detail.")
346 (defvar bibtex-autokey-title-terminators
347 '("\\." "!" "\\?" ":" ";" "---")
348 "*Regexp list defining the termination of the main part of the title.
349 Case of the regexps is ignored.
350 See the documentation of function bibtex-generate-autokey for further detail.")
352 (defvar bibtex-autokey-titlewords-stretch 2
353 "*Number of words that can additionally be used from the title.
354 These words are used only, if a sentence from the title can be ended then.
355 See the documentation of function bibtex-generate-autokey for further detail.")
357 (defvar bibtex-autokey-titleword-first-ignore
358 '("a" "an" "on" "the" "eine?" "der" "die" "das")
359 "*Determines words that may begin a title but are not to be used in the key.
360 Each item of the list is a regexp. If the first word of the title matchs a
361 regexp from that list, it is not included in the title, even if it is
362 capitalized. Regexps in the list must be entered using lowercase letters.")
364 (defvar bibtex-autokey-titleword-abbrevs nil
365 "*Determines exceptions to the usual abbreviation mechanism.
366 A list of (old-regexp new-string) pairs.
367 Use all lowercase letters for old-regexp.
368 See the documentation of function bibtex-generate-autokey for further detail.")
370 (defvar bibtex-autokey-titleword-change-strings
371 '(("\\\\\\\"a" "ae") ("\\\\\\\"o" "oe") ("\\\\\\\"u" "ue")
373 ("\\\\\\\"A" "Ae") ("\\\\\\\"O" "Oe") ("\\\\\\\"U" "Ue")
375 "Alist of (old-regexp new-string) pairs.
376 Any part of title word matching a old-regexp is replaced by new-string.
377 Case of the old-regexp is significant.
378 See the documentation of function bibtex-generate-autokey for further detail.")
380 (defvar bibtex-autokey-titleword-length 5
381 "*Number of characters from title words to incorporate into key.
382 If this is set to anything but a number, all characters are used.
383 See the documentation of function bibtex-generate-autokey for further detail.")
385 (defvar bibtex-autokey-titleword-separator "_"
386 "*String to be put between the title words.
387 See the documentation of function bibtex-generate-autokey for further detail.")
389 (defvar bibtex-autokey-name-year-separator ""
390 "*String to be put between name part and year part of key.
391 See the documentation of function bibtex-generate-autokey for further detail.")
393 (defvar bibtex-autokey-year-title-separator ":_"
394 "*String to be put between name part and year part of key.
395 See the documentation of function bibtex-generate-autokey for further detail.")
397 (defvar bibtex-autokey-edit-before-use t
398 "*If non-nil, user is allowed to edit the generated key before it is used.")
402 ;; Syntax Table, Keybindings and BibTeX Entry List
403 (defvar bibtex-mode-syntax-table
404 (let ((st (make-syntax-table)))
405 ;; [alarson:19920214.1004CST] make double quote a string quote
406 (modify-syntax-entry ?\" "\"" st)
407 (modify-syntax-entry ?$ "$$ " st)
408 (modify-syntax-entry ?% "< " st)
409 (modify-syntax-entry ?' "w " st)
410 (modify-syntax-entry ?@ "w " st)
411 (modify-syntax-entry ?\\ "\\" st)
412 (modify-syntax-entry ?\f "> " st)
413 (modify-syntax-entry ?\n "> " st)
414 (modify-syntax-entry ?~ " " st)
417 (defvar bibtex-mode-map
418 (let ((km (make-sparse-keymap)))
420 (define-key km "\t" 'bibtex-find-text)
421 (define-key km "\n" 'bibtex-next-field)
422 (define-key km "\M-\t" 'bibtex-complete-string)
423 (define-key km "\C-c\"" 'bibtex-remove-double-quotes-or-braces)
424 (define-key km "\C-c{" 'bibtex-remove-double-quotes-or-braces)
425 (define-key km "\C-c}" 'bibtex-remove-double-quotes-or-braces)
426 (define-key km "\C-c\C-c" 'bibtex-clean-entry)
427 (define-key km "\C-c?" 'bibtex-print-help-message)
428 (define-key km "\C-c\C-p" 'bibtex-pop-previous)
429 (define-key km "\C-c\C-n" 'bibtex-pop-next)
430 (define-key km "\C-c\C-k" 'bibtex-kill-optional-field)
431 (define-key km "\C-c\C-d" 'bibtex-empty-field)
432 (define-key km "\C-c$" 'bibtex-ispell-entry)
433 (define-key km "\M-\C-a" 'bibtex-beginning-of-entry)
434 (define-key km "\M-\C-e" 'bibtex-end-of-entry)
435 (define-key km "\C-c\C-b" 'bibtex-entry)
436 (define-key km "\C-c\C-q" 'bibtex-hide-entry-bodies)
437 (define-key km "\C-c\C-a" 'show-all)
438 (define-key km "\C-c\C-rn" 'bibtex-narrow-to-entry)
439 (define-key km "\C-c\C-rw" 'widen)
440 (define-key km "\C-c\C-o" 'bibtex-remove-OPT)
442 (define-key km "\C-c\C-e\C-i" 'bibtex-InProceedings)
443 (define-key km "\C-c\C-ei" 'bibtex-InCollection)
444 (define-key km "\C-c\C-eI" 'bibtex-InBook)
445 (define-key km "\C-c\C-e\C-a" 'bibtex-Article)
446 (define-key km "\C-c\C-e\C-b" 'bibtex-InBook)
447 (define-key km "\C-c\C-eb" 'bibtex-Book)
448 (define-key km "\C-c\C-eB" 'bibtex-Booklet)
449 (define-key km "\C-c\C-e\C-c" 'bibtex-InCollection)
450 (define-key km "\C-c\C-e\C-m" 'bibtex-Manual)
451 (define-key km "\C-c\C-em" 'bibtex-MastersThesis)
452 (define-key km "\C-c\C-eM" 'bibtex-Misc)
453 (define-key km "\C-c\C-e\C-p" 'bibtex-InProceedings)
454 (define-key km "\C-c\C-ep" 'bibtex-Proceedings)
455 (define-key km "\C-c\C-eP" 'bibtex-PhdThesis)
456 (define-key km "\C-c\C-e\M-p" 'bibtex-preamble)
457 (define-key km "\C-c\C-e\C-s" 'bibtex-string)
458 (define-key km "\C-c\C-e\C-t" 'bibtex-TechReport)
459 (define-key km "\C-c\C-e\C-u" 'bibtex-Unpublished)
462 (define-key bibtex-mode-map [menu-bar move/edit]
463 (cons "BibTeX-Edit" (make-sparse-keymap "BibTeX-Edit")))
464 (define-key bibtex-mode-map [menu-bar move/edit bibtex-print-help-message]
465 '("Help about Current Field" . bibtex-print-help-message))
466 (define-key bibtex-mode-map [menu-bar move/edit bibtex-complete-string]
467 '("String Complete" . bibtex-complete-string))
468 (define-key bibtex-mode-map [menu-bar move/edit bibtex-next-field]
469 '("Next Field" . bibtex-next-field))
470 (define-key bibtex-mode-map [menu-bar move/edit bibtex-find-text]
471 '("End of Field" . bibtex-find-text))
472 (define-key bibtex-mode-map [menu-bar move/edit bibtex-pop-previous]
473 '("Snatch from Similar Preceding Field" . bibtex-pop-previous))
474 (define-key bibtex-mode-map [menu-bar move/edit bibtex-pop-next]
475 '("Snatch from Similar Following Field" . bibtex-pop-next))
476 (define-key bibtex-mode-map [menu-bar move/edit bibtex-remove-OPT]
477 '("Remove OPT" . bibtex-remove-OPT))
478 (define-key bibtex-mode-map [menu-bar move/edit bibtex-remove-double-quotes-or-braces]
479 '("Remove Quotes or Braces" . bibtex-remove-double-quotes-or-braces))
480 (define-key bibtex-mode-map [menu-bar move/edit bibtex-clean-entry]
481 '("Clean Up Entry" . bibtex-clean-entry))
482 (define-key bibtex-mode-map [menu-bar move/edit bibtex-sort-entries]
483 '("Sort Entries" . bibtex-sort-entries))
484 (define-key bibtex-mode-map [menu-bar move/edit bibtex-validate-buffer]
485 '("Validate Entries" . bibtex-validate-buffer))
487 (define-key bibtex-mode-map [menu-bar entry-types]
488 (cons "Entry-Types" (make-sparse-keymap "Entry-Types")))
489 (define-key bibtex-mode-map [menu-bar entry-types bibtex-preamble]
490 '("Preamble" . bibtex-preamble))
491 (define-key bibtex-mode-map [menu-bar entry-types bibtex-string]
492 '("String" . bibtex-string))
493 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Misc]
494 '("Miscellaneous" . bibtex-Misc))
495 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Unpublished]
496 '("Unpublished" . bibtex-Unpublished))
497 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Manual]
498 '("Technical Manual" . bibtex-Manual))
499 (define-key bibtex-mode-map [menu-bar entry-types bibtex-TechReport]
500 '("Technical Report" . bibtex-TechReport))
501 (define-key bibtex-mode-map [menu-bar entry-types bibtex-MastersThesis]
502 '("Master's Thesis" . bibtex-MastersThesis))
503 (define-key bibtex-mode-map [menu-bar entry-types bibtex-PhdThesis]
504 '("PhD. Thesis" . bibtex-PhdThesis))
505 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Booklet]
506 '("Booklet (Bound, but no Publisher/Institution)" . bibtex-Booklet))
507 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Book]
508 '("Book" . bibtex-Book))
509 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Proceedings]
510 '("Conference Proceedings" . bibtex-Proceedings))
511 (define-key bibtex-mode-map [menu-bar entry-types bibtex-InBook]
512 '("Chapter or Pages in a Book" . bibtex-InBook))
513 (define-key bibtex-mode-map [menu-bar entry-types bibtex-InCollection]
514 '("Article in a Collection" . bibtex-InCollection))
515 (define-key bibtex-mode-map [menu-bar entry-types bibtex-InProceedings]
516 '("Article in Conference Proceedings" . bibtex-InProceedings))
517 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Article]
518 '("Article in Journal" . bibtex-Article))
522 ;; Internal Variables
524 (defvar bibtex-pop-previous-search-point nil)
525 ;; Next point where bibtex-pop-previous starts looking for a similar
528 (defvar bibtex-pop-next-search-point nil)
529 ;; Next point where bibtex-pop-next starts looking for a similar entry.
531 (defvar bibtex-completion-candidates nil)
532 ;; Candidates for bibtex-complete-string. Initialized from
533 ;; bibtex-predefined-strings and bibtex-string-files. This variable is
535 (make-variable-buffer-local 'bibtex-completion-candidates)
538 ;; Functions to Parse the BibTeX Entries
540 (defun bibtex-cfield (name text)
541 ;; Create a regexp for a BibTeX field of name NAME and text TEXT.
542 (concat ",[ \t\n]*\\("
544 "\\)[ \t\n]*=[ \t\n]*\\("
547 (defconst bibtex-name-in-cfield 1)
548 ;; The regexp subexpression number of the name part in bibtex-cfield.
550 (defconst bibtex-text-in-cfield 2)
551 ;; The regexp subexpression number of the text part in bibtex-cfield.
553 (defconst bibtex-field-name "[A-Za-z][]A-Za-z0-9.:;?!`'()/*@_+=-]*")
554 ;; Regexp defining the name part of a BibTeX field.
556 (defconst bibtex-field-const "[0-9A-Za-z][A-Za-z0-9:_+-]*"
557 "Format of a bibtex field constant.")
559 (defconst bibtex-field-string
562 "{\\(\\({\\(\\({[^}]*}\\)\\|\\([^{}]\\)\\)*}\\)\\|\\([^{}]\\)\\)*}"
563 ;; maximal twice nested {}
565 "\"[^\"]*[^\\\\]\"\\|\"\"\\)"))
566 ;; Match either a string or an empty string.
568 (defconst bibtex-field-string-or-const
569 (concat bibtex-field-const "\\|" bibtex-field-string))
570 ;; Match either bibtex-field-string or bibtex-field-const.
572 (defconst bibtex-field-text
574 "\\(" bibtex-field-string-or-const "\\)"
575 "\\([ \t\n]+#[ \t\n]+\\(" bibtex-field-string-or-const "\\)\\)*\\|"
577 ;; Regexp defining the text part of a BibTeX field: either a string,
578 ;; or an empty string, or a constant followed by one or more # /
579 ;; constant pairs. Also matches simple {...} patterns.
581 (defconst bibtex-field
582 (bibtex-cfield bibtex-field-name bibtex-field-text))
583 ;; Regexp defining the format of a BibTeX field.
585 (defconst bibtex-name-in-field bibtex-name-in-cfield)
586 ;; The regexp subexpression number of the name part in BibTeX-field.
588 (defconst bibtex-text-in-field bibtex-text-in-cfield)
589 ;; The regexp subexpression number of the text part in BibTeX-field.
591 (defconst bibtex-reference-type
593 ;; Regexp defining the type part of a BibTeX reference entry.
595 (defconst bibtex-reference-head
596 (concat "^\\( \\|\t\\)*\\("
597 bibtex-reference-type
601 ;; Regexp defining format of the header line of a BibTeX reference
604 (defconst bibtex-type-in-head 2)
605 ;; The regexp subexpression number of the type part in
606 ;; bibtex-reference-head.
608 (defconst bibtex-key-in-head 3)
609 ;; The regexp subexpression number of the key part in
610 ;; bibtex-reference-head.
612 (defconst bibtex-reference
613 (concat bibtex-reference-head
614 "\\([ \t\n]*" bibtex-field "\\)*"
616 ;; Regexp defining the format of a BibTeX reference entry.
618 (defconst bibtex-type-in-reference bibtex-type-in-head)
619 ;; The regexp subexpression number of the type part in
622 (defconst bibtex-key-in-reference bibtex-key-in-head)
623 ;; The regexp subexpression number of the key part in
626 (defconst bibtex-string
627 (concat "^[ \t]*@[sS][tT][rR][iI][nN][gG][ \t\n]*[({][ \t\n]*\\("
629 "\\)[ \t\n]*=[ \t\n]*\\("
632 ;; Regexp defining the format of a BibTeX string entry.
634 (defconst bibtex-name-in-string 1)
635 ;; The regexp subexpression of the name part in bibtex-string.
637 (defconst bibtex-text-in-string 2)
638 ;; The regexp subexpression of the text part in bibtex-string.
640 (defconst bibtex-name-alignment 2)
641 ;; Alignment for the name part in BibTeX fields. Chosen on aesthetic
644 (defconst bibtex-text-alignment (length " organization = "))
645 ;; Alignment for the text part in BibTeX fields. Equal to the space
646 ;; needed for the longest name part.
652 (defun assoc-ignore-case (string alist)
653 ;; Return non-nil if STRING is `equal' to the car of an element of
654 ;; LIST. Comparison is done with case ignored. The value is actually
655 ;; the element of LIST whose car is `equal' to STRING.
656 (or (assoc string alist)
660 (downcase (car (car alist))))))
661 (setq alist (cdr alist)))
664 (defun member-of-regexp (string list)
665 ;; Return non-nil if STRING is exactly matched by an element of
666 ;; LIST. This function is influenced by the actual value of
667 ;; `case-fold-search'. The value is actually the tail of LIST whose
668 ;; car matches STRING.
674 (concat "^" (car list) "$")
676 (setq list (cdr list)))
679 (defun assoc-of-regexp (string alist)
680 ;; Return non-nil if STRING is exactly matched by the car of an
681 ;; element of LIST. This function is influenced by the actual value
682 ;; of `case-fold-search'. The value is actually the element of LIST
683 ;; whose car matches STRING.
689 (concat "^" (car (car alist)) "$")
691 (setq alist (cdr alist)))
694 (defun skip-whitespace-and-comments ()
695 (let ((md (match-data)))
697 (while (cond ((looking-at "\\s>+\\|\\s +")
699 ;; NOTE: also checked end-comment. In latex and
700 ;; lisp modes, newline is an end comment, but it
701 ;; should also be a whitespace char.
702 (goto-char (match-end 0)))
703 ;; If looking at beginning of comment, skip to end.
705 (re-search-forward "\\s>"))))
706 (store-match-data md))))
708 (defun map-bibtex-entries (fun)
709 ;; Call FUN for each BibTeX entry starting with the current. Do this
710 ;; to the end of the file. FUN is called with one argument, the key
711 ;; of the entry, and with point inside the entry. If
712 ;; bibtex-sort-ignore-string-entries is true, FUN will not be called
713 ;; for @string entries.
714 (bibtex-beginning-of-entry)
715 (while (re-search-forward "^@[^{]*{[ \t]*\\([^, ]*\\)" nil t)
716 (if (and bibtex-sort-ignore-string-entries
717 (string-equal "@string{"
718 (downcase (buffer-substring-no-properties
720 (match-beginning 1)))))
722 (funcall fun (buffer-substring-no-properties
723 (match-beginning 1) (match-end 1))))))
725 (defun bibtex-flash-head ()
726 ;; Flash at BibTeX reference head before point, if exists.
728 (cond ((re-search-backward bibtex-reference-head (point-min) t)
729 (goto-char (match-beginning bibtex-type-in-head))
730 (setq flash (match-end bibtex-key-in-reference)))
733 (skip-chars-backward " \t")
736 (skip-chars-forward " \t")))
737 (if (pos-visible-in-window-p (point))
740 (buffer-substring (point) flash)))))
742 (defun bibtex-move-outside-of-entry ()
743 ;; Make sure we are outside of a BibTeX entry.
745 (= (point) (point-max))
746 (= (point) (point-min))
747 (looking-at "[ \n]*@")
752 (forward-paragraph)))
753 (re-search-forward "[ \t\n]*" (point-max) t))
755 (defun beginning-of-first-bibtex-entry ()
756 ;; Go to the beginning of the first BibTeX entry in buffer.
757 (goto-char (point-min))
759 ((re-search-forward "^@" nil 'move)
764 (message "Warning: No BibTeX entries found!"))))
766 (defun bibtex-inside-field ()
767 ;; Try to avoid point being at end of a BibTeX field.
769 (skip-chars-backward " \t") ;MON - maybe delete these chars?
770 (cond ((= (preceding-char) ?,)
771 (forward-char -2))) ; -1 --> -2 sct@dcs.edinburgh.ac.uk
772 (cond ((= (preceding-char) (aref bibtex-field-right-delimiter 0))
773 (forward-char -1)))) ;MON - only go back if quote
775 (defun bibtex-enclosing-field ()
776 ;; Search for BibTeX field enclosing point. Point moves to end of
777 ;; field; also, use match-beginning and match-end to parse the field.
778 ;; sct@dcs.edinburgh.ac.uk
779 (let ((old-point (point)))
780 (condition-case errname
781 (bibtex-enclosing-regexp bibtex-field)
783 (goto-char old-point)
784 (error "Can't find enclosing BibTeX field.")))))
786 (defun bibtex-enclosing-reference ()
787 ;; Search for BibTeX reference enclosing point. Point moves to begin
788 ;; of reference. (match-end 0) denotes end of reference.
789 ;; Hacked up for speed. Parsing isn't guaranteed any more.
790 ;; schoef@informatik.uni-oldenburg.de
791 ;; sct@dcs.edinburgh.ac.uk
792 (let ((old-point (point)))
795 "^@[A-Za-z]+[ \t\n]*[{(][^, \t\n]*[ \t\n]*,"
798 (error "Can't find enclosing BibTeX reference.")
799 (goto-char old-point)))
802 (re-search-forward "^[)}]$" (point-max) t))
804 (error "Can't find enclosing BibTeX reference.")
805 (goto-char old-point))
808 (defun bibtex-enclosing-regexp (regexp)
809 ;; Search for REGEXP enclosing point. Point moves to end of
810 ;; REGEXP. See also match-beginning and match-end. If an enclosing
811 ;; REGEXP is not found, signals search-failed; point is left in an
812 ;; undefined location.
813 ;; Doesn't something like this exist already?
814 ; compute reasonable limits for the loop
815 (let* ((initial (point))
816 (right (if (re-search-forward regexp (point-max) t)
822 (if (re-search-backward regexp (point-min) t)
825 ; within the prescribed limits, loop until a match is found
827 (re-search-forward regexp right nil 1)
828 (if (> (match-beginning 0) initial)
829 (signal 'search-failed (list regexp)))
830 (while (<= (match-end 0) initial)
831 (re-search-forward regexp right nil 1)
832 (if (> (match-beginning 0) initial)
833 (signal 'search-failed (list regexp))))
836 (defun bibtex-autokey-change (string change-list)
837 ;; Returns a string where some regexps are changed according to
838 ;; change-list. Every item of change-list is an (old-regexp
840 (let ((return-string string)
843 (len (length change-list))
846 (setq change-item (elt change-list index))
847 (while (string-match (car change-item) return-string)
850 (concat (substring return-string 0 (match-beginning 0))
852 (substring return-string (match-end 0)))))
853 (setq index (1+ index)))
856 (defun bibtex-autokey-abbrev (string len)
857 ;; Returns an abbreviation of string with at least len
858 ;; characters. String is aborted only after a consonant or at the
859 ;; word end. If len is not a number, string is returned unchanged.
860 (let* ((string-length (length string))
861 (len (if (numberp len)
862 (min len string-length)
864 (return-string (if (numberp len)
865 (substring string 0 len)))
867 (vowels '(?a ?e ?i ?o ?u ?A ?E ?I ?O ?U)))
871 (< index string-length)
872 (member (elt return-string
873 (1- (length return-string)))
875 (setq return-string (concat return-string
877 string index (1+ index)))
882 (defun bibtex-generate-autokey ()
883 "Generates automatically a key from the author/editor and the title field.
884 The generation algorithm works as follows:
885 1. If there is a non-empty author (preferred) or editor field,
886 use it for the name part of the key.
887 2. Change any substring found in `bibtex-autokey-name-change-strings'
888 to the corresponding new one (see documentation of this variable
890 3. For every of the first `bibtex-autokey-names' names in the
891 \"name\" field, determine the last name.
892 4. From every last name, take at least `bibtex-autokey-name-length'
893 characters (abort only after a consonant or at a word end).
894 5. Build the name part of the key by concatenating all abbreviated last
895 names with the string `bibtex-autokey-name-separator' between
897 6. Build the year part of the key by truncating the contents of the
898 \"year\" field to the rightmost `bibtex-autokey-year-length'
899 digits (useful values are 2 and 4).
900 7. For the title part of the key change the contents of the \"title\"
901 field of the reference according to
902 `bibtex-autokey-titleword-change-strings' to the corresponding
903 new one (see documentation of this variable for further detail).
904 8. Abbreviate the result to the string up to (but not including) the
905 first occurence of a regexp matched by the items of
906 `bibtex-autokey-title-terminators' and delete the first
907 word if it appears in `bibtex-autokey-titleword-first-ignore'.
908 Build the title part of the key by using at least the first
909 `bibtex-autokey-titlewords' capitalized words from this
910 abbreviated title. If the abbreviated title ends after maximal
911 `bibtex-autokey-titlewords' + `bibtex-autokey-titlewords-stretch'
912 capitalized words, all capitalized words from the abbreviated title
914 9. For every used title word that appears in
915 `bibtex-autokey-titleword-abbrevs' use the corresponding abbreviation
916 (see documentation of this variable for further detail).
917 10. From every title word not generated by an abbreviation, take at
918 least `bibtex-autokey-titleword-length' characters (abort only after
919 a consonant or at a word end).
920 11. Build the title part of the key by concatenating all abbreviated
921 title words with the string `bibtex-autokey-titleword-separator'
923 12. At least, to get the key, concatenate the name part, the year part
924 and the title part with `bibtex-autokey-name-year-separator'
925 between the name and the year if both are non-empty and
926 `bibtex-autokey-year-title-separator' between the year and
927 the title if both are non-empty."
932 (bibtex-beginning-of-entry)
936 (bibtex-end-of-entry)
942 (search-forward-regexp "^[ \t]*author[ \t]*=" max t)
943 (search-forward-regexp "^[ \t]*editor[ \t]*=" max t))
944 (let* (bibtex-help-message
949 (bibtex-find-text nil)
951 (bibtex-autokey-change
952 (buffer-substring-no-properties start end)
953 bibtex-autokey-name-change-strings))
959 (bibtex-autokey-abbrev
960 (if (string-match "," fullname)
961 (substring fullname 0 (match-beginning 0))
963 (if (string-match " [^ ]*$" fullname)
965 fullname (1+ (match-beginning 0)))
967 bibtex-autokey-name-length)))
968 ;; Gather all names into a list
972 (not (equal namefield ""))
974 (not (numberp bibtex-autokey-names))
975 (< counter bibtex-autokey-names)))
976 (if (string-match " and " namefield)
984 namefield 0 (match-beginning 0)))))
986 (substring namefield (match-end 0))))
988 (append names (list (downcase namefield)))
990 (setq counter (1+ counter)))
992 (namepart (mapconcat (function (lambda (name) name))
994 bibtex-autokey-name-separator))
998 (if (search-forward-regexp
999 "^[ \t]*year[ \t]*=[ \t]*\\([0-9]*\\)" max t)
1000 (buffer-substring-no-properties
1001 (match-beginning 1) (match-end 1))
1004 (if (equal yearfield "")
1006 (substring yearfield
1007 (- (length yearfield)
1008 bibtex-autokey-year-length))))
1010 (let ((case-fold-search t)
1014 (if (search-forward-regexp
1015 "^[ \t]*title[ \t]*=" max t)
1016 (let* (bibtex-help-message
1018 (bibtex-find-text t)
1021 (bibtex-find-text nil)
1023 (bibtex-autokey-change
1024 (buffer-substring-no-properties start end)
1025 bibtex-autokey-titleword-change-strings))
1030 (length bibtex-autokey-title-terminators)))
1031 (while (< index numberofitems)
1033 (elt bibtex-autokey-title-terminators index)
1036 (substring titlefield 0 (match-beginning 0))))
1037 (setq index (1+ index)))
1045 titleword bibtex-autokey-titleword-abbrevs)))
1048 (bibtex-autokey-abbrev
1050 bibtex-autokey-titleword-length)))))
1051 ;; Gather all titlewords into a list
1058 (not (equal titlestring ""))
1060 (not (numberp bibtex-autokey-titlewords))
1062 bibtex-autokey-titlewords
1063 bibtex-autokey-titlewords-stretch))))
1064 (if (string-match "\\b[A-Z][A-Za-z0-9]*" titlestring)
1065 (let* ((end-match (match-end 0))
1067 (downcase (substring titlestring
1071 (not (numberp bibtex-autokey-titlewords))
1072 (< counter bibtex-autokey-titlewords))
1077 bibtex-autokey-titleword-first-ignore))
1080 (append titlewords (list titleword))))
1083 (append titlewords-extra (list titleword))))
1085 (substring titlestring end-match)))
1086 (setq titlestring ""))
1088 counter (1+ counter)))
1089 (if (string-match "\\b[A-Z][^ ]*\\b" titlestring)
1091 (append titlewords titlewords-extra)))))
1092 (titlepart (mapconcat (function (lambda (name) name))
1094 bibtex-autokey-titleword-separator))
1101 (equal yearpart "")))
1102 bibtex-autokey-name-year-separator)
1108 (equal yearpart ""))
1109 (equal titlepart "")))
1110 bibtex-autokey-year-title-separator)
1117 ;; Interactive Functions:
1120 (defun bibtex-mode ()
1121 "Major mode for editing BibTeX files.
1125 A command such as \\[bibtex-Book] will outline the fields for a BibTeX book entry.
1127 The optional fields start with the string OPT, and thus ignored by BibTeX.
1128 The OPT string may be removed from a field with \\[bibtex-remove-OPT].
1129 \\[bibtex-kill-optional-field] kills the current optional field entirely.
1130 \\[bibtex-remove-double-quotes-or-braces] removes the double-quotes or
1131 braces around the text of the current field. \\[bibtex-empty-field]
1132 replaces the text of the current field with the default \"\" or {}.
1134 The command \\[bibtex-clean-entry] cleans the current entry, i.e. (i) removes
1135 double-quotes or braces from entirely numerical fields, (ii) removes
1136 OPT from all non-empty optional fields, (iii) removes all empty
1137 optional fields, and (iv) checks that no non-optional fields are empty.
1139 Use \\[bibtex-find-text] to position the cursor at the end of the current field.
1140 Use \\[bibtex-next-field] to move to end of the next field.
1142 The following may be of interest as well:
1146 bibtex-print-help-message
1147 bibtex-beginning-of-entry
1149 bibtex-ispell-abstract
1150 bibtex-narrow-to-entry
1151 bibtex-hide-entry-bodies
1153 bibtex-validate-buffer
1156 bibtex-complete-string
1159 bibtex-field-left-delimiter
1160 bibtex-field-right-delimiter
1161 bibtex-include-OPTcrossref
1162 bibtex-include-OPTkey
1163 bibtex-include-OPTannote
1164 bibtex-mode-user-optional-fields
1165 bibtex-clean-entry-zap-empty-opts
1166 bibtex-sort-ignore-string-entries
1167 bibtex-maintain-sorted-entries
1168 bibtex-entry-field-alist
1169 bibtex-predefined-strings
1172 ---------------------------------------------------------
1173 Entry to this mode calls the value of bibtex-mode-hook if that value is
1176 (kill-all-local-variables)
1177 (use-local-map bibtex-mode-map)
1178 (setq major-mode 'bibtex-mode)
1179 (setq mode-name "BibTeX")
1180 (set-syntax-table bibtex-mode-syntax-table)
1181 (setq bibtex-completion-candidates bibtex-predefined-strings)
1185 ;; collect pathnames
1186 (let* ((bib (getenv "BIBINPUTS"))
1193 (lambda (dirname) ;; strips off trailing slashes
1194 (let ((len (length dirname)))
1195 (if (equal (elt dirname (1- len)) "/")
1196 (substring dirname 0 (1- (1- len)))
1199 (while (string-match ":" path)
1204 (1- (match-end 0)))))
1205 path (substring path (match-end 0))))
1206 (append actdirs (list path)))))
1207 (filename (if (string-match "\.bib$" filename)
1209 (concat filename ".bib")))
1212 (size (length dirs)))
1216 (not (file-readable-p
1218 (concat (elt dirs item) "/" filename)))))
1219 (setq item (1+ item)))
1222 (let ((curbuf (current-buffer))
1223 (bufname (make-temp-name ""))
1224 (compl bibtex-completion-candidates))
1225 (create-file-buffer bufname)
1226 (set-buffer bufname)
1227 (insert-file-contents fullfilename)
1228 (goto-char (point-min))
1229 (while (search-forward-regexp bibtex-string nil t)
1235 (list (buffer-substring-no-properties
1236 (match-beginning bibtex-name-in-string)
1237 (match-end bibtex-name-in-string)))))))
1238 (kill-buffer bufname)
1240 (setq bibtex-completion-candidates compl))
1241 (error "File %s not in $BIBINPUTS paths" filename)))))
1242 bibtex-string-files)
1243 (make-local-variable 'paragraph-start)
1244 (setq paragraph-start "[ \f\n\t]*$")
1245 (make-local-variable 'comment-start)
1246 (setq comment-start "%")
1247 (auto-fill-mode 1) ; nice alignments
1248 (setq left-margin (+ bibtex-text-alignment 1))
1249 (run-hooks 'bibtex-mode-hook))
1251 (defun bibtex-entry (entry-type &optional required optional)
1252 (interactive (let* ((completion-ignore-case t)
1253 (e-t (completing-read
1255 bibtex-entry-field-alist
1258 (if (and (null required) (null optional))
1259 (let* ((e (assoc-ignore-case entry-type bibtex-entry-field-alist))
1263 (error "Bibtex entry type %s not defined!" entry-type))
1265 (member entry-type bibtex-include-OPTcrossref)
1267 (setq required (elt c-ref 0)
1268 optional (elt c-ref 1))
1269 (setq required (elt r-n-o 0)
1270 optional (elt r-n-o 1)))))
1274 (case-fold-search t)
1276 (if bibtex-maintain-sorted-entries
1279 (goto-char (point-min))
1282 "\\(^@[a-z]+[ \t\n]*[{(][ \t\n]*\\([^ ,\t\n]+\\)[ \t\n]*,\\)\\|\\(^[ \t\n]*crossref[ \t\n]*=[ \t\n]*[{\"]\\([^ ,\t\n]*\\)[}\"],$\\)"
1284 (if (match-beginning 2)
1285 (setq label (buffer-substring-no-properties
1286 (match-beginning 2) (match-end 2)))
1287 (setq label (buffer-substring-no-properties
1288 (match-beginning 4) (match-end 4))))
1289 (if (not (assoc label labels))
1291 (cons (list label) labels)))))
1293 (format "%s key: " entry-type)
1296 (bibtex-find-entry-location key))
1297 (bibtex-move-outside-of-entry)
1298 (insert "@" entry-type "{")
1302 (mapcar 'bibtex-make-field required)
1303 (if (member entry-type bibtex-include-OPTcrossref)
1304 (bibtex-make-optional-field '("crossref")))
1305 (if bibtex-include-OPTkey
1306 (bibtex-make-optional-field '("key")))
1307 (mapcar 'bibtex-make-optional-field optional)
1308 (mapcar 'bibtex-make-optional-field
1309 bibtex-mode-user-optional-fields)
1310 (if bibtex-include-OPTannote
1311 (bibtex-make-optional-field '("annote")))
1314 (bibtex-next-field t))
1315 (run-hooks 'bibtex-add-entry-hook)))
1317 (defun bibtex-print-help-message ()
1318 "Prints helpful information about current field in current BibTeX entry."
1320 (let* ((pnt (point))
1324 (condition-case errname
1325 (bibtex-enclosing-regexp bibtex-field)
1328 (error "Not on BibTeX field")))
1330 "^[ \t]*\\([A-Za-z]+\\)[ \t\n]*=" nil t)
1331 (let ((mb (match-beginning 1))
1333 (buffer-substring-no-properties
1334 (if (looking-at "^[ \t]*OPT")
1341 "^@\\([A-Za-z]+\\)[ \t\n]*[{(][^, \t\n]*[ \t\n]*," nil t)
1342 (buffer-substring-no-properties
1343 (match-beginning 1) (match-end 1))))
1345 (assoc-ignore-case reference-type
1346 bibtex-entry-field-alist))
1347 (c-r-list (elt entry-list 2))
1350 (member reference-type bibtex-include-OPTcrossref)
1353 (elt entry-list 1)))
1354 (list-of-entries (append
1355 (elt req-opt-list 0)
1356 (elt req-opt-list 1)
1357 bibtex-mode-user-optional-fields
1360 bibtex-include-OPTcrossref)
1362 "Label of the crossreferenced entry")))
1363 (if bibtex-include-OPTannote
1365 "Personal annotation (ignored)")))
1366 (if bibtex-include-OPTkey
1368 "Key used for label creation if author and editor fields are missing"))))))
1370 (if (assoc field-name list-of-entries)
1371 (message (elt (assoc field-name list-of-entries) 1))
1372 (message "NO COMMENT AVAILABLE"))))
1374 (defun bibtex-make-field (e-t)
1375 "Makes a field named E-T in current BibTeX entry."
1376 (interactive "sBibTeX entry type: ")
1377 (let ((name (if (consp e-t)
1380 (bibtex-find-text nil)
1383 (indent-to-column bibtex-name-alignment)
1385 (indent-to-column bibtex-text-alignment)
1386 (insert bibtex-field-left-delimiter bibtex-field-right-delimiter)))
1388 (defun bibtex-make-optional-field (e-t)
1389 "Makes an optional field named E-T in current BibTeX entry."
1390 (interactive "sOptional BibTeX entry type: ")
1392 (setq e-t (cons (concat "OPT" (car e-t)) (cdr e-t)))
1393 (setq e-t (concat "OPT" e-t)))
1394 (bibtex-make-field e-t))
1396 (defun bibtex-beginning-of-entry ()
1397 "Move to beginning of BibTeX entry.
1398 If inside an entry, move to the beginning of it, otherwise move to the
1399 beginning of the previous entry."
1401 (if (looking-at "^@")
1403 (re-search-backward "^@" nil 'move))
1405 (defun bibtex-end-of-entry ()
1406 "Move to end of BibTeX entry.
1407 If inside an entry, move to the end of it, otherwise move to the end
1408 of the previous entry."
1410 (bibtex-beginning-of-entry)
1411 (let ((parse-sexp-ignore-comments t))
1412 (forward-sexp 2) ;; skip entry type and body
1415 (defun bibtex-ispell-entry ()
1416 "Spell whole BibTeX entry."
1418 (ispell-region (progn (bibtex-beginning-of-entry) (point))
1419 (progn (bibtex-end-of-entry) (point))))
1421 (defun bibtex-ispell-abstract ()
1422 "Spell abstract of BibTeX entry."
1424 (let ((pnt (bibtex-end-of-entry)))
1425 (bibtex-beginning-of-entry)
1427 (re-search-forward "^[ \t]*[OPT]*abstract[ \t]*=" pnt))
1428 (error "No abstract in entry.")))
1429 (ispell-region (point)
1430 (save-excursion (forward-sexp) (point))))
1432 (defun bibtex-narrow-to-entry ()
1433 "Narrow buffer to current BibTeX entry."
1436 (narrow-to-region (progn (bibtex-beginning-of-entry) (point))
1437 (progn (bibtex-end-of-entry) (point)))))
1440 (defun bibtex-hide-entry-bodies (&optional arg)
1441 "Hide all lines between first and last BibTeX entries not beginning with @.
1442 With argument, show all text."
1445 (beginning-of-first-bibtex-entry)
1446 ;; subst-char-in-region modifies the buffer, despite what the
1447 ;; documentation says...
1448 (let ((modifiedp (buffer-modified-p))
1449 (buffer-read-only nil))
1451 (subst-char-in-region (point) (point-max) ?\r ?\n t)
1452 (while (save-excursion (re-search-forward "\n[^@]" (point-max) t))
1453 ;; (save-excursion (replace-regexp "\n\\([^@]\\)" "\r\\1"))
1455 (while (re-search-forward "\n\\([^@]\\)" nil t)
1456 (replace-match "\r\\1" nil nil)))))
1457 (setq selective-display (not arg))
1458 (set-buffer-modified-p modifiedp))))
1460 (defun bibtex-sort-entries ()
1461 "Sort BibTeX entries alphabetically by key.
1462 Text before the first BibTeX entry, and following the last is not affected.
1463 If bibtex-sort-ignore-string-entries is true, @string entries will be ignored.
1466 1. Text between the closing brace ending one BibTeX entry, and the @ starting
1467 the next, is considered part of the PRECEDING entry. Perhaps it should be
1468 part of the following entry."
1471 (beginning-of-first-bibtex-entry)
1475 (goto-char (point-max))
1476 (bibtex-end-of-entry)
1486 (re-search-forward "}\\s-*\n[\n \t]*@" nil 'move)
1487 (forward-char -2))))
1488 ;; STARTKEY function
1489 (if bibtex-sort-ignore-string-entries
1494 (re-search-forward "^\\s-*\\([@a-zA-Z]*\\)\\s-*{\\s-*")
1498 (buffer-substring-no-properties
1504 (re-search-forward "{\\s-*"))))
1508 (search-forward ","))))))
1510 (defun bibtex-find-entry-location (entry-name &optional ignore-errors)
1511 "Looking for place to put the BibTeX entry named ENTRY-NAME.
1512 Searches from beginning of buffer. Buffer is assumed to be in sorted
1513 order, without duplicates (see \\[bibtex-sort-entries]), if it is not,
1514 an error will be signalled. However, if optional argument
1515 IGNORE-ERRORS is non-nil, no error messages about duplicate entries or
1516 sort order violences are signalled, but the error handling is assumed
1517 to be made in the calling function. Nil is returned, if any error
1518 occured during search for location of the new entry, and t in all
1519 other cases. If an error occured, point is not moved."
1520 (interactive "sBibtex entry key: ")
1525 (beginning-of-first-bibtex-entry)
1531 (cond ((string-equal entry-name current)
1533 (bibtex-beginning-of-entry)
1536 (error "Entry duplicates existing!")))
1537 ((or (null previous)
1538 (string< previous current))
1539 (setq previous current
1541 (if (string< entry-name current)
1543 (bibtex-beginning-of-entry)
1544 ;; Many schemes append strings to
1545 ;; existing entries to resolve them,
1546 ;; so initial substring matches may
1547 ;; indicate a duplicate entry.
1550 (regexp-quote entry-name) current)))
1554 ;; (not ignore-errors)
1555 (not (equal entry-name "")))
1558 "Warning: Entry %s may be a duplicate of %s!"
1562 ((string-equal previous current)
1566 (error "Duplicate here with previous!")))
1571 (error "Entries out of order here!"))))))))
1572 (goto-char (point-max)))
1577 (defun bibtex-validate-buffer ()
1578 "Validate if the current BibTeX buffer is syntactically correct.
1579 Any garbage (e.g. comments) before the first \"@\" is not tested (so
1580 you can put comments here)."
1584 (goto-char (point-min))
1585 (while (< (re-search-forward "@\\|\\'") max)
1588 (if (looking-at "@string")
1591 (re-search-forward bibtex-reference nil t)
1592 (equal p (match-beginning 0))))
1595 (error "Bad entry begins here"))))))
1596 (bibtex-find-entry-location (make-string 10 255))
1599 (message "BibTeX buffer is syntactically correct")))
1601 (defun bibtex-next-field (arg)
1602 "Finds end of text of next BibTeX field; with arg, to its beginning."
1604 (bibtex-inside-field)
1605 (let ((start (point)))
1608 (bibtex-enclosing-field)
1609 (goto-char (match-end 0))
1615 (bibtex-find-text arg))
1617 (defun bibtex-find-text (arg)
1618 "Go to end of text of current field; with arg, go to beginning."
1620 (bibtex-inside-field)
1621 (bibtex-enclosing-field)
1624 (goto-char (match-beginning bibtex-text-in-field))
1625 (if (looking-at "[{\"]")
1627 (goto-char (match-end bibtex-text-in-field))
1629 (= (preceding-char) ?})
1630 (= (preceding-char) ?\"))
1632 (if bibtex-help-message
1633 (bibtex-print-help-message)))
1635 (defun bibtex-remove-OPT ()
1636 "Removes the 'OPT' starting optional arguments and goes to end of text."
1638 (bibtex-inside-field)
1639 (bibtex-enclosing-field)
1641 (goto-char (match-beginning bibtex-name-in-field))
1642 (if (looking-at "OPT")
1643 ;; sct@dcs.edinburgh.ac.uk
1645 (delete-char (length "OPT"))
1646 (search-forward "=")
1647 (delete-horizontal-space)
1648 (indent-to-column bibtex-text-alignment))))
1649 (bibtex-inside-field))
1651 (defun bibtex-remove-double-quotes-or-braces ()
1652 "Removes \"\" or {} around string."
1655 (bibtex-inside-field)
1656 (bibtex-enclosing-field)
1657 (let ((start (match-beginning bibtex-text-in-field))
1658 (stop (match-end bibtex-text-in-field)))
1661 (if (looking-at "[}\"]")
1664 (if (looking-at "[{\"]")
1667 (defun bibtex-kill-optional-field ()
1668 "Kill the entire enclosing optional BibTeX field."
1670 (bibtex-inside-field)
1671 (bibtex-enclosing-field)
1672 (goto-char (match-beginning bibtex-name-in-field))
1673 (let ((the-end (match-end 0))
1674 (the-beginning (match-beginning 0)))
1675 (if (looking-at "OPT")
1678 (skip-chars-forward " \t\n,")
1679 (kill-region the-beginning the-end))
1680 (error "Mandatory fields can't be killed"))))
1682 (defun bibtex-empty-field ()
1683 "Delete the text part of the current field, replace with empty text."
1685 (bibtex-inside-field)
1686 (bibtex-enclosing-field)
1687 (goto-char (match-beginning bibtex-text-in-field))
1688 (kill-region (point) (match-end bibtex-text-in-field))
1689 (insert (concat bibtex-field-left-delimiter
1690 bibtex-field-right-delimiter))
1691 (bibtex-find-text t))
1693 (defun bibtex-pop-previous (arg)
1694 "Replace text of current field with the text of similar field in previous entry.
1695 With arg, go up ARG entries. Repeated, goes up so many times. May be
1696 intermixed with \\[bibtex-pop-next] (bibtex-pop-next)."
1698 (bibtex-inside-field)
1700 ; parse current field
1701 (bibtex-enclosing-field)
1702 (let ((start-old-text (match-beginning bibtex-text-in-field))
1703 (stop-old-text (match-end bibtex-text-in-field))
1704 (start-name (match-beginning bibtex-name-in-field))
1705 (stop-name (match-end bibtex-name-in-field))
1707 (goto-char start-name)
1708 ; construct regexp for previous field with same name as this one
1709 (let ((matching-entry
1711 (buffer-substring-no-properties (if (looking-at "OPT")
1712 (+ (point) (length "OPT"))
1715 bibtex-field-text)))
1716 ; if executed several times in a row, start each search where the
1718 (cond ((or (eq last-command 'bibtex-pop-previous)
1719 (eq last-command 'bibtex-pop-next))
1723 (bibtex-enclosing-reference)
1724 (setq bibtex-pop-previous-search-point (point))
1725 (setq bibtex-pop-next-search-point (match-end 0))))
1726 (goto-char bibtex-pop-previous-search-point)
1727 ; Now search for arg'th previous similar field
1729 ((re-search-backward matching-entry (point-min) t arg)
1731 (buffer-substring-no-properties
1732 (match-beginning bibtex-text-in-cfield)
1733 (match-end bibtex-text-in-cfield)))
1734 ;; change delimiters, if any changes needed
1737 (equal bibtex-field-left-delimiter "{")
1738 (eq (aref new-text 0) ?\")
1739 (eq (aref new-text (1- (length new-text))) ?\"))
1740 (aset new-text 0 ?\{)
1741 (aset new-text (1- (length new-text)) ?\}))
1743 (equal bibtex-field-left-delimiter "\"")
1744 (eq (aref new-text 0) ?\{)
1745 (eq (aref new-text (1- (length new-text))) ?\}))
1746 (aset new-text 0 ?\")
1747 (aset new-text (1- (length new-text)) ?\"))
1749 (not (eq (aref new-text 0)
1750 (aref bibtex-field-left-delimiter 0)))
1751 (not (eq (aref new-text (1- (length new-text)))
1752 (aref bibtex-field-right-delimiter 0))))
1753 (setq new-text (concat bibtex-field-left-delimiter
1755 bibtex-field-right-delimiter))))
1756 ; Found a matching field. Remember boundaries.
1757 (setq bibtex-pop-next-search-point (match-end 0))
1758 (setq bibtex-pop-previous-search-point (match-beginning 0))
1760 ; Go back to where we started, delete old text, and pop new.
1761 (goto-char stop-old-text)
1762 (delete-region start-old-text stop-old-text)
1765 (error "No previous matching BibTeX field."))))))
1766 (setq this-command 'bibtex-pop-previous))
1768 (defun bibtex-pop-next (arg)
1769 "Replace text of current field with the text of similar field in next entry.
1770 With arg, go up ARG entries. Repeated, goes up so many times. May be
1771 intermixed with \\[bibtex-pop-previous] (bibtex-pop-previous)."
1773 (bibtex-inside-field)
1775 ; parse current field
1776 (bibtex-enclosing-field)
1777 (let ((start-old-text (match-beginning bibtex-text-in-field))
1778 (stop-old-text (match-end bibtex-text-in-field))
1779 (start-name (match-beginning bibtex-name-in-field))
1780 (stop-name (match-end bibtex-name-in-field))
1782 (goto-char start-name)
1783 ; construct regexp for next field with same name as this one,
1784 ; ignoring possible OPT's
1785 (let ((matching-entry
1787 (buffer-substring-no-properties (if (looking-at "OPT")
1788 (+ (point) (length "OPT"))
1791 bibtex-field-text)))
1793 ; if executed several times in a row, start each search where the
1795 (cond ((or (eq last-command 'bibtex-pop-next)
1796 (eq last-command 'bibtex-pop-previous))
1800 (bibtex-enclosing-reference)
1801 (setq bibtex-pop-previous-search-point (point))
1802 (setq bibtex-pop-next-search-point (match-end 0))))
1803 (goto-char bibtex-pop-next-search-point)
1805 ; Now search for arg'th next similar field
1807 ((re-search-forward matching-entry (point-max) t arg)
1809 (buffer-substring-no-properties
1810 (match-beginning bibtex-text-in-cfield)
1811 (match-end bibtex-text-in-cfield)))
1812 ;; change delimiters, if any changes needed
1815 (equal bibtex-field-left-delimiter "{")
1816 (eq (aref new-text 0) ?\")
1817 (eq (aref new-text (1- (length new-text))) ?\"))
1818 (aset new-text 0 ?\{)
1819 (aset new-text (1- (length new-text)) ?\}))
1821 (equal bibtex-field-left-delimiter "\"")
1822 (eq (aref new-text 0) ?\{)
1823 (eq (aref new-text (1- (length new-text))) ?\}))
1824 (aset new-text 0 ?\")
1825 (aset new-text (1- (length new-text)) ?\"))
1827 (not (eq (aref new-text 0)
1828 (aref bibtex-field-left-delimiter 0)))
1829 (not (eq (aref new-text (1- (length new-text)))
1830 (aref bibtex-field-right-delimiter 0))))
1831 (setq new-text (concat bibtex-field-left-delimiter
1833 bibtex-field-right-delimiter))))
1834 ; Found a matching field. Remember boundaries.
1835 (setq bibtex-pop-next-search-point (match-end 0))
1836 (setq bibtex-pop-previous-search-point (match-beginning 0))
1838 ; Go back to where we started, delete old text, and pop new.
1839 (goto-char stop-old-text)
1840 (delete-region start-old-text stop-old-text)
1843 (error "No next matching BibTeX field."))))))
1844 (setq this-command 'bibtex-pop-next))
1846 (defun bibtex-clean-entry (&optional arg)
1847 "Finish editing the current BibTeX entry and clean it up.
1848 For all optional fields of current BibTeX entry: if empty, kill the
1849 whole field; otherwise, remove the \"OPT\" string in the name; if text
1850 numerical, remove double-quotes. For all mandatory fields: if empty,
1851 signal error. If label of entry is empty or a prefix argument was
1852 given, calculate a new entry label."
1854 (bibtex-beginning-of-entry)
1855 (let ((start (point))
1858 (narrow-to-region start (save-excursion (bibtex-end-of-entry) (point)))
1860 (re-search-forward bibtex-field (point-max) t 1)
1861 (not crossref-there))
1862 ;; determine if reference has crossref entry
1863 (let ((begin-name (match-beginning bibtex-name-in-field))
1864 (begin-text (match-beginning bibtex-text-in-field)))
1865 (goto-char begin-name)
1866 (if (looking-at "\\(OPTcrossref\\)\\|\\(crossref\\)")
1868 (goto-char begin-text)
1869 (if (not (looking-at
1871 bibtex-field-left-delimiter
1872 bibtex-field-right-delimiter)))
1873 (setq crossref-there t))))))
1874 (bibtex-enclosing-reference)
1875 (re-search-forward bibtex-reference-type)
1876 (let ((begin-type (1+ (match-beginning 0)))
1877 (end-type (match-end 0)))
1879 (while (re-search-forward bibtex-field (point-max) t 1)
1880 (let ((begin-field (match-beginning 0))
1881 (end-field (match-end 0))
1882 (begin-name (match-beginning bibtex-name-in-field))
1883 (end-name (match-end bibtex-name-in-field))
1884 (begin-text (match-beginning bibtex-text-in-field))
1885 (end-text (match-end bibtex-text-in-field))
1887 (goto-char begin-name)
1890 bibtex-clean-entry-zap-empty-opts)
1891 (goto-char begin-text)
1894 bibtex-field-left-delimiter
1895 bibtex-field-right-delimiter))
1896 ;; empty: delete whole field if really optional
1897 ;; (missing crossref handled) or complain
1899 (not crossref-there)
1902 (buffer-substring-no-properties
1903 (+ (length "OPT") begin-name) end-name))
1906 (buffer-substring-no-properties
1907 begin-type end-type)
1908 bibtex-entry-field-alist))))))
1909 ;; field is not really optional
1911 (goto-char begin-name)
1912 (delete-char (length "OPT"))
1913 ;; make field non-OPT
1914 (search-forward "=")
1915 (delete-horizontal-space)
1916 (indent-to-column bibtex-text-alignment)
1918 ;; and loop to go through next test
1919 (error "Mandatory field ``%s'' is empty"
1920 (buffer-substring-no-properties
1923 ;; field is optional
1924 (delete-region begin-field end-field))
1925 ;; otherwise: not empty, delete "OPT"
1926 (goto-char begin-name)
1927 (delete-char (length "OPT"))
1929 ;; fixup alignment. [alarson:19920309.2047CST]
1930 (search-forward "=")
1931 (delete-horizontal-space)
1932 (indent-to-column bibtex-text-alignment))
1933 (goto-char begin-field) ; and loop to go through next test
1936 (goto-char begin-text)
1937 (cond ((looking-at (concat
1938 bibtex-field-left-delimiter
1940 bibtex-field-right-delimiter))
1942 (goto-char end-text)
1943 (delete-char -1) ; delete enclosing double-quotes
1944 (goto-char begin-text)
1946 (goto-char end-field) ; go to end for next search
1947 (forward-char -2) ; to compensate for the 2 quotes deleted
1949 ((looking-at (concat
1950 bibtex-field-left-delimiter
1951 bibtex-field-right-delimiter))
1952 ;; if empty quotes, complain
1954 (if (not (or (equal (buffer-substring-no-properties
1958 (equal (buffer-substring-no-properties
1962 (error "Mandatory field ``%s'' is empty"
1963 (buffer-substring-no-properties
1964 begin-name end-name))))
1966 (goto-char end-field)))))))))
1968 (bibtex-end-of-entry)
1969 ;; sct@dcs.edinburgh.ac.uk
1973 (if (eq (preceding-char) ?,)
1974 (backward-delete-char 1))))
1976 (bibtex-end-of-entry)
1979 (bibtex-beginning-of-entry)
1980 (if (search-forward-regexp
1981 bibtex-reference-head eob t)
1982 (buffer-substring-no-properties
1983 (match-beginning bibtex-key-in-head)
1984 (match-end bibtex-key-in-head))))))
1990 (if bibtex-autokey-edit-before-use
1991 (read-from-minibuffer "Key to use: "
1992 (bibtex-generate-autokey))
1993 (bibtex-generate-autokey))))
1994 (bibtex-beginning-of-entry)
1995 (search-forward-regexp "^@[A-Za-z]+[ \t]*[({]\\([^,]*\\)")
1996 (delete-region (match-beginning 1)
2000 (bibtex-beginning-of-entry)
2003 (bibtex-end-of-entry)
2004 (search-forward-regexp "^@" nil 'move)
2008 (kill-region start end)
2009 (let ((success (bibtex-find-entry-location autokey t)))
2011 (setq kill-ring (cdr kill-ring))
2013 (bibtex-beginning-of-entry)
2015 (search-forward-regexp bibtex-reference-head)
2018 "BibTeX buffer was or has become invalid (call `bibtex-validate-buffer')")))))))))
2020 (defun bibtex-complete-string ()
2021 "Complete word fragment before point to longest prefix of a defined string.
2022 If point is not after the part of a word, all strings are listed."
2024 (let* ((end (point))
2025 (beg (save-excursion
2026 (re-search-backward "[ \t{\"]")
2029 (part-of-word (buffer-substring-no-properties beg end))
2030 (string-list (copy-sequence bibtex-completion-candidates))
2031 (case-fold-search t)
2032 (completion (save-excursion
2034 (while (re-search-backward
2035 "@string[ \t\n]*{" (point-min) t)
2036 (goto-char (match-end 0))
2038 (strt (match-beginning 0)))
2039 (re-search-forward "[ \t\n]*="
2041 (goto-char (match-beginning 0))
2045 (buffer-substring-no-properties
2055 (try-completion part-of-word string-list)))))
2056 (cond ((eq completion t)
2057 (bibtex-remove-double-quotes-or-braces))
2059 (error "Can't find completion for \"%s\"" part-of-word))
2060 ((not (string= part-of-word completion))
2061 (delete-region beg end)
2063 (if (assoc completion string-list)
2064 (bibtex-remove-double-quotes-or-braces)))
2066 (message "Making completion list...")
2067 (let ((list (all-completions part-of-word string-list)))
2068 (with-output-to-temp-buffer "*Completions*"
2069 (display-completion-list list)))
2070 (message "Making completion list...done")))))
2072 (defun bibtex-Article ()
2074 (bibtex-entry "Article"))
2076 (defun bibtex-Book ()
2078 (bibtex-entry "Book"))
2080 (defun bibtex-Booklet ()
2082 (bibtex-entry "Booklet"))
2084 (defun bibtex-InBook ()
2086 (bibtex-entry "InBook"))
2088 (defun bibtex-InCollection ()
2090 (bibtex-entry "InCollection"))
2092 (defun bibtex-InProceedings ()
2094 (bibtex-entry "InProceedings"))
2096 (defun bibtex-Manual ()
2098 (bibtex-entry "Manual"))
2100 (defun bibtex-MastersThesis ()
2102 (bibtex-entry "MastersThesis"))
2104 (defun bibtex-Misc ()
2106 (bibtex-entry "Misc"))
2108 (defun bibtex-PhdThesis ()
2110 (bibtex-entry "PhdThesis"))
2112 (defun bibtex-Proceedings ()
2114 (bibtex-entry "Proceedings"))
2116 (defun bibtex-TechReport ()
2118 (bibtex-entry "TechReport"))
2120 (defun bibtex-Unpublished ()
2122 (bibtex-entry "Unpublished"))
2124 (defun bibtex-string ()
2126 (bibtex-move-outside-of-entry)
2130 bibtex-field-left-delimiter
2131 bibtex-field-right-delimiter
2136 (defun bibtex-preamble ()
2138 (bibtex-move-outside-of-entry)
2139 (insert "@Preamble{}\n")
2145 ;; Make BibTeX a Feature
2150 ;;; bibtex.el ends here