Mercurial > emacs
comparison lisp/textmodes/bibtex.el @ 19461:6b67f20dd710
Many doc fixes.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 22 Aug 1997 02:23:24 +0000 |
parents | f15d80b084d8 |
children | 19215d7e44ee |
comparison
equal
deleted
inserted
replaced
19460:f15d80b084d8 | 19461:6b67f20dd710 |
---|---|
31 | 31 |
32 ;; Major mode for editing and validating BibTeX files. | 32 ;; Major mode for editing and validating BibTeX files. |
33 | 33 |
34 ;; Usage: | 34 ;; Usage: |
35 ;; See documentation for function bibtex-mode (or type "\M-x describe-mode" | 35 ;; See documentation for function bibtex-mode (or type "\M-x describe-mode" |
36 ;; when you are in bibtex-mode). | 36 ;; when you are in BibTeX mode). |
37 | 37 |
38 ;; Todo: | 38 ;; Todo: |
39 ;; Distribute texinfo file. | 39 ;; Distribute texinfo file. |
40 | 40 |
41 ;;; Code: | 41 ;;; Code: |
60 :group 'bibtex | 60 :group 'bibtex |
61 :type '(repeat function)) | 61 :type '(repeat function)) |
62 | 62 |
63 (defcustom bibtex-field-delimiters 'braces | 63 (defcustom bibtex-field-delimiters 'braces |
64 "*Controls type of field delimiters used. | 64 "*Controls type of field delimiters used. |
65 Set this to 'braces or 'double-quotes according to your personal | 65 Set this to `braces' or `double-quotes' according to your personal |
66 preferences. This variable is buffer local." | 66 preferences. This variable is buffer-local." |
67 :group 'bibtex | 67 :group 'bibtex |
68 :type '(choice (const braces) | 68 :type '(choice (const braces) |
69 (const double-quotes))) | 69 (const double-quotes))) |
70 (make-variable-buffer-local 'bibtex-field-delimiters) | 70 (make-variable-buffer-local 'bibtex-field-delimiters) |
71 | 71 |
72 (defcustom bibtex-entry-delimiters 'braces | 72 (defcustom bibtex-entry-delimiters 'braces |
73 "*Controls type of entry delimiters used. | 73 "*Controls type of entry delimiters used. |
74 Set this to 'braces or 'parentheses according to your personal | 74 Set this to `braces' or `parentheses' according to your personal |
75 preferences. This variable is buffer local." | 75 preferences. This variable is buffer-local." |
76 :group 'bibtex | 76 :group 'bibtex |
77 :type '(choice (const braces) | 77 :type '(choice (const braces) |
78 (const parentheses))) | 78 (const parentheses))) |
79 (make-variable-buffer-local 'bibtex-entry-delimiters) | 79 (make-variable-buffer-local 'bibtex-entry-delimiters) |
80 | 80 |
95 | 95 |
96 (defcustom bibtex-user-optional-fields | 96 (defcustom bibtex-user-optional-fields |
97 '(("annote" "Personal annotation (ignored)")) | 97 '(("annote" "Personal annotation (ignored)")) |
98 "*List of optional fields the user wants to have always present. | 98 "*List of optional fields the user wants to have always present. |
99 Entries should be of the same form as the OPTIONAL and | 99 Entries should be of the same form as the OPTIONAL and |
100 CROSSREF-OPTIONAL lists in bibtex-entry-field-alist (see documentation | 100 CROSSREF-OPTIONAL lists in `bibtex-entry-field-alist' (see documentation |
101 of this variable for details)." | 101 of this variable for details)." |
102 :group 'bibtex | 102 :group 'bibtex |
103 :type '(repeat | 103 :type '(repeat |
104 (repeat string))) | 104 (repeat string))) |
105 | 105 |
106 (defcustom bibtex-entry-format '(opts-or-alts numerical-fields) | 106 (defcustom bibtex-entry-format '(opts-or-alts numerical-fields) |
107 "*Controls type of formatting performed by bibtex-clean-entry. | 107 "*Controls type of formatting performed by `bibtex-clean-entry'. |
108 It may be t, nil, or a list of symbols out of the following: | 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 | 109 opts-or-alts Delete empty optional and alternative fields and |
110 remove OPT and ALT prefixes from used fields) | 110 remove OPT and ALT prefixes from used fields. |
111 'numerical-fields (delete delimiters around numeral fields) | 111 numerical-fields Delete delimiters around numeral fields. |
112 'page-dashes (change double dashes in page field to single dash | 112 page-dashes Change double dashes in page field to single dash |
113 (for scribe compatibility)) | 113 (for scribe compatibility). |
114 'inherit-booktitle (if entry contains a crossref field and booktitle | 114 inherit-booktitle If entry contains a crossref field and booktitle |
115 field is empty, it is set to the contents of the | 115 field is empty, it is set to the contents of the |
116 title field of the crossreferenced entry | 116 title field of the crossreferenced entry. |
117 (caution: this will work only if buffer is | 117 Caution: this will work only if buffer is |
118 correctly sorted)) | 118 correctly sorted. |
119 'realign (realign entries, so that field texts and perhaps equal | 119 realign Realign entries, so that field texts and perhaps equal |
120 signs (depending on the value of | 120 signs (depending on the value of |
121 bibtex-align-at-equal-sign) begin in the same column) | 121 bibtex-align-at-equal-sign) begin in the same column. |
122 'last-comma (add or delete comma on end of last field in entry, | 122 last-comma Add or delete comma on end of last field in entry, |
123 depending on the value of bibtex-comma-after-last-field) | 123 according to value of `bibtex-comma-after-last-field'. |
124 'delimiters (change delimiters according to variables | 124 delimiters Change delimiters according to variables |
125 bibtex-field-delimiters and bibtex-entry-delimiters) | 125 `bibtex-field-delimiters' and `bibtex-entry-delimiters'. |
126 'unify-case (change case of entry and field names) | 126 unify-case Change case of entry and field names. |
127 Value t means do all of the above formatting actions, | 127 |
128 value nil means do no formatting at all." | 128 The value t means do all of the above formatting actions. |
129 The value nil means do no formatting at all." | |
129 :group 'bibtex | 130 :group 'bibtex |
130 :type '(choice (const :tag "None" nil) | 131 :type '(choice (const :tag "None" nil) |
131 (const :tag "All" t) | 132 (const :tag "All" t) |
132 (repeat symbol))) | 133 (repeat symbol))) |
133 | 134 |
134 (defcustom bibtex-clean-entry-hook nil | 135 (defcustom bibtex-clean-entry-hook nil |
135 "*List of functions to call when entry has been cleaned. | 136 "*List of functions to call when entry has been cleaned. |
136 Functions are called with point inside the cleaned entry, buffer is | 137 Functions are called with point inside the cleaned entry, and the buffer |
137 narrowed to just the entry." | 138 narrowed to just the entry." |
138 :group 'bibtex | 139 :group 'bibtex |
139 :type '(repeat function)) | 140 :type '(repeat function)) |
140 | 141 |
141 (defcustom bibtex-sort-ignore-string-entries t | 142 (defcustom bibtex-sort-ignore-string-entries t |
142 "*If non-nil, BibTeX @String entries are not sort-significant. | 143 "*If non-nil, BibTeX @String entries are not sort-significant. |
143 That means they are ignored when determining ordering of the buffer | 144 That means they are ignored when determining ordering of the buffer |
144 (e.g. sorting, locating alphabetical position for new entries, etc.). | 145 (e.g. sorting, locating alphabetical position for new entries, etc.). |
145 This variable is buffer local." | 146 This variable is buffer-local." |
146 :group 'bibtex | 147 :group 'bibtex |
147 :type 'boolean) | 148 :type 'boolean) |
148 (make-variable-buffer-local 'bibtex-sort-ignore-string-entries) | 149 (make-variable-buffer-local 'bibtex-sort-ignore-string-entries) |
149 | 150 |
150 (defcustom bibtex-maintain-sorted-entries nil | 151 (defcustom bibtex-maintain-sorted-entries nil |
151 "*If non-nil, bibtex-mode maintains all BibTeX entries in sorted order. | 152 "*If non-nil, BibTeX mode maintains all BibTeX entries in sorted order. |
152 Setting this variable to nil will strip off some comfort (e.g. TAB | 153 Setting this variable to nil will strip off some comfort (e.g. TAB |
153 completion for reference keys in minibuffer, automatic detection of | 154 completion for reference keys in minibuffer, automatic detection of |
154 duplicates) from bibtex-mode. See also bibtex-sort-ignore-string-entries. | 155 duplicates) from BibTeX mode. See also `bibtex-sort-ignore-string-entries'. |
155 This variable is buffer local." | 156 This variable is buffer-local." |
156 :group 'bibtex | 157 :group 'bibtex |
157 :type 'boolean) | 158 :type 'boolean) |
158 (make-variable-buffer-local 'bibtex-maintain-sorted-entries) | 159 (make-variable-buffer-local 'bibtex-maintain-sorted-entries) |
159 | 160 |
160 (defcustom bibtex-field-kill-ring-max 20 | 161 (defcustom bibtex-field-kill-ring-max 20 |
161 "*Maximum length of bibtex-field-kill-ring before oldest elements are deleted." | 162 "*Max length of `bibtex-field-kill-ring' before discarding oldest elements." |
162 :group 'bibtex | 163 :group 'bibtex |
163 :type 'integer) | 164 :type 'integer) |
164 | 165 |
165 (defcustom bibtex-entry-kill-ring-max 20 | 166 (defcustom bibtex-entry-kill-ring-max 20 |
166 "*Maximum length of bibtex-entry-kill-ring before oldest elements are deleted." | 167 "*Max length of `bibtex-entry-kill-ring' before discarding oldest elements." |
167 :group 'bibtex | 168 :group 'bibtex |
168 :type 'integer) | 169 :type 'integer) |
169 | 170 |
170 (defcustom bibtex-parse-keys-timeout 60 | 171 (defcustom bibtex-parse-keys-timeout 60 |
171 "*Specifies interval for parsing buffers. | 172 "*Specifies interval for parsing buffers. |
172 All BibTeX buffers in emacs are parsed if emacs has been idle | 173 All BibTeX buffers in emacs are parsed if emacs has been idle |
173 `bibtex-parse-keys-timeout' seconds. Only buffers which were modified | 174 `bibtex-parse-keys-timeout' seconds. Only buffers which were modified |
174 after last parsing and which are maintained in sorted order are parsed." | 175 after last parsing and which are maintained in sorted order are parsed." |
175 :group 'bibtex | 176 :group 'bibtex |
176 :type 'integer) | 177 :type 'integer) |
177 | 178 |
178 (defvar bibtex-entry-field-alist | 179 (defvar bibtex-entry-field-alist |
387 COMMENT-STRING, INIT, and ALTERNATIVE-FLAG are optional. | 388 COMMENT-STRING, INIT, and ALTERNATIVE-FLAG are optional. |
388 FIELD-NAME is the name of the field, COMMENT-STRING the comment to | 389 FIELD-NAME is the name of the field, COMMENT-STRING the comment to |
389 appear in the echo area, INIT is either the initial content of the | 390 appear in the echo area, INIT is either the initial content of the |
390 field or a function, which is called to determine the initial content | 391 field or a function, which is called to determine the initial content |
391 of the field, and ALTERNATIVE-FLAG (either nil or t) marks if the | 392 of the field, and ALTERNATIVE-FLAG (either nil or t) marks if the |
392 field is an alternative. ALTERNATIVE-FLAG may be t only in the | 393 field is an alternative. ALTERNATIVE-FLAG may be t only in the |
393 REQUIRED or CROSSREF-REQUIRED lists.") | 394 REQUIRED or CROSSREF-REQUIRED lists.") |
394 | 395 |
395 (defcustom bibtex-add-entry-hook nil | 396 (defcustom bibtex-add-entry-hook nil |
396 "List of functions to call when entry has been inserted." | 397 "List of functions to call when entry has been inserted." |
397 :group 'bibtex | 398 :group 'bibtex |
417 ("ieeetc") ("ieeetcad") ("ipl") ("jacm") ("jcss") ("scp") | 418 ("ieeetc") ("ieeetcad") ("ipl") ("jacm") ("jcss") ("scp") |
418 ("sicomp") ("tcs") ("tocs") ("tods") ("tog") ("toms") ("toois") | 419 ("sicomp") ("tcs") ("tocs") ("tods") ("tog") ("toms") ("toois") |
419 ("toplas") | 420 ("toplas") |
420 )) | 421 )) |
421 "Alist of string definitions. | 422 "Alist of string definitions. |
422 Should contain the strings defined in the BibTeX style files. Each | 423 Should contain the strings defined in the BibTeX style files. Each |
423 element is a list with just one element: the string." | 424 element is a list with just one element: the string." |
424 :group 'bibtex | 425 :group 'bibtex |
425 :type '(repeat | 426 :type '(repeat |
426 (list string))) | 427 (list string))) |
427 | 428 |
428 (defcustom bibtex-string-files nil | 429 (defcustom bibtex-string-files nil |
429 "*List of BibTeX files containing string definitions. | 430 "*List of BibTeX files containing string definitions. |
430 Those files must be specified using pathnames relative to the | 431 Those files must be specified using pathnames relative to the |
431 directories specified in bibtex-string-file-path. This variable is only | 432 directories specified in `bibtex-string-file-path'. This variable is only |
432 evaluated when bibtex-mode is entered (i. e. when loading the BibTeX | 433 evaluated when BibTeX mode is entered (i. e. when loading the BibTeX |
433 file)." | 434 file)." |
434 :group 'bibtex | 435 :group 'bibtex |
435 :type '(repeat file)) | 436 :type '(repeat file)) |
436 | 437 |
437 (defvar bibtex-string-file-path (getenv "BIBINPUTS") | 438 (defvar bibtex-string-file-path (getenv "BIBINPUTS") |
438 "*Colon separated list of pathes to search for bibtex-string-files.") | 439 "*Colon separated list of pathes to search for `bibtex-string-files'.") |
439 | 440 |
440 (defcustom bibtex-help-message t | 441 (defcustom bibtex-help-message t |
441 "*If not nil print help messages in the echo area on entering a new field." | 442 "*If not nil print help messages in the echo area on entering a new field." |
442 :group 'bibtex | 443 :group 'bibtex |
443 :type 'boolean) | 444 :type 'boolean) |
444 | 445 |
445 (defcustom bibtex-autokey-prefix-string "" | 446 (defcustom bibtex-autokey-prefix-string "" |
446 "*String to use as a prefix for all generated keys. | 447 "*String to use as a prefix for all generated keys. |
447 See the documentation of function bibtex-generate-autokey for further detail." | 448 See the documentation of function `bibtex-generate-autokey' for more detail." |
448 :group 'bibtex-autokey | 449 :group 'bibtex-autokey |
449 :type 'string) | 450 :type 'string) |
450 | 451 |
451 (defcustom bibtex-autokey-names 1 | 452 (defcustom bibtex-autokey-names 1 |
452 "*Number of names to use for the automatically generated reference key. | 453 "*Number of names to use for the automatically generated reference key. |
453 If this is set to anything but a number, all names are used. | 454 If this is set to anything but a number, all names are used. |
454 Possibly more names are used according to bibtex-autokey-names-stretch. | 455 Possibly more names are used according to `bibtex-autokey-names-stretch'. |
455 See the documentation of function bibtex-generate-autokey for further detail." | 456 See the documentation of function `bibtex-generate-autokey' for more detail." |
456 :group 'bibtex-autokey | 457 :group 'bibtex-autokey |
457 :type 'integer) | 458 :type 'integer) |
458 | 459 |
459 (defcustom bibtex-autokey-names-stretch 0 | 460 (defcustom bibtex-autokey-names-stretch 0 |
460 "*Number of names that can additionally be used. | 461 "*Number of names that can additionally be used. |
461 These names are used only, if all names are used then. | 462 These names are used only, if all names are used then. |
462 See the documentation of function bibtex-generate-autokey for details." | 463 See the documentation of function `bibtex-generate-autokey' for details." |
463 :group 'bibtex-autokey | 464 :group 'bibtex-autokey |
464 :type 'integer) | 465 :type 'integer) |
465 | 466 |
466 (defcustom bibtex-autokey-additional-names "" | 467 (defcustom bibtex-autokey-additional-names "" |
467 "*String to prepend to the generated key if not all names could be used. | 468 "*String to prepend to the generated key if not all names could be used. |
468 See the documentation of function bibtex-generate-autokey for details." | 469 See the documentation of function `bibtex-generate-autokey' for details." |
469 :group 'bibtex-autokey | 470 :group 'bibtex-autokey |
470 :type 'string) | 471 :type 'string) |
471 | 472 |
472 (defvar bibtex-autokey-transcriptions | 473 (defvar bibtex-autokey-transcriptions |
473 '( | 474 '( |
488 ;; accents | 489 ;; accents |
489 ("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" "") | 490 ("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" "") |
490 ;; braces | 491 ;; braces |
491 ("{" "") ("}" "")) | 492 ("{" "") ("}" "")) |
492 "Alist of (old-regexp new-string) pairs. | 493 "Alist of (old-regexp new-string) pairs. |
493 Used by the default values of bibtex-autokey-name-change-strings and | 494 Used by the default values of `bibtex-autokey-name-change-strings' and |
494 bibtex-autokey-titleword-change-strings. Defaults to translating some | 495 `bibtex-autokey-titleword-change-strings'. Defaults to translating some |
495 language specific characters to their ascii transcriptions and | 496 language specific characters to their ASCII transcriptions, and |
496 removing any character accents.") | 497 removing any character accents.") |
497 | 498 |
498 (defcustom bibtex-autokey-name-change-strings | 499 (defcustom bibtex-autokey-name-change-strings |
499 bibtex-autokey-transcriptions | 500 bibtex-autokey-transcriptions |
500 "Alist of (old-regexp new-string) pairs. | 501 "Alist of (OLD-REGEXP NEW-STRING) pairs. |
501 Any part of name matching a old-regexp is replaced by new-string. | 502 Any part of name matching a OLD-REGEXP is replaced by NEW-STRING. |
502 Case of the old-regexp is significant. All regexps are tried in the | 503 Case is significant in OLD-REGEXP. All regexps are tried in the |
503 order in which they appear in the list, so be sure to avoid inifinite | 504 order in which they appear in the list, so be sure to avoid inifinite |
504 loops here. | 505 loops here. |
505 See the documentation of function bibtex-generate-autokey for details." | 506 See the documentation of function `bibtex-generate-autokey' for details." |
506 :group 'bibtex-autokey | 507 :group 'bibtex-autokey |
507 :type '(repeat | 508 :type '(repeat |
508 (list (regexp :tag "Old") | 509 (list (regexp :tag "Old") |
509 (string :tag "New")))) | 510 (string :tag "New")))) |
510 | 511 |
511 (defcustom bibtex-autokey-name-length 'infty | 512 (defcustom bibtex-autokey-name-length 'infty |
512 "*Number of characters from name to incorporate into key. | 513 "*Number of characters from name to incorporate into key. |
513 If this is set to anything but a number, all characters are used. | 514 If this is set to anything but a number, all characters are used. |
514 See the documentation of function bibtex-generate-autokey for details." | 515 See the documentation of function `bibtex-generate-autokey' for details." |
515 :group 'bibtex-autokey | 516 :group 'bibtex-autokey |
516 :type '(choice (const :tag "All" infty) | 517 :type '(choice (const :tag "All" infty) |
517 integer)) | 518 integer)) |
518 | 519 |
519 (defcustom bibtex-autokey-name-separator "" | 520 (defcustom bibtex-autokey-name-separator "" |
520 "*String that comes between any two names in the key. | 521 "*String that comes between any two names in the key. |
521 See the documentation of function bibtex-generate-autokey for details." | 522 See the documentation of function `bibtex-generate-autokey' for details." |
522 :group 'bibtex-autokey | 523 :group 'bibtex-autokey |
523 :type 'string) | 524 :type 'string) |
524 | 525 |
525 (defcustom bibtex-autokey-year-length 2 | 526 (defcustom bibtex-autokey-year-length 2 |
526 "*Number of rightmost digits from the year field yo incorporate into key. | 527 "*Number of rightmost digits from the year field yo incorporate into key. |
527 See the documentation of function bibtex-generate-autokey for details." | 528 See the documentation of function `bibtex-generate-autokey' for details." |
528 :group 'bibtex-autokey | 529 :group 'bibtex-autokey |
529 :type 'integer) | 530 :type 'integer) |
530 | 531 |
531 (defcustom bibtex-autokey-year-use-crossref-entry t | 532 (defcustom bibtex-autokey-year-use-crossref-entry t |
532 "*If non-nil use year field from crossreferenced entry if necessary. | 533 "*If non-nil use year field from crossreferenced entry if necessary. |
533 If this variable is non-nil and the current entry has no year, but a | 534 If this variable is non-nil and the current entry has no year, but a |
534 valid crossref entry, the year field from the crossreferenced entry is | 535 valid crossref entry, the year field from the crossreferenced entry is |
535 used. | 536 used. |
536 See the documentation of function bibtex-generate-autokey for details." | 537 See the documentation of function `bibtex-generate-autokey' for details." |
537 :group 'bibtex-autokey | 538 :group 'bibtex-autokey |
538 :type 'boolean) | 539 :type 'boolean) |
539 | 540 |
540 (defcustom bibtex-autokey-titlewords 5 | 541 (defcustom bibtex-autokey-titlewords 5 |
541 "*Number of title words to use for the automatically generated reference key. | 542 "*Number of title words to use for the automatically generated reference key. |
542 If this is set to anything but a number, all title words are used. | 543 If this is set to anything but a number, all title words are used. |
543 Possibly more words from the title are used according to | 544 Possibly more words from the title are used according to |
544 bibtex-autokey-titlewords-stretch. | 545 `bibtex-autokey-titlewords-stretch'. |
545 See the documentation of function bibtex-generate-autokey for details." | 546 See the documentation of function `bibtex-generate-autokey' for details." |
546 :group 'bibtex-autokey | 547 :group 'bibtex-autokey |
547 :type '(choice (const :tag "All" infty) | 548 :type '(choice (const :tag "All" infty) |
548 integer)) | 549 integer)) |
549 | 550 |
550 (defcustom bibtex-autokey-title-terminators | 551 (defcustom bibtex-autokey-title-terminators |
551 '("\\." "!" "\\?" ":" ";" "--") | 552 '("\\." "!" "\\?" ":" ";" "--") |
552 "*Regexp list defining the termination of the main part of the title. | 553 "*Regexp list defining the termination of the main part of the title. |
553 Case of the regexps is ignored. | 554 Case of the regexps is ignored. |
554 See the documentation of function bibtex-generate-autokey for details." | 555 See the documentation of function `bibtex-generate-autokey' for details." |
555 :group 'bibtex-autokey | 556 :group 'bibtex-autokey |
556 :type '(repeat regexp)) | 557 :type '(repeat regexp)) |
557 | 558 |
558 (defcustom bibtex-autokey-titlewords-stretch 2 | 559 (defcustom bibtex-autokey-titlewords-stretch 2 |
559 "*Number of words that can additionally be used from the title. | 560 "*Number of words that can additionally be used from the title. |
560 These words are used only, if a sentence from the title can be ended then. | 561 These words are used only, if a sentence from the title can be ended then. |
561 See the documentation of function bibtex-generate-autokey for details." | 562 See the documentation of function `bibtex-generate-autokey' for details." |
562 :group 'bibtex-autokey | 563 :group 'bibtex-autokey |
563 :type 'integer) | 564 :type 'integer) |
564 | 565 |
565 (defcustom bibtex-autokey-titleword-first-ignore | 566 (defcustom bibtex-autokey-titleword-first-ignore |
566 '("a" "an" "on" "the" "eine?" "der" "die" "das") | 567 '("a" "an" "on" "the" "eine?" "der" "die" "das") |
567 "*Determines words that may begin a title but are not to be used in the key. | 568 "*Determines words that may begin a title but are not to be used in the key. |
568 Each item of the list is a regexp. If the first word of the title matchs a | 569 Each item of the list is a regexp. If the first word of the title matchs a |
569 regexp from that list, it is not included in the title, even if it is | 570 regexp from that list, it is not included in the title, even if it is |
570 capitalized. Case of regexps in this list doesn't matter. | 571 capitalized. Case of regexps in this list doesn't matter. |
571 See the documentation of function bibtex-generate-autokey for details." | 572 See the documentation of function `bibtex-generate-autokey' for details." |
572 :group 'bibtex-autokey | 573 :group 'bibtex-autokey |
573 :type '(repeat regexp)) | 574 :type '(repeat regexp)) |
574 | 575 |
575 (defcustom bibtex-autokey-titleword-abbrevs nil | 576 (defcustom bibtex-autokey-titleword-abbrevs nil |
576 "*Determines exceptions to the usual abbreviation mechanism. | 577 "*Determines exceptions to the usual abbreviation mechanism. |
577 An alist of (old-regexp new-string) pairs. Case of old-regexp ignored. | 578 An alist of (OLD-REGEXP NEW-STRING) pairs. Case is ignored |
578 The first matching pair is used. | 579 in matching against OLD-REGEXP, and the first matching pair is used. |
579 See the documentation of function bibtex-generate-autokey for details.") | 580 See the documentation of function `bibtex-generate-autokey' for details.") |
580 | 581 |
581 (defcustom bibtex-autokey-titleword-change-strings | 582 (defcustom bibtex-autokey-titleword-change-strings |
582 bibtex-autokey-transcriptions | 583 bibtex-autokey-transcriptions |
583 "Alist of (old-regexp new-string) pairs. | 584 "Alist of (OLD-REGEXP NEW-STRING) pairs. |
584 Any part of title word matching a old-regexp is replaced by new-string. | 585 Any part of title word matching a OLD-REGEXP is replaced by NEW-STRING. |
585 Case of the old-regexp is significant. All regexps are tried in the | 586 Case is significant in OLD-REGEXP. All regexps are tried in the |
586 order in which they appear in the list, so be sure to avoid inifinite | 587 order in which they appear in the list, so be sure to avoid inifinite |
587 loops here. | 588 loops here. |
588 See the documentation of function bibtex-generate-autokey for details." | 589 See the documentation of function `bibtex-generate-autokey' for details." |
589 :group 'bibtex-autokey | 590 :group 'bibtex-autokey |
590 :type '(repeat | 591 :type '(repeat |
591 (list (regexp :tag "Old") | 592 (list (regexp :tag "Old") |
592 (string :tag "New")))) | 593 (string :tag "New")))) |
593 | 594 |
594 (defcustom bibtex-autokey-titleword-length 5 | 595 (defcustom bibtex-autokey-titleword-length 5 |
595 "*Number of characters from title words to incorporate into key. | 596 "*Number of characters from title words to incorporate into key. |
596 If this is set to anything but a number, all characters are used. | 597 If this is set to anything but a number, all characters are used. |
597 See the documentation of function bibtex-generate-autokey for details." | 598 See the documentation of function `bibtex-generate-autokey' for details." |
598 :group 'bibtex-autokey | 599 :group 'bibtex-autokey |
599 :type '(choice (const :tag "All" infty) | 600 :type '(choice (const :tag "All" infty) |
600 integer)) | 601 integer)) |
601 | 602 |
602 (defcustom bibtex-autokey-titleword-separator "_" | 603 (defcustom bibtex-autokey-titleword-separator "_" |
603 "*String to be put between the title words. | 604 "*String to be put between the title words. |
604 See the documentation of function bibtex-generate-autokey for details." | 605 See the documentation of function `bibtex-generate-autokey' for details." |
605 :group 'bibtex-autokey | 606 :group 'bibtex-autokey |
606 :type 'string) | 607 :type 'string) |
607 | 608 |
608 (defcustom bibtex-autokey-name-year-separator "" | 609 (defcustom bibtex-autokey-name-year-separator "" |
609 "*String to be put between name part and year part of key. | 610 "*String to be put between name part and year part of key. |
610 See the documentation of function bibtex-generate-autokey for details." | 611 See the documentation of function `bibtex-generate-autokey' for details." |
611 :group 'bibtex-autokey | 612 :group 'bibtex-autokey |
612 :type 'string) | 613 :type 'string) |
613 | 614 |
614 (defcustom bibtex-autokey-year-title-separator ":_" | 615 (defcustom bibtex-autokey-year-title-separator ":_" |
615 "*String to be put between name part and year part of key. | 616 "*String to be put between name part and year part of key. |
616 See the documentation of function bibtex-generate-autokey for details." | 617 See the documentation of function `bibtex-generate-autokey' for details." |
617 :group 'bibtex-autokey | 618 :group 'bibtex-autokey |
618 :type 'string) | 619 :type 'string) |
619 | 620 |
620 (defcustom bibtex-autokey-preserve-case nil | 621 (defcustom bibtex-autokey-preserve-case nil |
621 "*If non-nil, names and titlewords used aren't converted to lowercase. | 622 "*If non-nil, names and titlewords used aren't converted to lower case. |
622 See the documentation of function bibtex-generate-autokey for details." | 623 See the documentation of function `bibtex-generate-autokey' for details." |
623 :group 'bibtex-autokey | 624 :group 'bibtex-autokey |
624 :type 'boolean) | 625 :type 'boolean) |
625 | 626 |
626 (defcustom bibtex-autokey-edit-before-use t | 627 (defcustom bibtex-autokey-edit-before-use t |
627 "*If non-nil, user is allowed to edit the generated key before it is used." | 628 "*If non-nil, user is allowed to edit the generated key before it is used." |
664 :group 'bibtex | 665 :group 'bibtex |
665 :type 'integer) | 666 :type 'integer) |
666 | 667 |
667 (defcustom bibtex-align-at-equal-sign nil | 668 (defcustom bibtex-align-at-equal-sign nil |
668 "*If non-nil, align fields at equal sign instead of field text. | 669 "*If non-nil, align fields at equal sign instead of field text. |
669 If non nil, column of equal sign is bibtex-text-indentation - 2." | 670 If non-nil, the column for the equal sign is |
671 the value of `bibtex-text-indentation', minus 2." | |
670 :group 'bibtex | 672 :group 'bibtex |
671 :type 'boolean) | 673 :type 'boolean) |
672 | 674 |
673 (defcustom bibtex-comma-after-last-field nil | 675 (defcustom bibtex-comma-after-last-field nil |
674 "*If non-nil, a comma is put at end of last field in the entry template." | 676 "*If non-nil, a comma is put at end of last field in the entry template." |
2345 ;;;###autoload | 2347 ;;;###autoload |
2346 (defun bibtex-mode () | 2348 (defun bibtex-mode () |
2347 "Major mode for editing BibTeX files. | 2349 "Major mode for editing BibTeX files. |
2348 | 2350 |
2349 To submit a problem report, enter \\[bibtex-submit-bug-report] from a | 2351 To submit a problem report, enter \\[bibtex-submit-bug-report] from a |
2350 bibtex-mode buffer. This automatically sets up a mail buffer with | 2352 BibTeX mode buffer. This automatically sets up a mail buffer with |
2351 version information already added. You just need to add a description | 2353 version information already added. You just need to add a description |
2352 of the problem, including a reproducable test case and send the | 2354 of the problem, including a reproducable test case and send the |
2353 message. | 2355 message. |
2354 | 2356 |
2355 | 2357 |
2436 bibtex-entry-field-alist | 2438 bibtex-entry-field-alist |
2437 bibtex-predefined-strings | 2439 bibtex-predefined-strings |
2438 bibtex-string-files | 2440 bibtex-string-files |
2439 | 2441 |
2440 --------------------------------------------------------- | 2442 --------------------------------------------------------- |
2441 Entry to BibTeX mode calls the value of bibtex-mode-hook if that value is | 2443 Entry to BibTeX mode calls the value of `bibtex-mode-hook' if that value is |
2442 non-nil. | 2444 non-nil. |
2443 | 2445 |
2444 \\{bibtex-mode-map} | 2446 \\{bibtex-mode-map} |
2445 " | 2447 " |
2446 (interactive) | 2448 (interactive) |
2629 behaviour, I did the following:"))) | 2631 behaviour, I did the following:"))) |
2630 (message nil)))) | 2632 (message nil)))) |
2631 | 2633 |
2632 (defun bibtex-entry (entry-type) | 2634 (defun bibtex-entry (entry-type) |
2633 "Inserts a new BibTeX entry. | 2635 "Inserts a new BibTeX entry. |
2634 After insertion it calls the functions in bibtex-add-entry-hook." | 2636 After insertion it calls the functions in `bibtex-add-entry-hook'." |
2635 (interactive (let* ((completion-ignore-case t) | 2637 (interactive (let* ((completion-ignore-case t) |
2636 (e-t (completing-read | 2638 (e-t (completing-read |
2637 "Entry Type: " | 2639 "Entry Type: " |
2638 bibtex-entry-field-alist | 2640 bibtex-entry-field-alist |
2639 nil t nil 'bibtex-entry-type-history))) | 2641 nil t nil 'bibtex-entry-type-history))) |
2813 | 2815 |
2814 (defun bibtex-beginning-of-entry () | 2816 (defun bibtex-beginning-of-entry () |
2815 "Move to beginning of BibTeX entry. | 2817 "Move to beginning of BibTeX entry. |
2816 If inside an entry, move to the beginning of it, otherwise move to the | 2818 If inside an entry, move to the beginning of it, otherwise move to the |
2817 beginning of the previous entry. | 2819 beginning of the previous entry. |
2818 If called from a program returns point." | 2820 If called from a program, this function returns the new location of point." |
2819 (interactive) | 2821 (interactive) |
2820 (skip-chars-forward " \t") | 2822 (skip-chars-forward " \t") |
2821 (if (looking-at "@") | 2823 (if (looking-at "@") |
2822 (forward-char)) | 2824 (forward-char)) |
2823 (re-search-backward "^[ \t]*@" nil 'move)) | 2825 (re-search-backward "^[ \t]*@" nil 'move)) |
2824 | 2826 |
2825 (defun bibtex-end-of-entry () | 2827 (defun bibtex-end-of-entry () |
2826 "Move to end of BibTeX entry. | 2828 "Move to end of BibTeX entry. |
2827 If inside an entry, move to the end of it, otherwise move to the end | 2829 If inside an entry, move to the end of it, otherwise move to the end |
2828 of the previous entry. | 2830 of the previous entry. |
2829 If called from a program returns point." | 2831 If called from a program, this function returns the new location of point." |
2830 (interactive) | 2832 (interactive) |
2831 (let ((case-fold-search t) | 2833 (let ((case-fold-search t) |
2832 (valid-entry-head | 2834 (valid-entry-head |
2833 (concat "[ \t]*@[ \t]*\\(" | 2835 (concat "[ \t]*@[ \t]*\\(" |
2834 (mapconcat | 2836 (mapconcat |
2962 (forward-line 1))) | 2964 (forward-line 1))) |
2963 (setq selective-display (not arg))))) | 2965 (setq selective-display (not arg))))) |
2964 | 2966 |
2965 (defun bibtex-sort-buffer () | 2967 (defun bibtex-sort-buffer () |
2966 "Sort BibTeX buffer alphabetically by key. | 2968 "Sort BibTeX buffer alphabetically by key. |
2967 Text outside of BibTeX entries is not affected. If | 2969 Text outside of BibTeX entries is not affected. If |
2968 bibtex-sort-ignore-string-entries is non-nil, @String entries will be | 2970 `bibtex-sort-ignore-string-entries' is non-nil, @String entries will be |
2969 ignored." | 2971 ignored." |
2970 (interactive) | 2972 (interactive) |
2971 (save-restriction | 2973 (save-restriction |
2972 (narrow-to-region | 2974 (narrow-to-region |
2973 (bibtex-beginning-of-first-entry) | 2975 (bibtex-beginning-of-first-entry) |
2995 order, without duplicates (see \\[bibtex-validate]), if it is | 2997 order, without duplicates (see \\[bibtex-validate]), if it is |
2996 not, bibtex-find-entry-location will fail). If entry-name is already | 2998 not, bibtex-find-entry-location will fail). If entry-name is already |
2997 used as a reference key, an error is signaled. However, if optional | 2999 used as a reference key, an error is signaled. However, if optional |
2998 variable IGNORE-DUPS is non-nil, no error messages about duplicate | 3000 variable IGNORE-DUPS is non-nil, no error messages about duplicate |
2999 entries are signaled, but the error handling is assumed to be made in | 3001 entries are signaled, but the error handling is assumed to be made in |
3000 the calling function. Nil is returned, if an duplicate entry error | 3002 the calling function. |
3001 occurred, and t in all other cases." | 3003 The value is nil if an duplicate entry error occurred, |
3004 and t in all other cases." | |
3002 (let* ((case-fold-search t) | 3005 (let* ((case-fold-search t) |
3003 (left | 3006 (left |
3004 (progn | 3007 (progn |
3005 (bibtex-beginning-of-first-entry) | 3008 (bibtex-beginning-of-first-entry) |
3006 (bibtex-skip-to-valid-entry) | 3009 (bibtex-skip-to-valid-entry) |
3372 (if (looking-at "[}\"]") | 3375 (if (looking-at "[}\"]") |
3373 (delete-char 1)))))))) | 3376 (delete-char 1)))))))) |
3374 | 3377 |
3375 (defun bibtex-kill-field (&optional copy-only) | 3378 (defun bibtex-kill-field (&optional copy-only) |
3376 "Kills the entire enclosing BibTeX field. | 3379 "Kills the entire enclosing BibTeX field. |
3377 With prefix arg copy the current field to bibtex-field-kill-ring, but | 3380 With prefix arg, copy the current field to `bibtex-field-kill-ring,' |
3378 do not actually kill it." | 3381 but do not actually kill it." |
3379 (interactive "P") | 3382 (interactive "P") |
3380 (let ((pnt (point)) | 3383 (let ((pnt (point)) |
3381 (case-fold-search t)) | 3384 (case-fold-search t)) |
3382 (bibtex-inside-field) | 3385 (bibtex-inside-field) |
3383 (bibtex-enclosing-field) | 3386 (bibtex-enclosing-field) |
3412 (defun bibtex-copy-field-as-kill () | 3415 (defun bibtex-copy-field-as-kill () |
3413 (interactive) | 3416 (interactive) |
3414 (bibtex-kill-field t)) | 3417 (bibtex-kill-field t)) |
3415 | 3418 |
3416 (defun bibtex-kill-entry (&optional copy-only) | 3419 (defun bibtex-kill-entry (&optional copy-only) |
3417 "Kills the entire enclosing BibTeX reference entry. | 3420 "Kill the entire enclosing BibTeX reference entry. |
3418 With prefix arg copy the current reference entry to | 3421 With prefix arg copy the current reference entry to |
3419 bibtex-entry-kill-ring, but do not actually kill it." | 3422 `bibtex-entry-kill-ring', but do not actually kill it." |
3420 (interactive "P") | 3423 (interactive "P") |
3421 (let ((pnt (point)) | 3424 (let ((pnt (point)) |
3422 (case-fold-search t) | 3425 (case-fold-search t) |
3423 (beg (bibtex-beginning-of-entry)) | 3426 (beg (bibtex-beginning-of-entry)) |
3424 (end | 3427 (end |
3488 (insert (concat (bibtex-field-left-delimiter) | 3491 (insert (concat (bibtex-field-left-delimiter) |
3489 (bibtex-field-right-delimiter)) ) | 3492 (bibtex-field-right-delimiter)) ) |
3490 (bibtex-find-text t)) | 3493 (bibtex-find-text t)) |
3491 | 3494 |
3492 (defun bibtex-pop-previous (arg) | 3495 (defun bibtex-pop-previous (arg) |
3493 "Replace text of current field with the text of similar field in previous entry. | 3496 "Replace text of current field with the similar field in previous entry. |
3494 With arg, goes up ARG entries. Repeated, goes up so many times. May be | 3497 With arg, goes up ARG entries. Repeated, goes up so many times. May be |
3495 intermixed with \\[bibtex-pop-next] (bibtex-pop-next)." | 3498 intermixed with \\[bibtex-pop-next] (bibtex-pop-next)." |
3496 (interactive "p") | 3499 (interactive "p") |
3497 (bibtex-pop arg 'previous)) | 3500 (bibtex-pop arg 'previous)) |
3498 | 3501 |
3571 (run-hooks 'bibtex-clean-entry-hook))))) | 3574 (run-hooks 'bibtex-clean-entry-hook))))) |
3572 | 3575 |
3573 (defun bibtex-fill-entry () | 3576 (defun bibtex-fill-entry () |
3574 "Fill current entry. | 3577 "Fill current entry. |
3575 Realigns entry, so that every field starts on a separate line. Field | 3578 Realigns entry, so that every field starts on a separate line. Field |
3576 names appear in column bibtex-field-indentation, field text starts in | 3579 names appear in column `bibtex-field-indentation', field text starts in |
3577 column bibtex-text-indentation and continuation lines start here, too. | 3580 column bibtex-text-indentation and continuation lines start here, too. |
3578 If bibtex-align-at-equal-sign is non-nil, equal signs are aligned as | 3581 If `bibtex-align-at-equal-sign' is non-nil, align equal signs also." |
3579 well." | |
3580 (interactive "*") | 3582 (interactive "*") |
3581 (let ((pnt (copy-marker (point))) | 3583 (let ((pnt (copy-marker (point))) |
3582 (end (copy-marker (bibtex-end-of-entry)))) | 3584 (end (copy-marker (bibtex-end-of-entry)))) |
3583 (bibtex-beginning-of-entry) | 3585 (bibtex-beginning-of-entry) |
3584 (bibtex-delete-whitespace) | 3586 (bibtex-delete-whitespace) |
3621 (forward-char) | 3623 (forward-char) |
3622 (indent-to-column bibtex-entry-offset) | 3624 (indent-to-column bibtex-entry-offset) |
3623 (goto-char pnt))) | 3625 (goto-char pnt))) |
3624 | 3626 |
3625 (defun bibtex-reformat (&optional additional-options called-by-convert-alien) | 3627 (defun bibtex-reformat (&optional additional-options called-by-convert-alien) |
3626 "Reformats entries in buffer or region. | 3628 "Reformat all BibTeX entries in buffer or region. |
3627 Refills all entries. With prefix argument, read options for | 3629 With prefix argument, read options for reformatting from minibuffer. |
3628 reformatting entries from minibuffer. With double prefix argument, | 3630 With C-u C-u prefix argument, reuse previous answers (if any) again. |
3629 reuse previous answers (if any) again. | |
3630 If mark is active it reformats entries in region, if not in whole buffer." | 3631 If mark is active it reformats entries in region, if not in whole buffer." |
3631 (interactive "*P") | 3632 (interactive "*P") |
3632 (let* ((pnt (point)) | 3633 (let* ((pnt (point)) |
3633 (use-previous-options | 3634 (use-previous-options |
3634 (and (equal (prefix-numeric-value additional-options) 16) | 3635 (and (equal (prefix-numeric-value additional-options) 16) |
3730 | 3731 |
3731 (defun bibtex-convert-alien (&optional do-additional-reformatting) | 3732 (defun bibtex-convert-alien (&optional do-additional-reformatting) |
3732 "Converts an alien BibTeX buffer to be fully usable by BibTeX mode. | 3733 "Converts an alien BibTeX buffer to be fully usable by BibTeX mode. |
3733 If a file doesn't confirm with some standards used by BibTeX mode, | 3734 If a file doesn't confirm with some standards used by BibTeX mode, |
3734 some of the high-level features of BibTeX mode won't be available. | 3735 some of the high-level features of BibTeX mode won't be available. |
3735 This function tries to convert current buffer to confirm with these | 3736 This function tries to convert current buffer to confirm with these standards. |
3736 standards. | |
3737 With prefix argument DO-ADDITIONAL-REFORMATTING | 3737 With prefix argument DO-ADDITIONAL-REFORMATTING |
3738 non-nil, read options for reformatting entries from minibuffer." | 3738 non-nil, read options for reformatting entries from minibuffer." |
3739 (interactive "*P") | 3739 (interactive "*P") |
3740 (message "Starting to validate buffer...") | 3740 (message "Starting to validate buffer...") |
3741 (sit-for 1 nil t) | 3741 (sit-for 1 nil t) |