1 ;;; bibtex.el --- BibTeX mode for GNU Emacs
3 ;; Copyright (C) 1992, 1994 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 ;; Distribute texinfo file.
31 ;; A better concept for intermixing quote and brace delimiters is
35 ;; Major mode for editing and validating BibTeX files.
39 ;; See documentation for function bibtex-mode (or type "\M-x describe-mode"
40 ;; when you are in bibtex-mode).
44 ;; 1. using regular expressions to match the entire BibTeX entry dies
45 ;; on long entries (e.g. those containing abstracts) since
46 ;; the length of regular expression matches is fairly limited.
47 ;; 2. Calling bibtex-find-text in a string entry results in the
48 ;; error message "Can't find enclosing Bibtex field" instead of
49 ;; moving to the empty string. [reported by gernot@cs.unsw.oz.au]
51 ;;; (current keeper: schoef@informatik.uni-oldenburg.de
52 ;;; previous: alarson@src.honeywell.com)
56 (defvar bibtex-field-left-delimiter "{"
57 "*Set this to { or \" according to your personal preferences.")
59 (defvar bibtex-field-right-delimiter "}"
60 "*Set this to } or \" according to your personal preferences.")
62 (defvar bibtex-include-OPTcrossref '("InProceedings" "InCollection")
63 "*All entries listed here will have an OPTcrossref field.")
65 (defvar bibtex-include-OPTkey t
66 "*If non-nil, all entries will have an OPTkey field.")
68 (defvar bibtex-include-OPTannote t
69 "*If non-nil, all entries will have an OPTannote field.")
71 (defvar bibtex-mode-user-optional-fields nil
72 "*List of optional fields the user wants to have always present.
73 Entries should be lists of strings with two elements (first element =
74 name of the field, second element = comment to appear in the echo area).")
76 (defvar bibtex-clean-entry-zap-empty-opts t
77 "*If non-nil, bibtex-clean-entry will delete all empty optional fields.")
79 (defvar bibtex-sort-ignore-string-entries t
80 "*If true, BibTeX @STRING entries are not sort-significant.
81 That means they are ignored when determining ordering of the buffer
82 (e.g. sorting, locating alphabetical position for new entries, etc.).")
84 (defvar bibtex-maintain-sorted-entries t
85 "*If true, bibtex-mode maintains all BibTeX entries in sorted order.
86 Setting this variable to nil will strip off some comfort (e.g. TAB
87 completion for reference keys) from bibtex-mode.")
89 (defvar bibtex-entry-field-alist
91 ("Article" . (((("author" "Author1 [and Author2 ...] [and others]")
92 ("title" "Title of the article (will be converted to lowercase)")
93 ("journal" "Name of the journal (use string, remove braces)")
94 ("year" "Year of publication"))
95 (("volume" "Volume of the journal")
96 ("number" "Number of the journal")
97 ("month" "Month of the publication as a string (remove braces)")
98 ("pages" "Pages in the journal")
99 ("note" "Remarks to be put at the end of the \\bibitem")))
100 ((("author" "Author1 [and Author2 ...] [and others]")
101 ("title" "Title of the article (will be converted to lowercase)"))
102 (("journal" "Name of the journal (use string, remove braces)")
103 ("year" "Year of publication")
104 ("volume" "Volume of the journal")
105 ("number" "Number of the journal")
106 ("month" "Month of the publication as a string (remove braces)")
107 ("pages" "Pages in the journal")
108 ("note" "Remarks to be put at the end of the \\bibitem")))))
109 ("Book" . (((("author" "Author1 [and Author2 ...] [and others]")
110 ("title" "Title of the book")
111 ("publisher" "Publishing company")
112 ("year" "Year of publication"))
113 (("editor" "Editor1 [and Editor2 ...] [and others]")
114 ("volume" "Volume of the book in the series")
115 ("number" "Number of the book in a small series (overwritten by volume)")
116 ("series" "Series in which the book appeared")
117 ("address" "Address of the publisher")
118 ("edition" "Edition of the book as a capitalized English word")
119 ("month" "Month of the publication as a string (remove braces)")
120 ("note" "Remarks to be put at the end of the \\bibitem")))))
121 ("Booklet" . (((("title" "Title of the booklet (will be converted to lowercase)"))
122 (("author" "Author1 [and Author2 ...] [and others]")
123 ("howpublished" "The way in which the booklet was published")
124 ("address" "Address of the publisher")
125 ("year" "Year of publication")
126 ("month" "Month of the publication as a string (remove braces)")
127 ("note" "Remarks to be put at the end of the \\bibitem")))))
128 ("InBook" . (((("author" "Author1 [and Author2 ...] [and others]")
129 ("title" "Title of the book")
130 ("chapter" "Chapter in the book")
131 ("publisher" "Publishing company")
132 ("year" "Year of publication"))
133 (("editor" "Editor1 [and Editor2 ...] [and others]")
134 ("volume" "Volume of the book in the series")
135 ("number" "Number of the book in a small series (overwritten by volume)")
136 ("series" "Series in which the book appeared")
137 ("address" "Address of the publisher")
138 ("edition" "Edition of the book as a capitalized English word")
139 ("month" "Month of the publication as a string (remove braces)")
140 ("pages" "Pages in the book")
141 ("type" "Word to use instead of \"chapter\"")
142 ("note" "Remarks to be put at the end of the \\bibitem")))
143 ((("author" "Author1 [and Author2 ...] [and others]")
144 ("title" "Title of the book")
145 ("chapter" "Chapter in the book"))
146 (("publisher" "Publishing company")
147 ("year" "Year of publication")
148 ("editor" "Editor1 [and Editor2 ...] [and others]")
149 ("volume" "Volume of the book in the series")
150 ("number" "Number of the book in a small series (overwritten by volume)")
151 ("series" "Series in which the book appeared")
152 ("address" "Address of the publisher")
153 ("edition" "Edition of the book as a capitalized English word")
154 ("month" "Month of the publication as a string (remove braces)")
155 ("pages" "Pages in the book")
156 ("type" "Word to use instead of \"chapter\"")
157 ("note" "Remarks to be put at the end of the \\bibitem")))))
158 ("InCollection" . (((("author" "Author1 [and Author2 ...] [and others]")
159 ("title" "Title of the article in book (will be converted to lowercase)")
160 ("booktitle" "Name of the book")
161 ("publisher" "Publishing company")
162 ("year" "Year of publication"))
163 (("editor" "Editor1 [and Editor2 ...] [and others]")
164 ("volume" "Volume of the book in the series")
165 ("number" "Number of the book in a small series (overwritten by volume)")
166 ("series" "Series in which the book appeared")
167 ("chapter" "Chapter in the book")
168 ("type" "Word to use instead of \"chapter\"")
169 ("address" "Address of the publisher")
170 ("edition" "Edition of the book as a capitalized English word")
171 ("month" "Month of the publication as a string (remove braces)")
172 ("pages" "Pages in the book")
173 ("note" "Remarks to be put at the end of the \\bibitem")))
174 ((("author" "Author1 [and Author2 ...] [and others]")
175 ("title" "Title of the article in book (will be converted to lowercase)")
176 ("booktitle" "Name of the book"))
177 (("publisher" "Publishing company")
178 ("year" "Year of publication")
179 ("editor" "Editor1 [and Editor2 ...] [and others]")
180 ("volume" "Volume of the book in the series")
181 ("number" "Number of the book in a small series (overwritten by volume)")
182 ("series" "Series in which the book appeared")
183 ("chapter" "Chapter in the book")
184 ("type" "Word to use instead of \"chapter\"")
185 ("address" "Address of the publisher")
186 ("edition" "Edition of the book as a capitalized English word")
187 ("month" "Month of the publication as a string (remove braces)")
188 ("pages" "Pages in the book")
189 ("note" "Remarks to be put at the end of the \\bibitem")))))
190 ("InProceedings" . (((("author" "Author1 [and Author2 ...] [and others]")
191 ("title" "Title of the article in proceedings (will be converted to lowercase)")
192 ("booktitle" "Name of the conference proceedings")
193 ("year" "Year of publication"))
194 (("editor" "Editor1 [and Editor2 ...] [and others]")
195 ("volume" "Volume of the conference proceedings in the series")
196 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
197 ("series" "Series in which the conference proceedings appeared")
198 ("organization" "Sponsoring organization of the conference")
199 ("publisher" "Publishing company, its location")
200 ("address" "Location of the Proceedings")
201 ("month" "Month of the publication as a string (remove braces)")
202 ("pages" "Pages in the conference proceedings")
203 ("note" "Remarks to be put at the end of the \\bibitem")))
204 ((("author" "Author1 [and Author2 ...] [and others]")
205 ("title" "Title of the article in proceedings (will be converted to lowercase)")
206 ("booktitle" "Name of the conference proceedings"))
207 (("editor" "Editor1 [and Editor2 ...] [and others]")
208 ("volume" "Volume of the conference proceedings in the series")
209 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
210 ("series" "Series in which the conference proceedings appeared")
211 ("year" "Year of publication")
212 ("organization" "Sponsoring organization of the conference")
213 ("publisher" "Publishing company, its location")
214 ("address" "Location of the Proceedings")
215 ("month" "Month of the publication as a string (remove braces)")
216 ("pages" "Pages in the conference proceedings")
217 ("note" "Remarks to be put at the end of the \\bibitem")))))
218 ("Manual" . (((("title" "Title of the manual"))
219 (("author" "Author1 [and Author2 ...] [and others]")
220 ("organization" "Publishing organization of the manual")
221 ("address" "Address of the organization")
222 ("edition" "Edition of the manual as a capitalized English word")
223 ("year" "Year of publication")
224 ("month" "Month of the publication as a string (remove braces)")
225 ("note" "Remarks to be put at the end of the \\bibitem")))))
227 ("MastersThesis" . (((("author" "Author1 [and Author2 ...] [and others]")
228 ("title" "Title of the master\'s thesis (will be converted to lowercase)")
229 ("school" "School where the master\'s thesis was written")
230 ("year" "Year of publication"))
231 (("address" "Address of the school (if not part of field \"school\") or country")
232 ("type" "Type of the master\'s thesis")
233 ("month" "Month of the publication as a string (remove braces)")
234 ("note" "Remarks to be put at the end of the \\bibitem")))))
236 (("author" "Author1 [and Author2 ...] [and others]")
237 ("title" "Title of the reference (will be converted to lowercase)")
238 ("howpublished" "The way in which the reference was published")
239 ("year" "Year of publication")
240 ("month" "Month of the publication as a string (remove braces)")
241 ("note" "Remarks to be put at the end of the \\bibitem")))))
242 ("PhdThesis" . (((("author" "Author1 [and Author2 ...] [and others]")
243 ("title" "Title of the PhD. thesis")
244 ("school" "School where the PhD. thesis was written")
245 ("year" "Year of publication"))
246 (("address" "Address of the school (if not part of field \"school\") or country")
247 ("type" "Type of the PhD. thesis")
248 ("month" "Month of the publication as a string (remove braces)")
249 ("note" "Remarks to be put at the end of the \\bibitem")))))
250 ("Proceedings" . (((("title" "Title of the conference proceedings")
251 ("year" "Year of publication"))
252 (("editor" "Editor1 [and Editor2 ...] [and others]")
253 ("volume" "Volume of the conference proceedings in the series")
254 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
255 ("series" "Series in which the conference proceedings appeared")
256 ("publisher" "Publishing company, its location")
257 ("organization" "Sponsoring organization of the conference")
258 ("address" "Location of the Proceedings")
259 ("month" "Month of the publication as a string (remove braces)")
260 ("note" "Remarks to be put at the end of the \\bibitem")))))
261 ("TechReport" . (((("author" "Author1 [and Author2 ...] [and others]")
262 ("title" "Title of the technical report (will be converted to lowercase)")
263 ("institution" "Sponsoring institution of the report")
264 ("year" "Year of publication"))
265 (("type" "Type of the report (if other than \"technical report\")")
266 ("number" "Number of the technical report")
267 ("address" "Address of the institution (if not part of field \"institution\") or country")
268 ("month" "Month of the publication as a string (remove braces)")
269 ("note" "Remarks to be put at the end of the \\bibitem")))))
270 ("Unpublished" . (((("author" "Author1 [and Author2 ...] [and others]")
271 ("title" "Title of the unpublished reference (will be converted to lowercase)")
272 ("note" "Remarks to be put at the end of the \\bibitem"))
273 (("year" "Year of publication")
274 ("month" "Month of the publication as a string (remove braces)")))))
277 "Defines reference types and their associated fields.
279 (entry-name (required optional) (crossref-required crossref-optional))
281 If the third element is nil, the first pair is always to be used.
282 If not, the second pair is to be used in the case of presence of a
283 crossref field and the third in the case of absence.
284 Required , optional, crossref-required and crossref-optional are lists.
285 Each element of these lists is a list of strings with two elements
286 (first element = name of the field,
287 second element = comment to appear in the echo area).")
289 (defvar bibtex-predefined-strings
291 ("jan") ("feb") ("mar") ("apr") ("may") ("jun") ("jul") ("aug")
292 ("sep") ("oct") ("nov") ("dec")
293 ("acmcs") ("acta") ("cacm") ("ibmjrd") ("ibmsj") ("ieeese")
294 ("ieeetc") ("ieeetcad") ("ipl") ("jacm") ("jcss") ("scp")
295 ("sicomp") ("tcs") ("tocs") ("tods") ("tog") ("toms") ("toois")
298 "Alist of string definitions.
299 Should contain the strings defined in the BibTeX style files. Each
300 element is a list with just one element: the string.")
302 (defvar bibtex-string-files nil
303 "*List of BibTeX files containing string definitions.
304 Those files must be specified using pathnames relative to the
305 directories specified in $BIBINPUTS. This variable is only evaluated
306 when bibtex-mode is entered (i. e. when loading the BibTeX file).")
308 (defvar bibtex-help-message t
309 "*If not nil print help messages in the echo area on entering a new field.")
311 (defvar bibtex-autokey-names 1
312 "*Number of names to use for the automatically generated reference key.
313 If this is set to anything but a number, all names are used.
314 See the documentation of function bibtex-generate-autokey for further detail.")
316 (defvar bibtex-autokey-name-change-strings
317 '(("\\\\\\\"a" "ae") ("\\\\\\\"o" "oe") ("\\\\\\\"u" "ue")
319 ("\\\\\\\"A" "Ae") ("\\\\\\\"O" "Oe") ("\\\\\\\"U" "Ue")
321 "Alist of (old-regexp new-string) pairs.
322 Any part of name matching a old-regexp is replaced by new-string.
323 Case of the old-regexp is significant. All regexps are tried in the
324 order in which they appear in the list, so be sure to avoid recursion here.
325 See the documentation of function bibtex-generate-autokey for further detail.")
327 (defvar bibtex-autokey-name-length 'infty
328 "*Number of characters from name to incorporate into key.
329 If this is set to anything but a number, all characters are used.
330 See the documentation of function bibtex-generate-autokey for further detail.")
332 (defvar bibtex-autokey-name-separator ""
333 "*String that comes between any two names in the key.
334 See the documentation of function bibtex-generate-autokey for further detail.")
336 (defvar bibtex-autokey-year-length 2
337 "*Number of rightmost digits from the year field yo incorporate into key.
338 See the documentation of function bibtex-generate-autokey for further detail.")
340 (defvar bibtex-autokey-titlewords 5
341 "*Number of title words to use for the automatically generated reference key.
342 If this is set to anything but a number, all title words are used.
343 See the documentation of function bibtex-generate-autokey for further detail.")
345 (defvar bibtex-autokey-title-terminators
346 '("\\." "!" "\\?" ":" ";" "---")
347 "*Regexp list defining the termination of the main part of the title.
348 Case of the regexps is ignored.
349 See the documentation of function bibtex-generate-autokey for further detail.")
351 (defvar bibtex-autokey-titlewords-stretch 2
352 "*Number of words that can additionally be used from the title.
353 These words are used only, if a sentence from the title can be ended then.
354 See the documentation of function bibtex-generate-autokey for further detail.")
356 (defvar bibtex-autokey-titleword-first-ignore
357 '("a" "an" "on" "the" "eine?" "der" "die" "das")
358 "*Determines words that may begin a title but are not to be used in the key.
359 Each item of the list is a regexp. If the first word of the title matchs a
360 regexp from that list, it is not included in the title, even if it is
361 capitalized. Regexps in the list must be entered using lowercase letters.")
363 (defvar bibtex-autokey-titleword-abbrevs nil
364 "*Determines exceptions to the usual abbreviation mechanism.
365 A list of (old-regexp new-string) pairs.
366 Use all lowercase letters for old-regexp.
367 See the documentation of function bibtex-generate-autokey for further detail.")
369 (defvar bibtex-autokey-titleword-change-strings
370 '(("\\\\\\\"a" "ae") ("\\\\\\\"o" "oe") ("\\\\\\\"u" "ue")
372 ("\\\\\\\"A" "Ae") ("\\\\\\\"O" "Oe") ("\\\\\\\"U" "Ue")
374 "Alist of (old-regexp new-string) pairs.
375 Any part of title word matching a old-regexp is replaced by new-string.
376 Case of the old-regexp is significant.
377 See the documentation of function bibtex-generate-autokey for further detail.")
379 (defvar bibtex-autokey-titleword-length 5
380 "*Number of characters from title words to incorporate into key.
381 If this is set to anything but a number, all characters are used.
382 See the documentation of function bibtex-generate-autokey for further detail.")
384 (defvar bibtex-autokey-titleword-separator "_"
385 "*String to be put between the title words.
386 See the documentation of function bibtex-generate-autokey for further detail.")
388 (defvar bibtex-autokey-name-year-separator ""
389 "*String to be put between name part and year part of key.
390 See the documentation of function bibtex-generate-autokey for further detail.")
392 (defvar bibtex-autokey-year-title-separator ":_"
393 "*String to be put between name part and year part of key.
394 See the documentation of function bibtex-generate-autokey for further detail.")
396 (defvar bibtex-autokey-edit-before-use t
397 "*If non-nil, user is allowed to edit the generated key before it is used.")
401 ;;; SYNTAX TABLE, KEYBINDINGS and BIBTEX-ENTRY-LIST
402 (defvar bibtex-mode-syntax-table
403 (let ((st (make-syntax-table)))
404 ;; [alarson:19920214.1004CST] make double quote a string quote
405 (modify-syntax-entry ?\" "\"" st)
406 (modify-syntax-entry ?$ "$$ " st)
407 (modify-syntax-entry ?% "< " st)
408 (modify-syntax-entry ?' "w " st)
409 (modify-syntax-entry ?@ "w " st)
410 (modify-syntax-entry ?\\ "\\" st)
411 (modify-syntax-entry ?\f "> " st)
412 (modify-syntax-entry ?\n "> " st)
413 (modify-syntax-entry ?~ " " st)
416 (defvar bibtex-mode-map
417 (let ((km (make-sparse-keymap)))
419 (define-key km "\t" 'bibtex-find-text)
420 (define-key km "\n" 'bibtex-next-field)
421 (define-key km "\M-\t" 'bibtex-complete-string)
422 (define-key km "\C-c\"" 'bibtex-remove-double-quotes-or-braces)
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\C-c" 'bibtex-clean-entry)
426 (define-key km "\C-c?" 'bibtex-print-help-message)
427 (define-key km "\C-c\C-p" 'bibtex-pop-previous)
428 (define-key km "\C-c\C-n" 'bibtex-pop-next)
429 (define-key km "\C-c\C-k" 'bibtex-kill-optional-field)
430 (define-key km "\C-c\C-d" 'bibtex-empty-field)
431 (define-key km "\C-c$" 'bibtex-ispell-entry)
432 (define-key km "\M-\C-a" 'bibtex-beginning-of-entry)
433 (define-key km "\M-\C-e" 'bibtex-end-of-entry)
434 (define-key km "\C-c\C-b" 'bibtex-entry)
435 (define-key km "\C-c\C-q" 'bibtex-hide-entry-bodies)
436 (define-key km "\C-c\C-a" 'show-all)
437 (define-key km "\C-c\C-rn" 'bibtex-narrow-to-entry)
438 (define-key km "\C-c\C-rw" 'widen)
439 (define-key km "\C-c\C-o" 'bibtex-remove-OPT)
441 (define-key km "\C-c\C-e\C-i" 'bibtex-InProceedings)
442 (define-key km "\C-c\C-ei" 'bibtex-InCollection)
443 (define-key km "\C-c\C-eI" 'bibtex-InBook)
444 (define-key km "\C-c\C-e\C-a" 'bibtex-Article)
445 (define-key km "\C-c\C-e\C-b" 'bibtex-InBook)
446 (define-key km "\C-c\C-eb" 'bibtex-Book)
447 (define-key km "\C-c\C-eB" 'bibtex-Booklet)
448 (define-key km "\C-c\C-e\C-c" 'bibtex-InCollection)
449 (define-key km "\C-c\C-e\C-m" 'bibtex-Manual)
450 (define-key km "\C-c\C-em" 'bibtex-MastersThesis)
451 (define-key km "\C-c\C-eM" 'bibtex-Misc)
452 (define-key km "\C-c\C-e\C-p" 'bibtex-InProceedings)
453 (define-key km "\C-c\C-ep" 'bibtex-Proceedings)
454 (define-key km "\C-c\C-eP" 'bibtex-PhdThesis)
455 (define-key km "\C-c\C-e\M-p" 'bibtex-preamble)
456 (define-key km "\C-c\C-e\C-s" 'bibtex-string)
457 (define-key km "\C-c\C-e\C-t" 'bibtex-TechReport)
458 (define-key km "\C-c\C-e\C-u" 'bibtex-Unpublished)
461 (define-key bibtex-mode-map [menu-bar move/edit]
462 (cons "BibTeX-Edit" (make-sparse-keymap "BibTeX-Edit")))
463 (define-key bibtex-mode-map [menu-bar move/edit bibtex-print-help-message]
464 '("Help about current field" . bibtex-print-help-message))
465 (define-key bibtex-mode-map [menu-bar move/edit bibtex-complete-string]
466 '("String Complete" . bibtex-complete-string))
467 (define-key bibtex-mode-map [menu-bar move/edit bibtex-next-field]
468 '("Next Field" . bibtex-next-field))
469 (define-key bibtex-mode-map [menu-bar move/edit bibtex-find-text]
470 '("End of Field" . bibtex-find-text))
471 (define-key bibtex-mode-map [menu-bar move/edit bibtex-pop-previous]
472 '("Snatch from Similar Preceding Field" . bibtex-pop-previous))
473 (define-key bibtex-mode-map [menu-bar move/edit bibtex-pop-next]
474 '("Snatch from Similar Following Field" . bibtex-pop-next))
475 (define-key bibtex-mode-map [menu-bar move/edit bibtex-remove-OPT]
476 '("Remove OPT" . bibtex-remove-OPT))
477 (define-key bibtex-mode-map [menu-bar move/edit bibtex-remove-double-quotes-or-braces]
478 '("Remove Quotes or Braces" . bibtex-remove-double-quotes-or-braces))
479 (define-key bibtex-mode-map [menu-bar move/edit bibtex-clean-entry]
480 '("Clean up Entry" . bibtex-clean-entry))
481 (define-key bibtex-mode-map [menu-bar move/edit bibtex-sort-entries]
482 '("Sort Entries" . bibtex-sort-entries))
483 (define-key bibtex-mode-map [menu-bar move/edit bibtex-validate-buffer]
484 '("Validate Entries" . bibtex-validate-buffer))
486 (define-key bibtex-mode-map [menu-bar entry-types]
487 (cons "Entry-Types" (make-sparse-keymap "Entry-Types")))
488 (define-key bibtex-mode-map [menu-bar entry-types bibtex-preamble]
489 '("Preamble" . bibtex-preamble))
490 (define-key bibtex-mode-map [menu-bar entry-types bibtex-string]
491 '("String" . bibtex-string))
492 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Misc]
493 '("Miscellaneous" . bibtex-Misc))
494 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Unpublished]
495 '("Unpublished" . bibtex-Unpublished))
496 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Manual]
497 '("Technical Manual" . bibtex-Manual))
498 (define-key bibtex-mode-map [menu-bar entry-types bibtex-TechReport]
499 '("Technical Report" . bibtex-TechReport))
500 (define-key bibtex-mode-map [menu-bar entry-types bibtex-MastersThesis]
501 '("Master's Thesis" . bibtex-MastersThesis))
502 (define-key bibtex-mode-map [menu-bar entry-types bibtex-PhdThesis]
503 '("PhD. Thesis" . bibtex-PhdThesis))
504 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Booklet]
505 '("Booklet (Bound, but no Publisher/Institution)" . bibtex-Booklet))
506 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Book]
507 '("Book" . bibtex-Book))
508 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Proceedings]
509 '("Conference Proceedings" . bibtex-Proceedings))
510 (define-key bibtex-mode-map [menu-bar entry-types bibtex-InBook]
511 '("Chapter or Pages in a Book" . bibtex-InBook))
512 (define-key bibtex-mode-map [menu-bar entry-types bibtex-InCollection]
513 '("Article in a Collection" . bibtex-InCollection))
514 (define-key bibtex-mode-map [menu-bar entry-types bibtex-InProceedings]
515 '("Article in Conference Proceedings" . bibtex-InProceedings))
516 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Article]
517 '("Article in Journal" . bibtex-Article))
521 ;;; INTERNAL VARIABLES
523 (defvar bibtex-pop-previous-search-point nil)
524 ;; Next point where bibtex-pop-previous starts looking for a similar
527 (defvar bibtex-pop-next-search-point nil)
528 ;; Next point where bibtex-pop-next starts looking for a similar entry.
530 (defvar bibtex-completion-candidates nil)
531 ;; Candidates for bibtex-complete-string. Initialized from
532 ;; bibtex-predefined-strings and bibtex-string-files. This variable is
534 (make-variable-buffer-local 'bibtex-completion-candidates)
537 ;;; FUNCTIONS to parse the BibTeX entries
539 (defun bibtex-cfield (name text)
540 ;; Create a regexp for a BibTeX field of name NAME and text TEXT.
541 (concat ",[ \t\n]*\\("
543 "\\)[ \t\n]*=[ \t\n]*\\("
546 (defconst bibtex-name-in-cfield 1)
547 ;; The regexp subexpression number of the name part in bibtex-cfield.
549 (defconst bibtex-text-in-cfield 2)
550 ;; The regexp subexpression number of the text part in bibtex-cfield.
552 (defconst bibtex-field-name "[A-Za-z][]A-Za-z0-9.:;?!`'()/*@_+=-]*")
553 ;; Regexp defining the name part of a BibTeX field.
555 (defconst bibtex-field-const "[0-9A-Za-z][A-Za-z0-9:_+-]*"
556 "Format of a bibtex field constant.")
558 (defconst bibtex-field-string
561 "{\\(\\({\\(\\({[^}]*}\\)\\|\\([^{}]\\)\\)*}\\)\\|\\([^{}]\\)\\)*}"
562 ;; maximal twice nested {}
564 "\"[^\"]*[^\\\\]\"\\|\"\"\\)"))
565 ;; Match either a string or an empty string.
567 (defconst bibtex-field-string-or-const
568 (concat bibtex-field-const "\\|" bibtex-field-string))
569 ;; Match either bibtex-field-string or bibtex-field-const.
571 (defconst bibtex-field-text
573 "\\(" bibtex-field-string-or-const "\\)"
574 "\\([ \t\n]+#[ \t\n]+\\(" bibtex-field-string-or-const "\\)\\)*\\|"
576 ;; Regexp defining the text part of a BibTeX field: either a string,
577 ;; or an empty string, or a constant followed by one or more # /
578 ;; constant pairs. Also matches simple {...} patterns.
580 (defconst bibtex-field
581 (bibtex-cfield bibtex-field-name bibtex-field-text))
582 ;; Regexp defining the format of a BibTeX field.
584 (defconst bibtex-name-in-field bibtex-name-in-cfield)
585 ;; The regexp subexpression number of the name part in BibTeX-field.
587 (defconst bibtex-text-in-field bibtex-text-in-cfield)
588 ;; The regexp subexpression number of the text part in BibTeX-field.
590 (defconst bibtex-reference-type
592 ;; Regexp defining the type part of a BibTeX reference entry.
594 (defconst bibtex-reference-head
595 (concat "^\\( \\|\t\\)*\\("
596 bibtex-reference-type
600 ;; Regexp defining format of the header line of a BibTeX reference
603 (defconst bibtex-type-in-head 2)
604 ;; The regexp subexpression number of the type part in
605 ;; bibtex-reference-head.
607 (defconst bibtex-key-in-head 3)
608 ;; The regexp subexpression number of the key part in
609 ;; bibtex-reference-head.
611 (defconst bibtex-reference
612 (concat bibtex-reference-head
613 "\\([ \t\n]*" bibtex-field "\\)*"
615 ;; Regexp defining the format of a BibTeX reference entry.
617 (defconst bibtex-type-in-reference bibtex-type-in-head)
618 ;; The regexp subexpression number of the type part in
621 (defconst bibtex-key-in-reference bibtex-key-in-head)
622 ;; The regexp subexpression number of the key part in
625 (defconst bibtex-string
626 (concat "^[ \t]*@[sS][tT][rR][iI][nN][gG][ \t\n]*[({][ \t\n]*\\("
628 "\\)[ \t\n]*=[ \t\n]*\\("
631 ;; Regexp defining the format of a BibTeX string entry.
633 (defconst bibtex-name-in-string 1)
634 ;; The regexp subexpression of the name part in bibtex-string.
636 (defconst bibtex-text-in-string 2)
637 ;; The regexp subexpression of the text part in bibtex-string.
639 (defconst bibtex-name-alignment 2)
640 ;; Alignment for the name part in BibTeX fields. Chosen on aesthetic
643 (defconst bibtex-text-alignment (length " organization = "))
644 ;; Alignment for the text part in BibTeX fields. Equal to the space
645 ;; needed for the longest name part.
651 (defun assoc-ignore-case (string alist)
652 ;; Return non-nil if STRING is `equal' to the car of an element of
653 ;; LIST. Comparison is done with case ignored. The value is actually
654 ;; the element of LIST whose car is `equal' to STRING.
655 (or (assoc string alist)
659 (downcase (car (car alist))))))
660 (setq alist (cdr alist)))
663 (defun member-of-regexp (string list)
664 ;; Return non-nil if STRING is exactly matched by an element of
665 ;; LIST. This function is influenced by the actual value of
666 ;; `case-fold-search'. The value is actually the tail of LIST whose
667 ;; car matches STRING.
673 (concat "^" (car list) "$")
675 (setq list (cdr list)))
678 (defun assoc-of-regexp (string alist)
679 ;; Return non-nil if STRING is exactly matched by the car of an
680 ;; element of LIST. This function is influenced by the actual value
681 ;; of `case-fold-search'. The value is actually the element of LIST
682 ;; whose car matches STRING.
688 (concat "^" (car (car alist)) "$")
690 (setq alist (cdr alist)))
693 (defun skip-whitespace-and-comments ()
694 (let ((md (match-data)))
696 (while (cond ((looking-at "\\s>+\\|\\s +")
698 ;; NOTE: also checked end-comment. In latex and
699 ;; lisp modes, newline is an end comment, but it
700 ;; should also be a whitespace char.
701 (goto-char (match-end 0)))
702 ;; If looking at beginning of comment, skip to end.
704 (re-search-forward "\\s>"))))
705 (store-match-data md))))
707 (defun map-bibtex-entries (fun)
708 ;; Call FUN for each BibTeX entry starting with the current. Do this
709 ;; to the end of the file. FUN is called with one argument, the key
710 ;; of the entry, and with point inside the entry. If
711 ;; bibtex-sort-ignore-string-entries is true, FUN will not be called
712 ;; for @string entries.
713 (bibtex-beginning-of-entry)
714 (while (re-search-forward "^@[^{]*{[ \t]*\\([^, ]*\\)" nil t)
715 (if (and bibtex-sort-ignore-string-entries
716 (string-equal "@string{"
717 (downcase (buffer-substring
719 (match-beginning 1)))))
721 (funcall fun (buffer-substring (match-beginning 1) (match-end 1))))))
723 (defun bibtex-flash-head ()
724 ;; Flash at BibTeX reference head before point, if exists.
726 (cond ((re-search-backward bibtex-reference-head (point-min) t)
727 (goto-char (match-beginning bibtex-type-in-head))
728 (setq flash (match-end bibtex-key-in-reference)))
731 (skip-chars-backward " \t")
734 (skip-chars-forward " \t")))
735 (if (pos-visible-in-window-p (point))
738 (buffer-substring (point) flash)))))
740 (defun bibtex-move-outside-of-entry ()
741 ;; Make sure we are outside of a BibTeX entry.
743 (= (point) (point-max))
744 (= (point) (point-min))
745 (looking-at "[ \n]*@")
750 (forward-paragraph)))
751 (re-search-forward "[ \t\n]*" (point-max) t))
753 (defun beginning-of-first-bibtex-entry ()
754 ;; Go to the beginning of the first BibTeX entry in buffer.
755 (goto-char (point-min))
757 ((re-search-forward "^@" nil 'move)
762 (message "Warning: No BibTeX entries found!"))))
764 (defun bibtex-inside-field ()
765 ;; Try to avoid point being at end of a BibTeX field.
767 (skip-chars-backward " \t") ;MON - maybe delete these chars?
768 (cond ((= (preceding-char) ?,)
769 (forward-char -2))) ; -1 --> -2 sct@dcs.edinburgh.ac.uk
770 (cond ((= (preceding-char) (aref bibtex-field-right-delimiter 0))
771 (forward-char -1)))) ;MON - only go back if quote
773 (defun bibtex-enclosing-field ()
774 ;; Search for BibTeX field enclosing point. Point moves to end of
775 ;; field; also, use match-beginning and match-end to parse the field.
776 ;; sct@dcs.edinburgh.ac.uk
777 (let ((old-point (point)))
778 (condition-case errname
779 (bibtex-enclosing-regexp bibtex-field)
781 (goto-char old-point)
782 (error "Can't find enclosing BibTeX field.")))))
784 (defun bibtex-enclosing-reference ()
785 ;; Search for BibTeX reference enclosing point. Point moves to begin
786 ;; of reference. (match-end 0) denotes end of reference.
787 ;; Hacked up for speed. Parsing isn't guaranteed any more.
788 ;; schoef@informatik.uni-oldenburg.de
789 ;; sct@dcs.edinburgh.ac.uk
790 (let ((old-point (point)))
793 "^@[A-Za-z]+[ \t\n]*[{(][^, \t\n]*[ \t\n]*,"
796 (error "Can't find enclosing BibTeX reference.")
797 (goto-char old-point)))
800 (re-search-forward "^[)}]$" (point-max) t))
802 (error "Can't find enclosing BibTeX reference.")
803 (goto-char old-point))
806 (defun bibtex-enclosing-regexp (regexp)
807 ;; Search for REGEXP enclosing point. Point moves to end of
808 ;; REGEXP. See also match-beginning and match-end. If an enclosing
809 ;; REGEXP is not found, signals search-failed; point is left in an
810 ;; undefined location.
811 ;; Doesn't something like this exist already?
812 ; compute reasonable limits for the loop
813 (let* ((initial (point))
814 (right (if (re-search-forward regexp (point-max) t)
820 (if (re-search-backward regexp (point-min) t)
823 ; within the prescribed limits, loop until a match is found
825 (re-search-forward regexp right nil 1)
826 (if (> (match-beginning 0) initial)
827 (signal 'search-failed (list regexp)))
828 (while (<= (match-end 0) initial)
829 (re-search-forward regexp right nil 1)
830 (if (> (match-beginning 0) initial)
831 (signal 'search-failed (list regexp))))
834 (defun bibtex-autokey-change (string change-list)
835 ;; Returns a string where some regexps are changed according to
836 ;; change-list. Every item of change-list is an (old-regexp
838 (let ((return-string string)
841 (len (length change-list))
844 (setq change-item (elt change-list index))
845 (while (string-match (car change-item) return-string)
848 (concat (substring return-string 0 (match-beginning 0))
850 (substring return-string (match-end 0)))))
851 (setq index (1+ index)))
854 (defun bibtex-autokey-abbrev (string len)
855 ;; Returns an abbreviation of string with at least len
856 ;; characters. String is aborted only after a consonant or at the
857 ;; word end. If len is not a number, string is returned unchanged.
858 (let* ((string-length (length string))
859 (len (if (numberp len)
860 (min len string-length)
862 (return-string (if (numberp len)
863 (substring string 0 len)))
865 (vowels '(?a ?e ?i ?o ?u ?A ?E ?I ?O ?U)))
869 (< index string-length)
870 (member (elt return-string
871 (1- (length return-string)))
873 (setq return-string (concat return-string
875 string index (1+ index)))
880 (defun bibtex-generate-autokey ()
881 "Generates automatically a key from the author/editor and the title field.
882 The generation algorithm works as follows:
883 1. If there is a non-empty author (preferred) or editor field,
884 use it for the name part of the key.
885 2. Change any substring found in `bibtex-autokey-name-change-strings'
886 to the corresponding new one (see documentation of this variable
888 3. For every of the first `bibtex-autokey-names' names in the
889 \"name\" field, determine the last name.
890 4. From every last name, take at least `bibtex-autokey-name-length'
891 characters (abort only after a consonant or at a word end).
892 5. Build the name part of the key by concatenating all abbreviated last
893 names with the string `bibtex-autokey-name-separator' between
895 6. Build the year part of the key by truncating the contents of the
896 \"year\" field to the rightmost `bibtex-autokey-year-length'
897 digits (useful values are 2 and 4).
898 7. For the title part of the key change the contents of the \"title\"
899 field of the reference according to
900 `bibtex-autokey-titleword-change-strings' to the corresponding
901 new one (see documentation of this variable for further detail).
902 8. Abbreviate the result to the string up to (but not including) the
903 first occurence of a regexp matched by the items of
904 `bibtex-autokey-title-terminators' and delete the first
905 word if it appears in `bibtex-autokey-titleword-first-ignore'.
906 Build the title part of the key by using at least the first
907 `bibtex-autokey-titlewords' capitalized words from this
908 abbreviated title. If the abbreviated title ends after maximal
909 `bibtex-autokey-titlewords' + `bibtex-autokey-titlewords-stretch'
910 capitalized words, all capitalized words from the abbreviated title
912 9. For every used title word that appears in
913 `bibtex-autokey-titleword-abbrevs' use the corresponding abbreviation
914 (see documentation of this variable for further detail).
915 10. From every title word not generated by an abbreviation, take at
916 least `bibtex-autokey-titleword-length' characters (abort only after
917 a consonant or at a word end).
918 11. Build the title part of the key by concatenating all abbreviated
919 title words with the string `bibtex-autokey-titleword-separator'
921 12. At least, to get the key, concatenate the name part, the year part
922 and the title part with `bibtex-autokey-name-year-separator'
923 between the name and the year if both are non-empty and
924 `bibtex-autokey-year-title-separator' between the year and
925 the title if both are non-empty."
930 (bibtex-beginning-of-entry)
934 (bibtex-end-of-entry)
940 (search-forward-regexp "^[ \t]*author[ \t]*=" max t)
941 (search-forward-regexp "^[ \t]*editor[ \t]*=" max t))
942 (let* (bibtex-help-message
947 (bibtex-find-text nil)
949 (bibtex-autokey-change
950 (buffer-substring start end)
951 bibtex-autokey-name-change-strings))
957 (bibtex-autokey-abbrev
958 (if (string-match "," fullname)
959 (substring fullname 0 (match-beginning 0))
961 (if (string-match " [^ ]*$" fullname)
963 fullname (1+ (match-beginning 0)))
965 bibtex-autokey-name-length)))
966 ;; Gather all names into a list
970 (not (equal namefield ""))
972 (not (numberp bibtex-autokey-names))
973 (< counter bibtex-autokey-names)))
974 (if (string-match " and " namefield)
982 namefield 0 (match-beginning 0)))))
984 (substring namefield (match-end 0))))
986 (append names (list (downcase namefield)))
988 (setq counter (1+ counter)))
990 (namepart (mapconcat (function (lambda (name) name))
992 bibtex-autokey-name-separator))
996 (if (search-forward-regexp
997 "^[ \t]*year[ \t]*=[ \t]*\\([0-9]*\\)" max t)
998 (buffer-substring (match-beginning 1) (match-end 1))
1001 (if (equal yearfield "")
1003 (substring yearfield
1004 (- (length yearfield)
1005 bibtex-autokey-year-length))))
1007 (let ((case-fold-search t)
1011 (if (search-forward-regexp
1012 "^[ \t]*title[ \t]*=" max t)
1013 (let* (bibtex-help-message
1015 (bibtex-find-text t)
1018 (bibtex-find-text nil)
1020 (bibtex-autokey-change
1021 (buffer-substring start end)
1022 bibtex-autokey-titleword-change-strings))
1027 (length bibtex-autokey-title-terminators)))
1028 (while (< index numberofitems)
1030 (elt bibtex-autokey-title-terminators index)
1033 (substring titlefield 0 (match-beginning 0))))
1034 (setq index (1+ index)))
1042 titleword bibtex-autokey-titleword-abbrevs)))
1045 (bibtex-autokey-abbrev
1047 bibtex-autokey-titleword-length)))))
1048 ;; Gather all titlewords into a list
1055 (not (equal titlestring ""))
1057 (not (numberp bibtex-autokey-titlewords))
1059 bibtex-autokey-titlewords
1060 bibtex-autokey-titlewords-stretch))))
1061 (if (string-match "\\b[A-Z][A-Za-z0-9]*" titlestring)
1062 (let* ((end-match (match-end 0))
1064 (downcase (substring titlestring
1068 (not (numberp bibtex-autokey-titlewords))
1069 (< counter bibtex-autokey-titlewords))
1074 bibtex-autokey-titleword-first-ignore))
1077 (append titlewords (list titleword))))
1080 (append titlewords-extra (list titleword))))
1082 (substring titlestring end-match)))
1083 (setq titlestring ""))
1085 counter (1+ counter)))
1086 (if (string-match "\\b[A-Z][^ ]*\\b" titlestring)
1088 (append titlewords titlewords-extra)))))
1089 (titlepart (mapconcat (function (lambda (name) name))
1091 bibtex-autokey-titleword-separator))
1098 (equal yearpart "")))
1099 bibtex-autokey-name-year-separator)
1105 (equal yearpart ""))
1106 (equal titlepart "")))
1107 bibtex-autokey-year-title-separator)
1114 ;;; INTERACTIVE FUNCTIONS:
1117 (defun bibtex-mode ()
1118 "Major mode for editing BibTeX files.
1122 A command such as \\[bibtex-Book] will outline the fields for a BibTeX book entry.
1124 The optional fields start with the string OPT, and thus ignored by BibTeX.
1125 The OPT string may be removed from a field with \\[bibtex-remove-OPT].
1126 \\[bibtex-kill-optional-field] kills the current optional field entirely.
1127 \\[bibtex-remove-double-quotes-or-braces] removes the double-quotes or
1128 braces around the text of the current field. \\[bibtex-empty-field]
1129 replaces the text of the current field with the default \"\" or {}.
1131 The command \\[bibtex-clean-entry] cleans the current entry, i.e. (i) removes
1132 double-quotes or braces from entirely numerical fields, (ii) removes
1133 OPT from all non-empty optional fields, (iii) removes all empty
1134 optional fields, and (iv) checks that no non-optional fields are empty.
1136 Use \\[bibtex-find-text] to position the cursor at the end of the current field.
1137 Use \\[bibtex-next-field] to move to end of the next field.
1139 The following may be of interest as well:
1143 bibtex-print-help-message
1144 bibtex-beginning-of-entry
1146 bibtex-ispell-abstract
1147 bibtex-narrow-to-entry
1148 bibtex-hide-entry-bodies
1150 bibtex-validate-buffer
1153 bibtex-complete-string
1156 bibtex-field-left-delimiter
1157 bibtex-field-right-delimiter
1158 bibtex-include-OPTcrossref
1159 bibtex-include-OPTkey
1160 bibtex-include-OPTannote
1161 bibtex-mode-user-optional-fields
1162 bibtex-clean-entry-zap-empty-opts
1163 bibtex-sort-ignore-string-entries
1164 bibtex-maintain-sorted-entries
1165 bibtex-entry-field-alist
1166 bibtex-predefined-strings
1169 ---------------------------------------------------------
1170 Entry to this mode calls the value of bibtex-mode-hook if that value is
1173 (kill-all-local-variables)
1174 (use-local-map bibtex-mode-map)
1175 (setq major-mode 'bibtex-mode)
1176 (setq mode-name "BibTeX")
1177 (set-syntax-table bibtex-mode-syntax-table)
1178 (setq bibtex-completion-candidates bibtex-predefined-strings)
1182 ;; collect pathnames
1183 (let* ((bib (getenv "BIBINPUTS"))
1190 (lambda (dirname) ;; strips off trailing slashes
1191 (let ((len (length dirname)))
1192 (if (equal (elt dirname (1- len)) "/")
1193 (substring dirname 0 (1- (1- len)))
1196 (while (string-match ":" path)
1201 (1- (match-end 0)))))
1202 path (substring path (match-end 0))))
1203 (append actdirs (list path)))))
1204 (filename (if (string-match "\.bib$" filename)
1206 (concat filename ".bib")))
1209 (size (length dirs)))
1213 (not (file-readable-p
1215 (concat (elt dirs item) "/" filename)))))
1216 (setq item (1+ item)))
1219 (let ((curbuf (current-buffer))
1220 (bufname (make-temp-name ""))
1221 (compl bibtex-completion-candidates))
1222 (create-file-buffer bufname)
1223 (set-buffer bufname)
1224 (insert-file-contents fullfilename)
1225 (goto-char (point-min))
1226 (while (search-forward-regexp bibtex-string nil t)
1232 (list (buffer-substring
1233 (match-beginning bibtex-name-in-string)
1234 (match-end bibtex-name-in-string)))))))
1235 (kill-buffer bufname)
1237 (setq bibtex-completion-candidates compl))
1238 (error "File %s not in $BIBINPUTS paths" filename)))))
1239 bibtex-string-files)
1240 (make-local-variable 'paragraph-start)
1241 (setq paragraph-start "[ \f\n\t]*$")
1242 (make-local-variable 'comment-start)
1243 (setq comment-start "%")
1244 (auto-fill-mode 1) ; nice alignments
1245 (setq left-margin (+ bibtex-text-alignment 1))
1246 (run-hooks 'bibtex-mode-hook))
1248 (defun bibtex-entry (entry-type &optional required optional)
1249 (interactive (let* ((completion-ignore-case t)
1250 (e-t (completing-read
1252 bibtex-entry-field-alist
1255 (if (and (null required) (null optional))
1256 (let* ((e (assoc-ignore-case entry-type bibtex-entry-field-alist))
1260 (error "Bibtex entry type %s not defined!" entry-type))
1262 (member entry-type bibtex-include-OPTcrossref)
1264 (setq required (elt c-ref 0)
1265 optional (elt c-ref 1))
1266 (setq required (elt r-n-o 0)
1267 optional (elt r-n-o 1)))))
1271 (case-fold-search t)
1273 (if bibtex-maintain-sorted-entries
1276 (goto-char (point-min))
1279 "\\(^@[a-z]+[ \t\n]*[{(][ \t\n]*\\([^ ,\t\n]+\\)[ \t\n]*,\\)\\|\\(^[ \t\n]*crossref[ \t\n]*=[ \t\n]*[{\"]\\([^ ,\t\n]*\\)[}\"],$\\)"
1281 (if (match-beginning 2)
1282 (setq label (buffer-substring
1283 (match-beginning 2) (match-end 2)))
1284 (setq label (buffer-substring
1285 (match-beginning 4) (match-end 4))))
1286 (if (not (assoc label labels))
1288 (cons (list label) labels)))))
1290 (format "%s key: " entry-type)
1293 (bibtex-find-entry-location key))
1294 (bibtex-move-outside-of-entry)
1295 (insert "@" entry-type "{")
1299 (mapcar 'bibtex-make-field required)
1300 (if (member entry-type bibtex-include-OPTcrossref)
1301 (bibtex-make-optional-field '("crossref")))
1302 (if bibtex-include-OPTkey
1303 (bibtex-make-optional-field '("key")))
1304 (mapcar 'bibtex-make-optional-field optional)
1305 (mapcar 'bibtex-make-optional-field
1306 bibtex-mode-user-optional-fields)
1307 (if bibtex-include-OPTannote
1308 (bibtex-make-optional-field '("annote")))
1311 (bibtex-next-field t))
1312 (run-hooks 'bibtex-add-entry-hook)))
1314 (defun bibtex-print-help-message ()
1315 "Prints helpful information about current field in current BibTeX entry."
1317 (let* ((pnt (point))
1321 (condition-case errname
1322 (bibtex-enclosing-regexp bibtex-field)
1325 (error "Not on BibTeX field")))
1327 "^[ \t]*\\([A-Za-z]+\\)[ \t\n]*=" nil t)
1328 (let ((mb (match-beginning 1))
1331 (if (looking-at "^[ \t]*OPT")
1338 "^@\\([A-Za-z]+\\)[ \t\n]*[{(][^, \t\n]*[ \t\n]*," nil t)
1339 (buffer-substring (match-beginning 1) (match-end 1))))
1341 (assoc-ignore-case reference-type
1342 bibtex-entry-field-alist))
1343 (c-r-list (elt entry-list 2))
1346 (member reference-type bibtex-include-OPTcrossref)
1349 (elt entry-list 1)))
1350 (list-of-entries (append
1351 (elt req-opt-list 0)
1352 (elt req-opt-list 1)
1353 bibtex-mode-user-optional-fields
1356 bibtex-include-OPTcrossref)
1358 "Label of the crossreferenced entry")))
1359 (if bibtex-include-OPTannote
1361 "Personal annotation (ignored)")))
1362 (if bibtex-include-OPTkey
1364 "Key used for label creation if author and editor fields are missing"))))))
1366 (if (assoc field-name list-of-entries)
1367 (message (elt (assoc field-name list-of-entries) 1))
1368 (message "NO COMMENT AVAILABLE"))))
1370 (defun bibtex-make-field (e-t)
1371 "Makes a field named E-T in current BibTeX entry."
1372 (interactive "sBibTeX entry type: ")
1373 (let ((name (elt e-t 0)))
1375 (indent-to-column bibtex-name-alignment)
1377 (indent-to-column bibtex-text-alignment)
1378 (insert bibtex-field-left-delimiter bibtex-field-right-delimiter)))
1380 (defun bibtex-make-optional-field (e-t)
1381 "Makes an optional field named E-T in current BibTeX entry."
1382 (interactive "sOptional BibTeX entry type: ")
1384 (setq e-t (cons (concat "OPT" (car e-t)) (cdr e-t)))
1385 (setq e-t (concat "OPT" e-t)))
1386 (bibtex-make-field e-t))
1388 (defun bibtex-beginning-of-entry ()
1389 "Move to beginning of BibTeX entry.
1390 If inside an entry, move to the beginning of it, otherwise move to the
1391 beginning of the previous entry."
1393 (re-search-backward "^@" nil 'move))
1395 (defun bibtex-end-of-entry ()
1396 "Move to end of BibTeX entry.
1397 If inside an entry, move to the end of it, otherwise move to the end
1400 ;; if point was previously at the end of an entry, this puts us
1401 ;; inside the next entry, otherwise we remain in the current one.
1403 (skip-whitespace-and-comments)
1405 (bibtex-beginning-of-entry)
1406 (let ((parse-sexp-ignore-comments t))
1407 (forward-sexp) ; skip entry type
1408 (forward-sexp) ; skip entry body
1411 (defun bibtex-ispell-entry ()
1412 "Spell whole BibTeX entry."
1414 (ispell-region (progn (bibtex-beginning-of-entry) (point))
1415 (progn (bibtex-end-of-entry) (point))))
1417 (defun bibtex-ispell-abstract ()
1418 "Spell abstract of BibTeX entry."
1420 (let ((pnt (bibtex-end-of-entry)))
1421 (bibtex-beginning-of-entry)
1423 (re-search-forward "^[ \t]*[OPT]*abstract[ \t]*=" pnt))
1424 (error "No abstract in entry.")))
1425 (ispell-region (point)
1426 (save-excursion (forward-sexp) (point))))
1428 (defun bibtex-narrow-to-entry ()
1429 "Narrow buffer to current BibTeX entry."
1432 (narrow-to-region (progn (bibtex-beginning-of-entry) (point))
1433 (progn (bibtex-end-of-entry) (point)))))
1436 (defun bibtex-hide-entry-bodies (&optional arg)
1437 "Hide all lines between first and last BibTeX entries not beginning with @.
1438 With argument, show all text."
1441 (beginning-of-first-bibtex-entry)
1442 ;; subst-char-in-region modifies the buffer, despite what the
1443 ;; documentation says...
1444 (let ((modifiedp (buffer-modified-p))
1445 (buffer-read-only nil))
1447 (subst-char-in-region (point) (point-max) ?\r ?\n t)
1448 (while (save-excursion (re-search-forward "\n[^@]" (point-max) t))
1449 ;; (save-excursion (replace-regexp "\n\\([^@]\\)" "\r\\1"))
1451 (while (re-search-forward "\n\\([^@]\\)" nil t)
1452 (replace-match "\r\\1" nil nil)))))
1453 (setq selective-display (not arg))
1454 (set-buffer-modified-p modifiedp))))
1456 (defun bibtex-sort-entries ()
1457 "Sort BibTeX entries alphabetically by key.
1458 Text before the first BibTeX entry, and following the last is not affected.
1459 If bibtex-sort-ignore-string-entries is true, @string entries will be ignored.
1462 1. Text between the closing brace ending one BibTeX entry, and the @ starting
1463 the next, is considered part of the PRECEDING entry. Perhaps it should be
1464 part of the following entry."
1467 (beginning-of-first-bibtex-entry)
1471 (goto-char (point-max))
1472 (bibtex-beginning-of-entry)
1473 (bibtex-end-of-entry)
1483 (re-search-forward "}\\s-*\n[\n \t]*@" nil 'move)
1484 (forward-char -2))))
1485 ;; STARTKEY function
1486 (if bibtex-sort-ignore-string-entries
1491 (re-search-forward "^\\s-*\\([@a-zA-Z]*\\)\\s-*{\\s-*")
1501 (re-search-forward "{\\s-*"))))
1505 (search-forward ","))))))
1507 (defun bibtex-find-entry-location (entry-name &optional maybedup)
1508 "Looking for place to put the BibTeX entry named ENTRY-NAME.
1509 Searches from beginning of buffer. Buffer is assumed to be in sorted
1510 order, without duplicates (see \\[bibtex-sort-entries]), if it is not,
1511 an error will be signalled. If optional argument MAYBEDUP is non-nil
1512 no error/warning messages about ENTRY-NAME being a (potential)
1513 duplicate of an existing entry will be emitted. This function returns
1514 `nil' if ENTRY-NAME is a duplicate of an existing entry and t in all
1516 (interactive "sBibtex entry key: ")
1520 (beginning-of-first-bibtex-entry)
1526 (cond ((string-equal entry-name current)
1528 (bibtex-beginning-of-entry)
1531 (error "Entry duplicates existing!")))
1532 ((or (null previous)
1533 (string< previous current))
1534 (setq previous current
1536 (if (string< entry-name current)
1538 (bibtex-beginning-of-entry)
1539 ;; Many schemes append strings to
1540 ;; existing entries to resolve them,
1541 ;; so initial substring matches may
1542 ;; indicate a duplicate entry.
1545 (regexp-quote entry-name) current)))
1550 (not (equal entry-name "")))
1553 "Warning: Entry %s may be a duplicate of %s!"
1557 ((string-equal previous current)
1558 (error "Duplicate here with previous!"))
1559 (t (error "Entries out of order here!")))))))
1560 (goto-char (point-max)))
1563 (defun bibtex-validate-buffer ()
1564 "Validate if the current BibTeX buffer is syntactically correct.
1565 Any garbage (e.g. comments) before the first \"@\" is not tested (so
1566 you can put comments here)."
1570 (goto-char (point-min))
1571 (while (< (re-search-forward "@\\|\\'") max)
1574 (if (looking-at "@string")
1577 (re-search-forward bibtex-reference nil t)
1578 (equal p (match-beginning 0))))
1581 (error "Bad entry begins here"))))))
1582 (bibtex-find-entry-location (make-string 10 255))
1585 (message "BibTeX buffer is syntactically correct")))
1587 (defun bibtex-next-field (arg)
1588 "Finds end of text of next BibTeX field; with arg, to its beginning."
1590 (bibtex-inside-field)
1591 (let ((start (point)))
1594 (bibtex-enclosing-field)
1595 (goto-char (match-end 0))
1601 (bibtex-find-text arg))
1603 (defun bibtex-find-text (arg)
1604 "Go to end of text of current field; with arg, go to beginning."
1606 (bibtex-inside-field)
1607 (bibtex-enclosing-field)
1610 (goto-char (match-beginning bibtex-text-in-field))
1611 (if (looking-at bibtex-field-left-delimiter)
1613 (goto-char (match-end bibtex-text-in-field))
1614 (if (= (preceding-char) (aref bibtex-field-right-delimiter 0))
1616 (if bibtex-help-message
1617 (bibtex-print-help-message)))
1619 (defun bibtex-remove-OPT ()
1620 "Removes the 'OPT' starting optional arguments and goes to end of text."
1622 (bibtex-inside-field)
1623 (bibtex-enclosing-field)
1625 (goto-char (match-beginning bibtex-name-in-field))
1626 (if (looking-at "OPT")
1627 ;; sct@dcs.edinburgh.ac.uk
1629 (delete-char (length "OPT"))
1630 (search-forward "=")
1631 (delete-horizontal-space)
1632 (indent-to-column bibtex-text-alignment))))
1633 (bibtex-inside-field))
1635 (defun bibtex-remove-double-quotes-or-braces ()
1636 "Removes \"\" or {} around string."
1639 (bibtex-inside-field)
1640 (bibtex-enclosing-field)
1641 (let ((start (match-beginning bibtex-text-in-field))
1642 (stop (match-end bibtex-text-in-field)))
1645 (if (looking-at bibtex-field-right-delimiter)
1648 (if (looking-at bibtex-field-left-delimiter)
1651 (defun bibtex-kill-optional-field ()
1652 "Kill the entire enclosing optional BibTeX field."
1654 (bibtex-inside-field)
1655 (bibtex-enclosing-field)
1656 (goto-char (match-beginning bibtex-name-in-field))
1657 (let ((the-end (match-end 0))
1658 (the-beginning (match-beginning 0)))
1659 (if (looking-at "OPT")
1662 (skip-chars-forward " \t\n,")
1663 (kill-region the-beginning the-end))
1664 (error "Mandatory fields can't be killed"))))
1666 (defun bibtex-empty-field ()
1667 "Delete the text part of the current field, replace with empty text."
1669 (bibtex-inside-field)
1670 (bibtex-enclosing-field)
1671 (goto-char (match-beginning bibtex-text-in-field))
1672 (kill-region (point) (match-end bibtex-text-in-field))
1673 (insert (concat bibtex-field-left-delimiter
1674 bibtex-field-right-delimiter))
1675 (bibtex-find-text t))
1677 (defun bibtex-pop-previous (arg)
1678 "Replace text of current field with the text of similar field in previous entry.
1679 With arg, go up ARG entries. Repeated, goes up so many times. May be
1680 intermixed with \\[bibtex-pop-next] (bibtex-pop-next)."
1682 (bibtex-inside-field)
1684 ; parse current field
1685 (bibtex-enclosing-field)
1686 (let ((start-old-text (match-beginning bibtex-text-in-field))
1687 (stop-old-text (match-end bibtex-text-in-field))
1688 (start-name (match-beginning bibtex-name-in-field))
1689 (stop-name (match-end bibtex-name-in-field))
1691 (goto-char start-name)
1692 ; construct regexp for previous field with same name as this one
1693 (let ((matching-entry
1695 (buffer-substring (if (looking-at "OPT")
1696 (+ (point) (length "OPT"))
1699 bibtex-field-text)))
1700 ; if executed several times in a row, start each search where the
1702 (cond ((or (eq last-command 'bibtex-pop-previous)
1703 (eq last-command 'bibtex-pop-next))
1707 (bibtex-enclosing-reference)
1708 (setq bibtex-pop-previous-search-point (point))
1709 (setq bibtex-pop-next-search-point (match-end 0))))
1710 (goto-char bibtex-pop-previous-search-point)
1711 ; Now search for arg'th previous similar field
1713 ((re-search-backward matching-entry (point-min) t arg)
1715 (buffer-substring (match-beginning bibtex-text-in-cfield)
1716 (match-end bibtex-text-in-cfield)))
1717 ;; change delimiters, if any changes needed
1720 (equal bibtex-field-left-delimiter "{")
1721 (eq (aref new-text 0) ?\")
1722 (eq (aref new-text (1- (length new-text))) ?\"))
1723 (aset new-text 0 ?\{)
1724 (aset new-text (1- (length new-text)) ?\}))
1726 (equal bibtex-field-left-delimiter "\"")
1727 (eq (aref new-text 0) ?\{)
1728 (eq (aref new-text (1- (length new-text))) ?\}))
1729 (aset new-text 0 ?\")
1730 (aset new-text (1- (length new-text)) ?\"))
1732 (not (eq (aref new-text 0)
1733 (aref bibtex-field-left-delimiter 0)))
1734 (not (eq (aref new-text (1- (length new-text)))
1735 (aref bibtex-field-right-delimiter 0))))
1736 (setq new-text (concat bibtex-field-left-delimiter
1738 bibtex-field-right-delimiter))))
1739 ; Found a matching field. Remember boundaries.
1740 (setq bibtex-pop-next-search-point (match-end 0))
1741 (setq bibtex-pop-previous-search-point (match-beginning 0))
1743 ; Go back to where we started, delete old text, and pop new.
1744 (goto-char stop-old-text)
1745 (delete-region start-old-text stop-old-text)
1748 (error "No previous matching BibTeX field."))))))
1749 (setq this-command 'bibtex-pop-previous))
1751 (defun bibtex-pop-next (arg)
1752 "Replace text of current field with the text of similar field in next entry.
1753 With arg, go up ARG entries. Repeated, goes up so many times. May be
1754 intermixed with \\[bibtex-pop-previous] (bibtex-pop-previous)."
1756 (bibtex-inside-field)
1758 ; parse current field
1759 (bibtex-enclosing-field)
1760 (let ((start-old-text (match-beginning bibtex-text-in-field))
1761 (stop-old-text (match-end bibtex-text-in-field))
1762 (start-name (match-beginning bibtex-name-in-field))
1763 (stop-name (match-end bibtex-name-in-field))
1765 (goto-char start-name)
1766 ; construct regexp for next field with same name as this one,
1767 ; ignoring possible OPT's
1768 (let ((matching-entry
1770 (buffer-substring (if (looking-at "OPT")
1771 (+ (point) (length "OPT"))
1774 bibtex-field-text)))
1776 ; if executed several times in a row, start each search where the
1778 (cond ((or (eq last-command 'bibtex-pop-next)
1779 (eq last-command 'bibtex-pop-previous))
1783 (bibtex-enclosing-reference)
1784 (setq bibtex-pop-previous-search-point (point))
1785 (setq bibtex-pop-next-search-point (match-end 0))))
1786 (goto-char bibtex-pop-next-search-point)
1788 ; Now search for arg'th next similar field
1790 ((re-search-forward matching-entry (point-max) t arg)
1792 (buffer-substring (match-beginning bibtex-text-in-cfield)
1793 (match-end bibtex-text-in-cfield)))
1794 ;; change delimiters, if any changes needed
1797 (equal bibtex-field-left-delimiter "{")
1798 (eq (aref new-text 0) ?\")
1799 (eq (aref new-text (1- (length new-text))) ?\"))
1800 (aset new-text 0 ?\{)
1801 (aset new-text (1- (length new-text)) ?\}))
1803 (equal bibtex-field-left-delimiter "\"")
1804 (eq (aref new-text 0) ?\{)
1805 (eq (aref new-text (1- (length new-text))) ?\}))
1806 (aset new-text 0 ?\")
1807 (aset new-text (1- (length new-text)) ?\"))
1809 (not (eq (aref new-text 0)
1810 (aref bibtex-field-left-delimiter 0)))
1811 (not (eq (aref new-text (1- (length new-text)))
1812 (aref bibtex-field-right-delimiter 0))))
1813 (setq new-text (concat bibtex-field-left-delimiter
1815 bibtex-field-right-delimiter))))
1816 ; Found a matching field. Remember boundaries.
1817 (setq bibtex-pop-next-search-point (match-end 0))
1818 (setq bibtex-pop-previous-search-point (match-beginning 0))
1820 ; Go back to where we started, delete old text, and pop new.
1821 (goto-char stop-old-text)
1822 (delete-region start-old-text stop-old-text)
1825 (error "No next matching BibTeX field."))))))
1826 (setq this-command 'bibtex-pop-next))
1828 (defun bibtex-clean-entry (&optional arg)
1829 "Finish editing the current BibTeX entry and clean it up.
1830 For all optional fields of current BibTeX entry: if empty, kill the
1831 whole field; otherwise, remove the \"OPT\" string in the name; if text
1832 numerical, remove double-quotes. For all mandatory fields: if empty,
1833 signal error. If label of entry is empty or a prefix argument was
1834 given, calculate a new entry label."
1836 (bibtex-beginning-of-entry)
1837 (let ((start (point))
1840 (narrow-to-region start (save-excursion (bibtex-end-of-entry) (point)))
1842 (re-search-forward bibtex-field (point-max) t 1)
1843 (not crossref-there))
1844 ;; determine if reference has crossref entry
1845 (let ((begin-name (match-beginning bibtex-name-in-field))
1846 (begin-text (match-beginning bibtex-text-in-field)))
1847 (goto-char begin-name)
1848 (if (looking-at "\\(OPTcrossref\\)\\|\\(crossref\\)")
1850 (goto-char begin-text)
1851 (if (not (looking-at
1853 bibtex-field-left-delimiter
1854 bibtex-field-right-delimiter)))
1855 (setq crossref-there t))))))
1856 (bibtex-enclosing-reference)
1857 (re-search-forward bibtex-reference-type)
1858 (let ((begin-type (1+ (match-beginning 0)))
1859 (end-type (match-end 0)))
1861 (while (re-search-forward bibtex-field (point-max) t 1)
1862 (let ((begin-field (match-beginning 0))
1863 (end-field (match-end 0))
1864 (begin-name (match-beginning bibtex-name-in-field))
1865 (end-name (match-end bibtex-name-in-field))
1866 (begin-text (match-beginning bibtex-text-in-field))
1867 (end-text (match-end bibtex-text-in-field))
1869 (goto-char begin-name)
1872 bibtex-clean-entry-zap-empty-opts)
1873 (goto-char begin-text)
1876 bibtex-field-left-delimiter
1877 bibtex-field-right-delimiter))
1878 ;; empty: delete whole field if really optional
1879 ;; (missing crossref handled) or complain
1881 (not crossref-there)
1885 (+ (length "OPT") begin-name) end-name))
1888 (buffer-substring begin-type end-type)
1889 bibtex-entry-field-alist))))))
1890 ;; field is not really optional
1892 (goto-char begin-name)
1893 (delete-char (length "OPT"))
1894 ;; make field non-OPT
1895 (search-forward "=")
1896 (delete-horizontal-space)
1897 (indent-to-column bibtex-text-alignment)
1899 ;; and loop to go through next test
1900 (error "Mandatory field ``%s'' is empty"
1901 (buffer-substring begin-name
1903 ;; field is optional
1904 (delete-region begin-field end-field))
1905 ;; otherwise: not empty, delete "OPT"
1906 (goto-char begin-name)
1907 (delete-char (length "OPT"))
1909 ;; fixup alignment. [alarson:19920309.2047CST]
1910 (search-forward "=")
1911 (delete-horizontal-space)
1912 (indent-to-column bibtex-text-alignment))
1913 (goto-char begin-field) ; and loop to go through next test
1916 (goto-char begin-text)
1917 (cond ((looking-at (concat
1918 bibtex-field-left-delimiter
1920 bibtex-field-right-delimiter))
1922 (goto-char end-text)
1923 (delete-char -1) ; delete enclosing double-quotes
1924 (goto-char begin-text)
1926 (goto-char end-field) ; go to end for next search
1927 (forward-char -2) ; to compensate for the 2 quotes deleted
1929 ((looking-at (concat
1930 bibtex-field-left-delimiter
1931 bibtex-field-right-delimiter))
1932 ;; if empty quotes, complain
1934 (if (not (or (equal (buffer-substring
1938 (equal (buffer-substring
1942 (error "Mandatory field ``%s'' is empty"
1943 (buffer-substring begin-name end-name))))
1945 (goto-char end-field)))))))))
1947 (bibtex-end-of-entry)
1948 ;; sct@dcs.edinburgh.ac.uk
1952 (if (eq (preceding-char) ?,)
1953 (backward-delete-char 1)))
1954 (skip-whitespace-and-comments))
1956 (bibtex-beginning-of-entry)
1957 (bibtex-end-of-entry)
1960 (bibtex-beginning-of-entry)
1961 (if (search-forward-regexp
1962 bibtex-reference-head eob t)
1964 (match-beginning bibtex-key-in-head)
1965 (match-end bibtex-key-in-head))))))
1971 (if bibtex-autokey-edit-before-use
1972 (read-from-minibuffer "Key to use: "
1973 (bibtex-generate-autokey))
1974 (bibtex-generate-autokey))))
1975 (bibtex-beginning-of-entry)
1976 (search-forward-regexp "^@[A-Za-z]+[ \t]*[({]\\([^,]*\\)")
1977 (delete-region (match-beginning 1)
1981 (bibtex-beginning-of-entry)
1984 (bibtex-end-of-entry)
1985 (search-forward-regexp "^@" nil 'move)
1989 (kill-region start end)
1990 (let ((success (bibtex-find-entry-location autokey t)))
1992 (bibtex-beginning-of-entry)
1993 (search-forward-regexp bibtex-reference-head)
1994 (setq kill-ring (cdr kill-ring))
1997 "Duplicated key (change manually and enter `bibtex-sort-entries')")))))))))
1999 (defun bibtex-complete-string ()
2000 "Complete word fragment before point to longest prefix of a defined string.
2001 If point is not after the part of a word, all strings are listed."
2003 (let* ((end (point))
2004 (beg (save-excursion
2005 (re-search-backward "[ \t{\"]")
2008 (part-of-word (buffer-substring beg end))
2009 (string-list (copy-sequence bibtex-completion-candidates))
2010 (case-fold-search t)
2011 (completion (save-excursion
2013 (while (re-search-backward
2014 "@string[ \t\n]*{" (point-min) t)
2015 (goto-char (match-end 0))
2017 (strt (match-beginning 0)))
2018 (re-search-forward "[ \t\n]*="
2020 (goto-char (match-beginning 0))
2023 (list (buffer-substring pnt (point)))
2032 (try-completion part-of-word string-list)))))
2033 (cond ((eq completion t)
2034 (bibtex-remove-double-quotes-or-braces))
2036 (error "Can't find completion for \"%s\"" part-of-word))
2037 ((not (string= part-of-word completion))
2038 (delete-region beg end)
2040 (if (assoc completion string-list)
2041 (bibtex-remove-double-quotes-or-braces)))
2043 (message "Making completion list...")
2044 (let ((list (all-completions part-of-word string-list)))
2045 (with-output-to-temp-buffer "*Completions*"
2046 (display-completion-list list)))
2047 (message "Making completion list...done")))))
2049 (defun bibtex-Article ()
2051 (bibtex-entry "Article"))
2053 (defun bibtex-Book ()
2055 (bibtex-entry "Book"))
2057 (defun bibtex-Booklet ()
2059 (bibtex-entry "Booklet"))
2061 (defun bibtex-InBook ()
2063 (bibtex-entry "InBook"))
2065 (defun bibtex-InCollection ()
2067 (bibtex-entry "InCollection"))
2069 (defun bibtex-InProceedings ()
2071 (bibtex-entry "InProceedings"))
2073 (defun bibtex-Manual ()
2075 (bibtex-entry "Manual"))
2077 (defun bibtex-MastersThesis ()
2079 (bibtex-entry "MastersThesis"))
2081 (defun bibtex-Misc ()
2083 (bibtex-entry "Misc"))
2085 (defun bibtex-PhdThesis ()
2087 (bibtex-entry "PhdThesis"))
2089 (defun bibtex-Proceedings ()
2091 (bibtex-entry "Proceedings"))
2093 (defun bibtex-TechReport ()
2095 (bibtex-entry "TechReport"))
2097 (defun bibtex-Unpublished ()
2099 (bibtex-entry "Unpublished"))
2101 (defun bibtex-string ()
2103 (bibtex-move-outside-of-entry)
2107 bibtex-field-left-delimiter
2108 bibtex-field-right-delimiter
2113 (defun bibtex-preamble ()
2115 (bibtex-move-outside-of-entry)
2116 (insert "@Preamble{}\n")
2122 ;;; MAKE BIBTEX a FEATURE
2127 ;;; bibtex.el ends here