root/trunk/lisp/textmodes/bibtex.el

Revision 4220, 195.5 kB (checked in by miyoshi, 9 months ago)

Sync up with Emacs22.2.

  • Property svn:eol-style set to LF
Line 
1 ;;; bibtex.el --- BibTeX mode for GNU Emacs
2
3 ;; Copyright (C) 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
4 ;;   2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
5
6 ;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de>
7 ;;      Bengt Martensson <bengt@mathematik.uni-Bremen.de>
8 ;;      Marc Shapiro <marc.shapiro@acm.org>
9 ;;      Mike Newton <newton@gumby.cs.caltech.edu>
10 ;;      Aaron Larson <alarson@src.honeywell.com>
11 ;;      Dirk Herrmann <D.Herrmann@tu-bs.de>
12 ;; Maintainer: Roland Winkler <roland.winkler@physik.uni-erlangen.de>
13 ;; Keywords: BibTeX, LaTeX, TeX
14
15 ;; This file is part of GNU Emacs.
16
17 ;; GNU Emacs is free software; you can redistribute it and/or modify
18 ;; it under the terms of the GNU General Public License as published by
19 ;; the Free Software Foundation; either version 3, or (at your option)
20 ;; any later version.
21
22 ;; GNU Emacs is distributed in the hope that it will be useful,
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 ;; GNU General Public License for more details.
26
27 ;; You should have received a copy of the GNU General Public License
28 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
29 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
30 ;; Boston, MA 02110-1301, USA.
31
32 ;;; Commentary:
33
34 ;;  Major mode for editing and validating BibTeX files.
35
36 ;;  Usage:
37 ;;  See documentation for function bibtex-mode or type "\M-x describe-mode"
38 ;;  when you are in BibTeX mode.
39
40 ;;  Todo:
41 ;;  Distribute texinfo file.
42
43 ;;; Code:
44
45 (require 'button)
46
47
48 ;; User Options:
49
50 (defgroup bibtex nil
51   "BibTeX mode."
52   :group 'tex
53   :prefix "bibtex-")
54
55 (defgroup bibtex-autokey nil
56   "Generate automatically a key from the author/editor and the title field."
57   :group 'bibtex
58   :prefix "bibtex-autokey-")
59
60 (defcustom bibtex-mode-hook nil
61   "List of functions to call on entry to BibTeX mode."
62   :group 'bibtex
63   :type 'hook)
64
65 (defcustom bibtex-field-delimiters 'braces
66   "Type of field delimiters.  Allowed values are `braces' or `double-quotes'."
67   :group 'bibtex
68   :type '(choice (const braces)
69                  (const double-quotes)))
70
71 (defcustom bibtex-entry-delimiters 'braces
72   "Type of entry delimiters.  Allowed values are `braces' or `parentheses'."
73   :group 'bibtex
74   :type '(choice (const braces)
75                  (const parentheses)))
76
77 (defcustom bibtex-include-OPTcrossref '("InProceedings" "InCollection")
78   "List of BibTeX entries that get an OPTcrossref field."
79   :group 'bibtex
80   :type '(repeat string))
81
82 (defcustom bibtex-include-OPTkey t
83   "If non-nil, all newly created entries get an OPTkey field.
84 If this is a string, use it as the initial field text.
85 If this is a function, call it to generate the initial field text."
86   :group 'bibtex
87   :type '(choice (const :tag "None" nil)
88                  (string :tag "Initial text")
89                  (function :tag "Initialize Function")
90                  (const :tag "Default" t)))
91 (put 'bibtex-include-OPTkey 'risky-local-variable t)
92
93 (defcustom bibtex-user-optional-fields
94   '(("annote" "Personal annotation (ignored)"))
95   "List of optional fields the user wants to have always present.
96 Entries should be of the same form as the OPTIONAL and
97 CROSSREF-OPTIONAL lists in `bibtex-entry-field-alist' (which see)."
98   :group 'bibtex
99   :type '(repeat (group (string :tag "Field")
100                         (string :tag "Comment")
101                         (option (choice :tag "Init"
102                                         (const nil) string function)))))
103 (put 'bibtex-user-optional-fields 'risky-local-variable t)
104
105 (defcustom bibtex-entry-format
106   '(opts-or-alts required-fields numerical-fields)
107   "Type of formatting performed by `bibtex-clean-entry'.
108 It may be t, nil, or a list of symbols out of the following:
109 opts-or-alts        Delete empty optional and alternative fields and
110                       remove OPT and ALT prefixes from used fields.
111 required-fields     Signal an error if a required field is missing.
112 numerical-fields    Delete delimiters around numeral fields.
113 page-dashes         Change double dashes in page field to single dash
114                       (for scribe compatibility).
115 inherit-booktitle   If entry contains a crossref field and the booktitle
116                       field is empty, set the booktitle field to the content
117                       of the title field of the crossreferenced entry.
118 realign             Realign entries, so that field texts and perhaps equal
119                       signs (depending on the value of
120                       `bibtex-align-at-equal-sign') begin in the same column.
121 last-comma          Add or delete comma on end of last field in entry,
122                       according to value of `bibtex-comma-after-last-field'.
123 delimiters          Change delimiters according to variables
124                       `bibtex-field-delimiters' and `bibtex-entry-delimiters'.
125 unify-case          Change case of entry and field names.
126
127 The value t means do all of the above formatting actions.
128 The value nil means do no formatting at all."
129   :group 'bibtex
130   :type '(choice (const :tag "None" nil)
131                  (const :tag "All" t)
132                  (set :menu-tag "Some"
133                       (const opts-or-alts)
134                       (const required-fields)
135                       (const numerical-fields)
136                       (const page-dashes)
137                       (const inherit-booktitle)
138                       (const realign)
139                       (const last-comma)
140                       (const delimiters)
141                       (const unify-case))))
142
143 (defcustom bibtex-clean-entry-hook nil
144   "List of functions to call when entry has been cleaned.
145 Functions are called with point inside the cleaned entry, and the buffer
146 narrowed to just the entry."
147   :group 'bibtex
148   :type 'hook)
149
150 (defcustom bibtex-maintain-sorted-entries nil
151   "If non-nil, BibTeX mode maintains all entries in sorted order.
152 Allowed non-nil values are:
153 plain or t   All entries are sorted alphabetically.
154 crossref     All entries are sorted alphabetically unless an entry has a
155              crossref field.  These crossrefed entries are placed in
156              alphabetical order immediately preceding the main entry.
157 entry-class  The entries are divided into classes according to their
158              entry name, see `bibtex-sort-entry-class'.  Within each class
159              the entries are sorted alphabetically.
160 See also `bibtex-sort-ignore-string-entries'."
161   :group 'bibtex
162   :type '(choice (const nil)
163                  (const plain)
164                  (const crossref)
165                  (const entry-class)
166                  (const t)))
167 (put 'bibtex-maintain-sorted-entries 'safe-local-variable
168      '(lambda (a) (memq a '(nil t plain crossref entry-class))))
169
170 (defcustom bibtex-sort-entry-class
171   '(("String")
172     (catch-all)
173     ("Book" "Proceedings"))
174   "List of classes of BibTeX entry names, used for sorting entries.
175 If value of `bibtex-maintain-sorted-entries' is `entry-class'
176 entries are ordered according to the classes they belong to.  Each
177 class contains a list of entry names.  An entry `catch-all' applies
178 to all entries not explicitly mentioned."
179   :group 'BibTeX
180   :type '(repeat (choice :tag "Class"
181                          (const :tag "catch-all" (catch-all))
182                          (repeat :tag "Entry name" string))))
183 (put 'bibtex-sort-entry-class 'safe-local-variable
184      (lambda (x) (let ((OK t))
185               (while (consp x)
186                 (let ((y (pop x)))
187                   (while (consp y)
188                     (let ((z (pop y)))
189                       (unless (or (stringp z) (eq z 'catch-all))
190                         (setq OK nil))))
191                   (unless (null y) (setq OK nil))))
192               (unless (null x) (setq OK nil))
193               OK)))
194
195 (defcustom bibtex-sort-ignore-string-entries t
196   "If non-nil, BibTeX @String entries are not sort-significant.
197 That means they are ignored when determining ordering of the buffer
198 \(e.g., sorting, locating alphabetical position for new entries, etc.)."
199   :group 'bibtex
200   :type 'boolean)
201
202 (defcustom bibtex-field-kill-ring-max 20
203   "Max length of `bibtex-field-kill-ring' before discarding oldest elements."
204   :group 'bibtex
205   :type 'integer)
206
207 (defcustom bibtex-entry-kill-ring-max 20
208   "Max length of `bibtex-entry-kill-ring' before discarding oldest elements."
209   :group 'bibtex
210   :type 'integer)
211
212 (defcustom bibtex-parse-keys-timeout 60
213   "Time interval in seconds for parsing BibTeX buffers during idle time.
214 Parsing initializes `bibtex-reference-keys' and `bibtex-strings'."
215   :group 'bibtex
216   :type 'integer)
217
218 (defcustom bibtex-parse-keys-fast t
219   "If non-nil, use fast but simplified algorithm for parsing BibTeX keys.
220 If parsing fails, try to set this variable to nil."
221   :group 'bibtex
222   :type 'boolean)
223
224 (defcustom bibtex-entry-field-alist
225   '(("Article"
226      ((("author" "Author1 [and Author2 ...] [and others]")
227        ("title" "Title of the article (BibTeX converts it to lowercase)")
228        ("journal" "Name of the journal (use string, remove braces)")
229        ("year" "Year of publication"))
230       (("volume" "Volume of the journal")
231        ("number" "Number of the journal (only allowed if entry contains volume)")
232        ("pages" "Pages in the journal")
233        ("month" "Month of the publication as a string (remove braces)")
234        ("note" "Remarks to be put at the end of the \\bibitem")))
235      ((("author" "Author1 [and Author2 ...] [and others]")
236        ("title" "Title of the article (BibTeX converts it to lowercase)"))
237       (("pages" "Pages in the journal")
238        ("journal" "Name of the journal (use string, remove braces)")
239        ("year" "Year of publication")
240        ("volume" "Volume of the journal")
241        ("number" "Number of the journal")
242        ("month" "Month of the publication as a string (remove braces)")
243        ("note" "Remarks to be put at the end of the \\bibitem"))))
244     ("Book"
245      ((("author" "Author1 [and Author2 ...] [and others]" nil t)
246        ("editor" "Editor1 [and Editor2 ...] [and others]" nil t)
247        ("title" "Title of the book")
248        ("publisher" "Publishing company")
249        ("year" "Year of publication"))
250       (("volume" "Volume of the book in the series")
251        ("number" "Number of the book in a small series (overwritten by volume)")
252        ("series" "Series in which the book appeared")
253        ("address" "Address of the publisher")
254        ("edition" "Edition of the book as a capitalized English word")
255        ("month" "Month of the publication as a string (remove braces)")
256        ("note" "Remarks to be put at the end of the \\bibitem")))
257      ((("author" "Author1 [and Author2 ...] [and others]" nil t)
258        ("editor" "Editor1 [and Editor2 ...] [and others]" nil t)
259        ("title" "Title of the book"))
260       (("publisher" "Publishing company")
261        ("year" "Year of publication")
262        ("volume" "Volume of the book in the series")
263        ("number" "Number of the book in a small series (overwritten by volume)")
264        ("series" "Series in which the book appeared")
265        ("address" "Address of the publisher")
266        ("edition" "Edition of the book as a capitalized English word")
267        ("month" "Month of the publication as a string (remove braces)")
268        ("note" "Remarks to be put at the end of the \\bibitem"))))
269     ("Booklet"
270      ((("title" "Title of the booklet (BibTeX converts it to lowercase)"))
271       (("author" "Author1 [and Author2 ...] [and others]")
272        ("howpublished" "The way in which the booklet was published")
273        ("address" "Address of the publisher")
274        ("month" "Month of the publication as a string (remove braces)")
275        ("year" "Year of publication")
276        ("note" "Remarks to be put at the end of the \\bibitem"))))
277     ("InBook"
278      ((("author" "Author1 [and Author2 ...] [and others]" nil t)
279        ("editor" "Editor1 [and Editor2 ...] [and others]" nil t)
280        ("title" "Title of the book")
281        ("chapter" "Chapter in the book")
282        ("publisher" "Publishing company")
283        ("year" "Year of publication"))
284       (("volume" "Volume of the book in the series")
285        ("number" "Number of the book in a small series (overwritten by volume)")
286        ("series" "Series in which the book appeared")
287        ("type" "Word to use instead of \"chapter\"")
288        ("address" "Address of the publisher")
289        ("edition" "Edition of the book as a capitalized English word")
290        ("month" "Month of the publication as a string (remove braces)")
291        ("pages" "Pages in the book")
292        ("note" "Remarks to be put at the end of the \\bibitem")))
293      ((("author" "Author1 [and Author2 ...] [and others]" nil t)
294        ("editor" "Editor1 [and Editor2 ...] [and others]" nil t)
295        ("title" "Title of the book")
296        ("chapter" "Chapter in the book"))
297       (("pages" "Pages in the book")
298        ("publisher" "Publishing company")
299        ("year" "Year of publication")
300        ("volume" "Volume of the book in the series")
301        ("number" "Number of the book in a small series (overwritten by volume)")
302        ("series" "Series in which the book appeared")
303        ("type" "Word to use instead of \"chapter\"")
304        ("address" "Address of the publisher")
305        ("edition" "Edition of the book as a capitalized English word")
306        ("month" "Month of the publication as a string (remove braces)")
307        ("note" "Remarks to be put at the end of the \\bibitem"))))
308     ("InCollection"
309      ((("author" "Author1 [and Author2 ...] [and others]")
310        ("title" "Title of the article in book (BibTeX converts it to lowercase)")
311        ("booktitle" "Name of the book")
312        ("publisher" "Publishing company")
313        ("year" "Year of publication"))
314       (("editor" "Editor1 [and Editor2 ...] [and others]")
315        ("volume" "Volume of the book in the series")
316        ("number" "Number of the book in a small series (overwritten by volume)")
317        ("series" "Series in which the book appeared")
318        ("type" "Word to use instead of \"chapter\"")
319        ("chapter" "Chapter in the book")
320        ("pages" "Pages in the book")
321        ("address" "Address of the publisher")
322        ("edition" "Edition of the book as a capitalized English word")
323        ("month" "Month of the publication as a string (remove braces)")
324        ("note" "Remarks to be put at the end of the \\bibitem")))
325      ((("author" "Author1 [and Author2 ...] [and others]")
326        ("title" "Title of the article in book (BibTeX converts it to lowercase)")
327        ("booktitle" "Name of the book"))
328       (("pages" "Pages in the book")
329        ("publisher" "Publishing company")
330        ("year" "Year of publication")
331        ("editor" "Editor1 [and Editor2 ...] [and others]")
332        ("volume" "Volume of the book in the series")
333        ("number" "Number of the book in a small series (overwritten by volume)")
334        ("series" "Series in which the book appeared")
335        ("type" "Word to use instead of \"chapter\"")
336        ("chapter" "Chapter in the book")
337        ("address" "Address of the publisher")
338        ("edition" "Edition of the book as a capitalized English word")
339        ("month" "Month of the publication as a string (remove braces)")
340        ("note" "Remarks to be put at the end of the \\bibitem"))))
341     ("InProceedings"
342      ((("author" "Author1 [and Author2 ...] [and others]")
343        ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)")
344        ("booktitle" "Name of the conference proceedings")
345        ("year" "Year of publication"))
346       (("editor" "Editor1 [and Editor2 ...] [and others]")
347        ("volume" "Volume of the conference proceedings in the series")
348        ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
349        ("series" "Series in which the conference proceedings appeared")
350        ("pages" "Pages in the conference proceedings")
351        ("address" "Location of the Proceedings")
352        ("month" "Month of the publication as a string (remove braces)")
353        ("organization" "Sponsoring organization of the conference")
354        ("publisher" "Publishing company, its location")
355        ("note" "Remarks to be put at the end of the \\bibitem")))
356      ((("author" "Author1 [and Author2 ...] [and others]")
357        ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)"))
358       (("booktitle" "Name of the conference proceedings")
359        ("pages" "Pages in the conference proceedings")
360        ("year" "Year of publication")
361        ("editor" "Editor1 [and Editor2 ...] [and others]")
362        ("volume" "Volume of the conference proceedings in the series")
363        ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
364        ("series" "Series in which the conference proceedings appeared")
365        ("address" "Location of the Proceedings")
366        ("month" "Month of the publication as a string (remove braces)")
367        ("organization" "Sponsoring organization of the conference")
368        ("publisher" "Publishing company, its location")
369        ("note" "Remarks to be put at the end of the \\bibitem"))))
370     ("Manual"
371      ((("title" "Title of the manual"))
372       (("author" "Author1 [and Author2 ...] [and others]")
373        ("organization" "Publishing organization of the manual")
374        ("address" "Address of the organization")
375        ("edition" "Edition of the manual as a capitalized English word")
376        ("month" "Month of the publication as a string (remove braces)")
377        ("year" "Year of publication")
378        ("note" "Remarks to be put at the end of the \\bibitem"))))
379     ("MastersThesis"
380      ((("author" "Author1 [and Author2 ...] [and others]")
381        ("title" "Title of the master\'s thesis (BibTeX converts it to lowercase)")
382        ("school" "School where the master\'s thesis was written")
383        ("year" "Year of publication"))
384       (("type" "Type of the master\'s thesis (if other than \"Master\'s thesis\")")
385        ("address" "Address of the school (if not part of field \"school\") or country")
386        ("month" "Month of the publication as a string (remove braces)")
387        ("note" "Remarks to be put at the end of the \\bibitem"))))
388     ("Misc"
389      (()
390       (("author" "Author1 [and Author2 ...] [and others]")
391        ("title" "Title of the work (BibTeX converts it to lowercase)")
392        ("howpublished" "The way in which the work was published")
393        ("month" "Month of the publication as a string (remove braces)")
394        ("year" "Year of publication")
395        ("note" "Remarks to be put at the end of the \\bibitem"))))
396     ("PhdThesis"
397      ((("author" "Author1 [and Author2 ...] [and others]")
398        ("title" "Title of the PhD. thesis")
399        ("school" "School where the PhD. thesis was written")
400        ("year" "Year of publication"))
401       (("type" "Type of the PhD. thesis")
402        ("address" "Address of the school (if not part of field \"school\") or country")
403        ("month" "Month of the publication as a string (remove braces)")
404        ("note" "Remarks to be put at the end of the \\bibitem"))))
405     ("Proceedings"
406      ((("title" "Title of the conference proceedings")
407        ("year" "Year of publication"))
408       (("booktitle" "Title of the proceedings for cross references")
409        ("editor" "Editor1 [and Editor2 ...] [and others]")
410        ("volume" "Volume of the conference proceedings in the series")
411        ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
412        ("series" "Series in which the conference proceedings appeared")
413        ("address" "Location of the Proceedings")
414        ("month" "Month of the publication as a string (remove braces)")
415        ("organization" "Sponsoring organization of the conference")
416        ("publisher" "Publishing company, its location")
417        ("note" "Remarks to be put at the end of the \\bibitem"))))
418     ("TechReport"
419      ((("author" "Author1 [and Author2 ...] [and others]")
420        ("title" "Title of the technical report (BibTeX converts it to lowercase)")
421        ("institution" "Sponsoring institution of the report")
422        ("year" "Year of publication"))
423       (("type" "Type of the report (if other than \"technical report\")")
424        ("number" "Number of the technical report")
425        ("address" "Address of the institution (if not part of field \"institution\") or country")
426        ("month" "Month of the publication as a string (remove braces)")
427        ("note" "Remarks to be put at the end of the \\bibitem"))))
428     ("Unpublished"
429      ((("author" "Author1 [and Author2 ...] [and others]")
430        ("title" "Title of the unpublished work (BibTeX converts it to lowercase)")
431        ("note" "Remarks to be put at the end of the \\bibitem"))
432       (("month" "Month of the publication as a string (remove braces)")
433        ("year" "Year of publication")))))
434
435   "List of BibTeX entry types and their associated fields.
436 List elements are triples
437 \(ENTRY-NAME (REQUIRED OPTIONAL) (CROSSREF-REQUIRED CROSSREF-OPTIONAL)).
438 ENTRY-NAME is the name of a BibTeX entry.  The remaining pairs contain
439 the required and optional fields of the BibTeX entry.
440 The second pair is used if a crossref field is present
441 and the first pair is used if a crossref field is absent.
442 If the second pair is nil, the first pair is always used.
443 REQUIRED, OPTIONAL, CROSSREF-REQUIRED and CROSSREF-OPTIONAL are lists.
444 Each element of these lists is a list of the form
445 \(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG).
446 COMMENT-STRING, INIT, and ALTERNATIVE-FLAG are optional.
447 FIELD-NAME is the name of the field, COMMENT-STRING is the comment that
448 appears in the echo area, INIT is either the initial content of the
449 field or a function, which is called to determine the initial content
450 of the field, and ALTERNATIVE-FLAG (either nil or t) marks if the
451 field is an alternative.  ALTERNATIVE-FLAG may be t only in the
452 REQUIRED or CROSSREF-REQUIRED lists."
453   :group 'bibtex
454   :type '(repeat (group (string :tag "Entry name")
455                         (group (repeat :tag "Required fields"
456                                        (group (string :tag "Field")
457                                               (string :tag "Comment")
458                                               (option (choice :tag "Init" :value nil
459                                                               (const nil) string function))
460                                               (option (choice :tag "Alternative"
461                                                               (const :tag "No" nil)
462                                                               (const :tag "Yes" t)))))
463                                (repeat :tag "Optional fields"
464                                        (group (string :tag "Field")
465                                               (string :tag "Comment")
466                                               (option (choice :tag "Init" :value nil
467                                                               (const nil) string function)))))
468                         (option :extra-offset -4
469                          (group (repeat :tag "Crossref: required fields"
470                                         (group (string :tag "Field")
471                                                (string :tag "Comment")
472                                                (option (choice :tag "Init" :value nil
473                                                                (const nil) string function))
474                                                (option (choice :tag "Alternative"
475                                                                (const :tag "No" nil)
476                                                                (const :tag "Yes" t)))))
477                                 (repeat :tag "Crossref: optional fields"
478                                         (group (string :tag "Field")
479                                                (string :tag "Comment")
480                                                (option (choice :tag "Init" :value nil
481                                                                (const nil) string function)))))))))
482 (put 'bibtex-entry-field-alist 'risky-local-variable t)
483
484 (defcustom bibtex-comment-start "@Comment"
485   "String starting a BibTeX comment."
486   :group 'bibtex
487   :type 'string)
488
489 (defcustom bibtex-add-entry-hook nil
490   "List of functions to call when BibTeX entry has been inserted."
491   :group 'bibtex
492   :type 'hook)
493
494 (defcustom bibtex-predefined-month-strings
495   '(("jan" . "January")
496     ("feb" . "February")
497     ("mar" . "March")
498     ("apr" . "April")
499     ("may" . "May")
500     ("jun" . "June")
501     ("jul" . "July")
502     ("aug" . "August")
503     ("sep" . "September")
504     ("oct" . "October")
505     ("nov" . "November")
506     ("dec" . "December"))
507   "Alist of month string definitions used in the BibTeX style files.
508 Each element is a pair of strings (ABBREVIATION . EXPANSION)."
509   :group 'bibtex
510   :type '(repeat (cons (string :tag "Month abbreviation")
511                        (string :tag "Month expansion"))))
512
513 (defcustom bibtex-predefined-strings
514   (append
515    bibtex-predefined-month-strings
516    '(("acmcs"    . "ACM Computing Surveys")
517      ("acta"     . "Acta Informatica")
518      ("cacm"     . "Communications of the ACM")
519      ("ibmjrd"   . "IBM Journal of Research and Development")
520      ("ibmsj"    . "IBM Systems Journal")
521      ("ieeese"   . "IEEE Transactions on Software Engineering")
522      ("ieeetc"   . "IEEE Transactions on Computers")
523      ("ieeetcad" . "IEEE Transactions on Computer-Aided Design of Integrated Circuits")
524      ("ipl"      . "Information Processing Letters")
525      ("jacm"     . "Journal of the ACM")
526      ("jcss"     . "Journal of Computer and System Sciences")
527      ("scp"      . "Science of Computer Programming")
528      ("sicomp"   . "SIAM Journal on Computing")
529      ("tcs"      . "Theoretical Computer Science")
530      ("tocs"     . "ACM Transactions on Computer Systems")
531      ("tods"     . "ACM Transactions on Database Systems")
532      ("tog"      . "ACM Transactions on Graphics")
533      ("toms"     . "ACM Transactions on Mathematical Software")
534      ("toois"    . "ACM Transactions on Office Information Systems")
535      ("toplas"   . "ACM Transactions on Programming Languages and Systems")))
536   "Alist of string definitions used in the BibTeX style files.
537 Each element is a pair of strings (ABBREVIATION . EXPANSION)."
538   :group 'bibtex
539   :type '(repeat (cons (string :tag "String")
540                        (string :tag "String expansion"))))
541
542 (defcustom bibtex-string-files nil
543   "List of BibTeX files containing string definitions.
544 List elements can be absolute file names or file names relative
545 to the directories specified in `bibtex-string-file-path'."
546   :group 'bibtex
547   :type '(repeat file))
548
549 (defvar bibtex-string-file-path (getenv "BIBINPUTS")
550   "*Colon separated list of paths to search for `bibtex-string-files'.")
551
552 (defcustom bibtex-files nil
553   "List of BibTeX files that are searched for entry keys.
554 List elements can be absolute file names or file names relative to the
555 directories specified in `bibtex-file-path'.  If an element is a directory,
556 check all BibTeX files in this directory.  If an element is the symbol
557 `bibtex-file-path', check all BibTeX files in `bibtex-file-path'."
558   :group 'bibtex
559   :type '(repeat (choice (const :tag "bibtex-file-path" bibtex-file-path)
560                          directory file)))
561
562 (defvar bibtex-file-path (getenv "BIBINPUTS")
563   "*Colon separated list of paths to search for `bibtex-files'.")
564
565 (defcustom bibtex-help-message t
566   "If non-nil print help messages in the echo area on entering a new field."
567   :group 'bibtex
568   :type 'boolean)
569
570 (defcustom bibtex-autokey-prefix-string ""
571   "String prefix for automatically generated reference keys.
572 See `bibtex-generate-autokey' for details."
573   :group 'bibtex-autokey
574   :type 'string)
575
576 (defcustom bibtex-autokey-names 1
577   "Number of names to use for the automatically generated reference key.
578 Possibly more names are used according to `bibtex-autokey-names-stretch'.
579 If this variable is nil, all names are used.
580 See `bibtex-generate-autokey' for details."
581   :group 'bibtex-autokey
582   :type '(choice (const :tag "All" infty)
583                  integer))
584
585 (defcustom bibtex-autokey-names-stretch 0
586   "Number of names that can additionally be used for reference keys.
587 These names are used only, if all names are used then.
588 See `bibtex-generate-autokey' for details."
589   :group 'bibtex-autokey
590   :type 'integer)
591
592 (defcustom bibtex-autokey-additional-names ""
593   "String to append to the generated key if not all names could be used.
594 See `bibtex-generate-autokey' for details."
595   :group 'bibtex-autokey
596   :type 'string)
597
598 (defcustom bibtex-autokey-expand-strings nil
599   "If non-nil, expand strings when extracting the content of a BibTeX field.
600 See `bibtex-generate-autokey' for details."
601   :group 'bibtex-autokey
602   :type 'boolean)
603
604 (defvar bibtex-autokey-transcriptions
605   '(;; language specific characters
606     ("\\\\aa" . "a")                      ; \aa           -> a
607     ("\\\\AA" . "A")                      ; \AA           -> A
608     ("\\\"a\\|\\\\\\\"a\\|\\\\ae" . "ae") ; "a,\"a,\ae    -> ae
609     ("\\\"A\\|\\\\\\\"A\\|\\\\AE" . "Ae") ; "A,\"A,\AE    -> Ae
610     ("\\\\i" . "i")                       ; \i            -> i
611     ("\\\\j" . "j")                       ; \j            -> j
612     ("\\\\l" . "l")                       ; \l            -> l
613     ("\\\\L" . "L")                       ; \L            -> L
614     ("\\\"o\\|\\\\\\\"o\\|\\\\o\\|\\\\oe" . "oe") ; "o,\"o,\o,\oe -> oe
615     ("\\\"O\\|\\\\\\\"O\\|\\\\O\\|\\\\OE" . "Oe") ; "O,\"O,\O,\OE -> Oe
616     ("\\\"s\\|\\\\\\\"s\\|\\\\3" . "ss"; "s,\"s,\3     -> ss
617     ("\\\"u\\|\\\\\\\"u" . "ue")          ; "u,\"u        -> ue
618     ("\\\"U\\|\\\\\\\"U" . "Ue")          ; "U,\"U        -> Ue
619     ;; accents
620     ("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" . "")
621     ;; braces, quotes, concatenation.
622     ("[`'\"{}#]" . "")
623     ;; spaces
624     ("\\\\?[ \t\n]+\\|~" . " "))
625   "Alist of (OLD-REGEXP . NEW-STRING) pairs.
626 Used by the default values of `bibtex-autokey-name-change-strings' and
627 `bibtex-autokey-titleword-change-strings'.  Defaults to translating some
628 language specific characters to their ASCII transcriptions, and
629 removing any character accents.")
630
631 (defcustom bibtex-autokey-name-change-strings
632   bibtex-autokey-transcriptions
633   "Alist of (OLD-REGEXP . NEW-STRING) pairs.
634 Any part of a name matching OLD-REGEXP is replaced by NEW-STRING.
635 Case is significant in OLD-REGEXP.  All regexps are tried in the
636 order in which they appear in the list.
637 See `bibtex-generate-autokey' for details."
638   :group 'bibtex-autokey
639   :type '(repeat (cons (regexp :tag "Old")
640                        (string :tag "New"))))
641