diff options
| author | Roland Winkler | 2025-01-01 23:09:58 -0600 |
|---|---|---|
| committer | Roland Winkler | 2025-01-01 23:09:58 -0600 |
| commit | b26418694e8a573cd500d71029c0e8f53598ea3c (patch) | |
| tree | 185a184c688056956229e9ef23812acafa75e499 | |
| parent | fec6078f62c717edfe6ad5fe87f531ccbbd8e08f (diff) | |
| download | emacs-b26418694e8a573cd500d71029c0e8f53598ea3c.tar.gz emacs-b26418694e8a573cd500d71029c0e8f53598ea3c.zip | |
Provide more flexibility for definition of BibTeX entries.
* lisp/textmodes/bibtex.el (bibtex-aux-opt-alist): Rename from
bibtex-user-optional-fields.
(bibtex-BibTeX-entry-alist, bibtex-biblatex-entry-alist): Permit
aliases that inherit their definition from another entry.
(bibtex-BibTeX-aux-entry-alist, bibtex-biblatex-aux-entry-alist)
(bibtex-BibTeX-aux-opt-alist, bibtex-biblatex-aux-opt-alist): New
user variables.
(bibtex-entry-alist): Honor these new variables.
(bibtex-field-alist): New function.
(bibtex-include-OPTkey): Default changed to nil, declared
obsolete. Use bibtex-aux-opt-alist instead.
(bibtex-set-dialect): Use cl-flet and bibtex-field-alist.
(bibtex-dialect-select-map): New variable.
(bibtex-init-dialect): New function.
(bibtex-field-list): Simplify.
(bibtex-print-help-message): Bug fix.
| -rw-r--r-- | etc/NEWS | 15 | ||||
| -rw-r--r-- | lisp/textmodes/bibtex.el | 795 |
2 files changed, 429 insertions, 381 deletions
| @@ -771,6 +771,21 @@ toggle. | |||
| 771 | ** BibTeX mode | 771 | ** BibTeX mode |
| 772 | 772 | ||
| 773 | --- | 773 | --- |
| 774 | *** New user variables 'bibtex-BibTeX-aux-entry-alist', | ||
| 775 | 'bibtex-biblatex-aux-entry-alist', 'bibtex-BibTeX-aux-opt-alist', | ||
| 776 | and 'bibtex-biblatex-aux-opt-alist' facilitate the customization of | ||
| 777 | BibTeX and biblatex entries. These variables now support the definition | ||
| 778 | of aliases that inherit the definition of another entry. | ||
| 779 | |||
| 780 | --- | ||
| 781 | *** The user variable 'bibtex-user-optional-fields' has been renamed | ||
| 782 | to 'bibtex-aux-opt-alist'. The old name is an obsolete alias. | ||
| 783 | |||
| 784 | --- | ||
| 785 | *** The user variable 'bibtex-include-OPTkey' is now obsolete and | ||
| 786 | its default is nil. Use 'bibtex-aux-opt-alist' instead. | ||
| 787 | |||
| 788 | --- | ||
| 774 | *** New user option 'bibtex-entry-ask-for-key'. | 789 | *** New user option 'bibtex-entry-ask-for-key'. |
| 775 | When enabled, 'bibtex-entry' asks for a key. | 790 | When enabled, 'bibtex-entry' asks for a key. |
| 776 | 791 | ||
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 217a4f8c26d..d2206876dbd 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el | |||
| @@ -75,28 +75,24 @@ | |||
| 75 | :group 'bibtex | 75 | :group 'bibtex |
| 76 | :type '(repeat string)) | 76 | :type '(repeat string)) |
| 77 | 77 | ||
| 78 | (defcustom bibtex-include-OPTkey t | 78 | (defcustom bibtex-include-OPTkey nil |
| 79 | "If non-nil, all newly created entries get an OPTkey field. | 79 | "If non-nil, all newly created entries get an OPTkey field. |
| 80 | If this is a string, use it as the initial field text. | 80 | If this is a string, use it as the initial field text. |
| 81 | If this is a function, call it to generate the initial field text." | 81 | If this is a function, call it to generate the initial field text." |
| 82 | :group 'bibtex | 82 | :group 'bibtex |
| 83 | :version "31.1" ; change default | ||
| 83 | :type '(choice (const :tag "None" nil) | 84 | :type '(choice (const :tag "None" nil) |
| 84 | (string :tag "Initial text") | 85 | (string :tag "Initial text") |
| 85 | (function :tag "Initialize Function") | 86 | (function :tag "Initialize Function") |
| 86 | (const :tag "Default" t)) | 87 | (const :tag "Default" t)) |
| 87 | :risky t) | 88 | :risky t) |
| 88 | 89 | ;; The functionality provided by `bibtex-include-OPTkey' is a special case | |
| 89 | (defcustom bibtex-user-optional-fields | 90 | ;; of what `bibtex-aux-opt-alist' offers. Which BibTeX style files actually |
| 90 | '(("annote" "Personal annotation (ignored)")) | 91 | ;; use the key field? The BibTeX docomentation suggests it is used rarely. |
| 91 | "List of optional fields the user wants to have always present. | 92 | ;; Under biblatex, the key field is an alias for sortkey, see Secs. 2.2.3 |
| 92 | Entries should be of the same form as the OPTIONAL list | 93 | ;; and 2.2.5. |
| 93 | in `bibtex-BibTeX-entry-alist' (which see)." | 94 | (make-obsolete-variable 'bibtex-include-OPTkey |
| 94 | :group 'bibtex | 95 | "use `bibtex-aux-opt-alist' instead." "31.1") |
| 95 | :type '(repeat (group (string :tag "Field") | ||
| 96 | (string :tag "Comment") | ||
| 97 | (option (choice :tag "Init" | ||
| 98 | (const nil) string function)))) | ||
| 99 | :risky t) | ||
| 100 | 96 | ||
| 101 | (defcustom bibtex-entry-format | 97 | (defcustom bibtex-entry-format |
| 102 | '(opts-or-alts required-fields numerical-fields) | 98 | '(opts-or-alts required-fields numerical-fields) |
| @@ -285,66 +281,60 @@ If parsing fails, try to set this variable to nil." | |||
| 285 | :group 'bibtex | 281 | :group 'bibtex |
| 286 | :type 'boolean) | 282 | :type 'boolean) |
| 287 | 283 | ||
| 284 | (define-widget 'bibtex-field-list 'lazy | ||
| 285 | "Format of fields of entries in `bibtex-BibTeX-entry-alist' and friends." | ||
| 286 | :type '(group (string :tag "Field") | ||
| 287 | (option (choice :tag "Comment" :value nil | ||
| 288 | (const nil) string)) | ||
| 289 | (option (choice :tag "Init" :value nil | ||
| 290 | (const nil) string function)) | ||
| 291 | (option (choice :tag "Alternative" :value nil | ||
| 292 | (const nil) integer)))) | ||
| 293 | |||
| 288 | (define-widget 'bibtex-entry-alist 'lazy | 294 | (define-widget 'bibtex-entry-alist 'lazy |
| 289 | "Format of `bibtex-BibTeX-entry-alist' and friends." | 295 | "Format of `bibtex-BibTeX-entry-alist' and friends." |
| 290 | :type '(repeat (group (string :tag "Entry type") | 296 | :type '(repeat |
| 291 | (string :tag "Documentation") | 297 | (choice (group :tag "Alias" |
| 292 | (repeat :tag "Required fields" | 298 | (string :tag "Entry type") |
| 293 | (group (string :tag "Field") | 299 | (string :tag "Documentation") |
| 294 | (option (choice :tag "Comment" :value nil | 300 | (string :tag "Alias")) |
| 295 | (const nil) string)) | 301 | (group :tag "Entry" |
| 296 | (option (choice :tag "Init" :value nil | 302 | (string :tag "Entry type") |
| 297 | (const nil) string function)) | 303 | (string :tag "Documentation") |
| 298 | (option (choice :tag "Alternative" :value nil | 304 | (repeat :tag "Required fields" bibtex-field-list) |
| 299 | (const nil) integer)))) | 305 | (repeat :tag "Crossref fields" bibtex-field-list) |
| 300 | (repeat :tag "Crossref fields" | 306 | (repeat :tag "Optional fields" bibtex-field-list))))) |
| 301 | (group (string :tag "Field") | 307 | |
| 302 | (option (choice :tag "Comment" :value nil | 308 | ;; The variables `bibtex-BibTeX-entry-alist' and `bibtex-biblatex-entry-alist' |
| 303 | (const nil) string)) | 309 | ;; contain all magnificent definitions of entries for BibTeX and biblatex. |
| 304 | (option (choice :tag "Init" :value nil | 310 | ;; They have been user variables for a long time. But they are too bulky |
| 305 | (const nil) string function)) | 311 | ;; for users to fiddle with them. So we preserve their status of all-embracing |
| 306 | (option (choice :tag "Alternative" :value nil | 312 | ;; user variables. But we provide the extra user variables |
| 307 | (const nil) integer)))) | 313 | ;; `bibtex-BibTeX-aux-entry-alist' and `bibtex-biblatex-aux-entry-alist' |
| 308 | (repeat :tag "Optional fields" | 314 | ;; that take precedence over `bibtex-BibTeX-entry-alist' and |
| 309 | (group (string :tag "Field") | 315 | ;; `bibtex-biblatex-entry-alist'. Additional customization is possible via |
| 310 | (option (choice :tag "Comment" :value nil | 316 | ;; `bibtex-BibTeX-aux-opt-alist' and `bibtex-biblatex-aux-opt-alist'. |
| 311 | (const nil) string)) | 317 | ;; The variables `bibtex-BibTeX-field-alist' and `bibtex-biblatex-field-alist' |
| 312 | (option (choice :tag "Init" :value nil | 318 | ;; are used with `bibtex-print-help-message'. They are less significant than |
| 313 | (const nil) string function)) | 319 | ;; the entry-alist variables. |
| 314 | (option (choice :tag "Alternative" :value nil | ||
| 315 | (const nil) integer))))))) | ||
| 316 | 320 | ||
| 317 | (defcustom bibtex-BibTeX-entry-alist | 321 | (defcustom bibtex-BibTeX-entry-alist |
| 318 | '(("Article" "Article in Journal" | 322 | '(("Article" "Article in Journal" |
| 319 | (("author") | 323 | (("author") |
| 320 | ("title" "Title of the article (BibTeX converts it to lowercase)")) | 324 | ("title" "Title of the article")) |
| 321 | (("journal") ("year")) | 325 | (("journal") ("year")) |
| 322 | (("volume" "Volume of the journal") | 326 | (("volume" "Volume of the journal") |
| 323 | ("number" "Number of the journal (only allowed if entry contains volume)") | 327 | ("number" "Number of the journal") |
| 324 | ("pages" "Pages in the journal") | 328 | ("pages" "Pages in the journal") |
| 325 | ("month") ("note"))) | 329 | ("month") ("note"))) |
| 326 | ("InProceedings" "Article in Conference Proceedings" | 330 | ("InProceedings" "Article in Conference Proceedings" |
| 327 | (("author") | 331 | (("author") |
| 328 | ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)")) | 332 | ("title" "Title of the article in proceedings")) |
| 329 | (("booktitle" "Name of the conference proceedings") | ||
| 330 | ("year")) | ||
| 331 | (("editor") | ||
| 332 | ("volume" "Volume of the conference proceedings in the series") | ||
| 333 | ("number" "Number of the conference proceedings in a small series (overwritten by volume)") | ||
| 334 | ("series" "Series in which the conference proceedings appeared") | ||
| 335 | ("pages" "Pages in the conference proceedings") | ||
| 336 | ("month") ("address") | ||
| 337 | ("organization" "Sponsoring organization of the conference") | ||
| 338 | ("publisher" "Publishing company, its location") | ||
| 339 | ("note"))) | ||
| 340 | ("Conference" "Article in Conference Proceedings" ; same as InProceedings | ||
| 341 | (("author") | ||
| 342 | ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)")) | ||
| 343 | (("booktitle" "Name of the conference proceedings") | 333 | (("booktitle" "Name of the conference proceedings") |
| 344 | ("year")) | 334 | ("year")) |
| 345 | (("editor") | 335 | (("editor") |
| 346 | ("volume" "Volume of the conference proceedings in the series") | 336 | ("volume" "Volume of the conference proceedings in the series") |
| 347 | ("number" "Number of the conference proceedings in a small series (overwritten by volume)") | 337 | ("number" "Number of the conference proceedings in a small series") |
| 348 | ("series" "Series in which the conference proceedings appeared") | 338 | ("series" "Series in which the conference proceedings appeared") |
| 349 | ("pages" "Pages in the conference proceedings") | 339 | ("pages" "Pages in the conference proceedings") |
| 350 | ("month") ("address") | 340 | ("month") ("address") |
| @@ -353,17 +343,17 @@ If parsing fails, try to set this variable to nil." | |||
| 353 | ("note"))) | 343 | ("note"))) |
| 354 | ("InCollection" "Article in a Collection" | 344 | ("InCollection" "Article in a Collection" |
| 355 | (("author") | 345 | (("author") |
| 356 | ("title" "Title of the article in book (BibTeX converts it to lowercase)") | 346 | ("title" "Title of the article in book") |
| 357 | ("booktitle" "Name of the book")) | 347 | ("booktitle" "Name of the book")) |
| 358 | (("publisher") ("year")) | 348 | (("publisher") ("year")) |
| 359 | (("editor") | 349 | (("editor") |
| 360 | ("volume" "Volume of the book in the series") | 350 | ("volume" "Volume of the book in the series") |
| 361 | ("number" "Number of the book in a small series (overwritten by volume)") | 351 | ("number" "Number of the book in a small series") |
| 362 | ("series" "Series in which the book appeared") | 352 | ("series" "Series in which the book appeared") |
| 363 | ("type" "Word to use instead of \"chapter\"") | 353 | ("type" "Word to use instead of \"chapter\"") |
| 364 | ("chapter" "Chapter in the book") | 354 | ("chapter" "Chapter in the book") |
| 365 | ("pages" "Pages in the book") | 355 | ("pages" "Pages in the book") |
| 366 | ("edition" "Edition of the book as a capitalized English word") | 356 | ("edition" "Edition of the book as an ordinal") |
| 367 | ("month") ("address") ("note"))) | 357 | ("month") ("address") ("note"))) |
| 368 | ("InBook" "Chapter or Pages in a Book" | 358 | ("InBook" "Chapter or Pages in a Book" |
| 369 | (("author" nil nil 0) | 359 | (("author" nil nil 0) |
| @@ -372,11 +362,11 @@ If parsing fails, try to set this variable to nil." | |||
| 372 | ("chapter" "Chapter in the book")) | 362 | ("chapter" "Chapter in the book")) |
| 373 | (("publisher") ("year")) | 363 | (("publisher") ("year")) |
| 374 | (("volume" "Volume of the book in the series") | 364 | (("volume" "Volume of the book in the series") |
| 375 | ("number" "Number of the book in a small series (overwritten by volume)") | 365 | ("number" "Number of the book in a small series") |
| 376 | ("series" "Series in which the book appeared") | 366 | ("series" "Series in which the book appeared") |
| 377 | ("type" "Word to use instead of \"chapter\"") | 367 | ("type" "Word to use instead of \"chapter\"") |
| 378 | ("address") | 368 | ("address") |
| 379 | ("edition" "Edition of the book as a capitalized English word") | 369 | ("edition" "Edition of the book as an ordinal") |
| 380 | ("month") | 370 | ("month") |
| 381 | ("pages" "Pages in the book") | 371 | ("pages" "Pages in the book") |
| 382 | ("note"))) | 372 | ("note"))) |
| @@ -387,12 +377,12 @@ If parsing fails, try to set this variable to nil." | |||
| 387 | (("booktitle" "Title of the proceedings for cross references") | 377 | (("booktitle" "Title of the proceedings for cross references") |
| 388 | ("editor") | 378 | ("editor") |
| 389 | ("volume" "Volume of the conference proceedings in the series") | 379 | ("volume" "Volume of the conference proceedings in the series") |
| 390 | ("number" "Number of the conference proceedings in a small series (overwritten by volume)") | 380 | ("number" "Number of the conference proceedings in a small series") |
| 391 | ("series" "Series in which the conference proceedings appeared") | 381 | ("series" "Series in which the conference proceedings appeared") |
| 392 | ("address") | 382 | ("address") |
| 393 | ("month") | 383 | ("month") |
| 394 | ("organization" "Sponsoring organization of the conference") | 384 | ("organization" "Sponsoring organization of the conference") |
| 395 | ("publisher" "Publishing company, its location") | 385 | ("publisher" "Publishing company") |
| 396 | ("note"))) | 386 | ("note"))) |
| 397 | ("Book" "Book" | 387 | ("Book" "Book" |
| 398 | (("author" nil nil 0) | 388 | (("author" nil nil 0) |
| @@ -400,13 +390,13 @@ If parsing fails, try to set this variable to nil." | |||
| 400 | ("title" "Title of the book")) | 390 | ("title" "Title of the book")) |
| 401 | (("publisher") ("year")) | 391 | (("publisher") ("year")) |
| 402 | (("volume" "Volume of the book in the series") | 392 | (("volume" "Volume of the book in the series") |
| 403 | ("number" "Number of the book in a small series (overwritten by volume)") | 393 | ("number" "Number of the book in a small series") |
| 404 | ("series" "Series in which the book appeared") | 394 | ("series" "Series in which the book appeared") |
| 405 | ("address") | 395 | ("address") |
| 406 | ("edition" "Edition of the book as a capitalized English word") | 396 | ("edition" "Edition of the book as an ordinal") |
| 407 | ("month") ("note"))) | 397 | ("month") ("note"))) |
| 408 | ("Booklet" "Booklet (Bound, but no Publisher)" | 398 | ("Booklet" "Booklet (Bound, but no Publisher)" |
| 409 | (("title" "Title of the booklet (BibTeX converts it to lowercase)")) | 399 | (("title" "Title of the booklet")) |
| 410 | nil | 400 | nil |
| 411 | (("author") | 401 | (("author") |
| 412 | ("howpublished" "The way in which the booklet was published") | 402 | ("howpublished" "The way in which the booklet was published") |
| @@ -418,20 +408,20 @@ If parsing fails, try to set this variable to nil." | |||
| 418 | ("year")) | 408 | ("year")) |
| 419 | nil | 409 | nil |
| 420 | (("type" "Type of the PhD thesis") | 410 | (("type" "Type of the PhD thesis") |
| 421 | ("address" "Address of the school (if not part of field \"school\") or country") | 411 | ("address" "Address of the school or country") |
| 422 | ("month") ("note"))) | 412 | ("month") ("note"))) |
| 423 | ("MastersThesis" "Master's Thesis" | 413 | ("MastersThesis" "Master's Thesis" |
| 424 | (("author") | 414 | (("author") |
| 425 | ("title" "Title of the master's thesis (BibTeX converts it to lowercase)") | 415 | ("title" "Title of the master's thesis") |
| 426 | ("school" "School where the master's thesis was written") | 416 | ("school" "School where the master's thesis was written") |
| 427 | ("year")) | 417 | ("year")) |
| 428 | nil | 418 | nil |
| 429 | (("type" "Type of the master's thesis (if other than \"Master's thesis\")") | 419 | (("type" "Type of the master's thesis (if other than \"Master's thesis\")") |
| 430 | ("address" "Address of the school (if not part of field \"school\") or country") | 420 | ("address" "Address of the school or country") |
| 431 | ("month") ("note"))) | 421 | ("month") ("note"))) |
| 432 | ("TechReport" "Technical Report" | 422 | ("TechReport" "Technical Report" |
| 433 | (("author") | 423 | (("author") |
| 434 | ("title" "Title of the technical report (BibTeX converts it to lowercase)") | 424 | ("title" "Title of the technical report") |
| 435 | ("institution" "Sponsoring institution of the report") | 425 | ("institution" "Sponsoring institution of the report") |
| 436 | ("year")) | 426 | ("year")) |
| 437 | nil | 427 | nil |
| @@ -444,51 +434,65 @@ If parsing fails, try to set this variable to nil." | |||
| 444 | (("author") | 434 | (("author") |
| 445 | ("organization" "Publishing organization of the manual") | 435 | ("organization" "Publishing organization of the manual") |
| 446 | ("address") | 436 | ("address") |
| 447 | ("edition" "Edition of the manual as a capitalized English word") | 437 | ("edition" "Edition of the manual as an ordinal") |
| 448 | ("month") ("year") ("note"))) | 438 | ("month") ("year") ("note"))) |
| 449 | ("Unpublished" "Unpublished" | 439 | ("Unpublished" "Unpublished" |
| 450 | (("author") | 440 | (("author") |
| 451 | ("title" "Title of the unpublished work (BibTeX converts it to lowercase)") | 441 | ("title" "Title of the unpublished work") |
| 452 | ("note")) | 442 | ("note")) |
| 453 | nil | 443 | nil |
| 454 | (("month") ("year"))) | 444 | (("month") ("year"))) |
| 455 | ("Misc" "Miscellaneous" nil nil | 445 | ("Misc" "Miscellaneous" nil nil |
| 456 | (("author") | 446 | (("author") |
| 457 | ("title" "Title of the work (BibTeX converts it to lowercase)") | 447 | ("title" "Title of the work") |
| 458 | ("howpublished" "The way in which the work was published") | 448 | ("howpublished" "The way in which the work was published") |
| 459 | ("month") ("year") ("note")))) | 449 | ("month") ("year") ("note")))) |
| 460 | "Alist of BibTeX entry types and their associated fields. | 450 | "Alist of BibTeX entry types and their associated fields. |
| 461 | Elements are lists (ENTRY-TYPE DOC REQUIRED CROSSREF OPTIONAL). | 451 | Elements are lists (ENTRY DOC REQUIRED CROSSREF OPTIONAL) |
| 462 | ENTRY-TYPE is the type of a BibTeX entry. | 452 | or (ENTRY DOC REF-ENTRY). |
| 463 | DOC is a brief doc string used for menus. If nil ENTRY-TYPE is used. | 453 | |
| 464 | REQUIRED is a list of required fields. | 454 | ENTRY is the type of a BibTeX entry. |
| 465 | CROSSREF is a list of fields that are optional if a crossref field | 455 | DOC is a brief doc string used for documentation. If nil ENTRY is used. |
| 456 | REF-ENTRY is another entry type, where ENTRY becomes an alias that inherits | ||
| 457 | the definition of REF-ENTRY. | ||
| 458 | |||
| 459 | REQUIRED is an alist of required fields. | ||
| 460 | CROSSREF is an alist of fields that are optional if a crossref field | ||
| 466 | is present; but these fields are required otherwise. | 461 | is present; but these fields are required otherwise. |
| 467 | OPTIONAL is a list of optional fields. | 462 | OPTIONAL is an alist of optional fields. |
| 468 | 463 | ||
| 469 | Each element of these lists is a list of the form | 464 | Each element of these lists is a list of the form |
| 470 | (FIELD COMMENT INIT ALTERNATIVE). | 465 | (FIELD [COMMENT [INIT [ALTERNATIVE]]]). |
| 471 | COMMENT, INIT, and ALTERNATIVE are optional. | ||
| 472 | 466 | ||
| 473 | FIELD is the name of the field. | 467 | FIELD is the name of the field. |
| 474 | COMMENT is the comment string that appears in the echo area. | 468 | COMMENT is a comment used with `bibtex-print-help-message'. |
| 475 | If COMMENT is nil use `bibtex-BibTeX-field-alist' if possible. | 469 | If COMMENT is nil use `bibtex-BibTeX-field-alist' if possible. |
| 476 | INIT is either the initial content of the field or a function, | 470 | INIT is either the initial content of the field or a function, |
| 477 | which is called to determine the initial content of the field. | 471 | which is called to determine the initial content of the field. |
| 478 | ALTERNATIVE if non-nil is an integer N that numbers sets of | 472 | ALTERNATIVE if non-nil is an integer N that numbers sets of |
| 479 | alternatives. A negative integer -N indicates an alias for the | 473 | alternatives. A negative integer -N indicates an alias for the |
| 480 | field +N. Such aliases are ignored by `bibtex-entry' in the template | 474 | field +N. Such aliases are ignored by `bibtex-entry' in the template |
| 481 | for a new entry." | 475 | for a new entry. |
| 476 | See also `bibtex-BibTeX-aux-entry-alist' which takes precedence." | ||
| 482 | :group 'bibtex | 477 | :group 'bibtex |
| 483 | :version "28.1" ; extend alternatives | 478 | :version "31.1" ; allow aliases |
| 479 | :set (lambda (symbol value) | ||
| 480 | (set-default symbol value) | ||
| 481 | ;; `bibtex-init-dialect' is undefined during loading (no problem). | ||
| 482 | (if (fboundp 'bibtex-init-dialect) | ||
| 483 | (bibtex-init-dialect 'BibTeX))) | ||
| 484 | :type 'bibtex-entry-alist | 484 | :type 'bibtex-entry-alist |
| 485 | :risky t) | 485 | :risky t) |
| 486 | 486 | ||
| 487 | ;; Compare in biblatex documentation: | ||
| 488 | ;; Sec. 2.1.1 Regular types (required and optional fields) | ||
| 489 | ;; Sec. 2.1.2 Type Aliases | ||
| 490 | ;; Sec. 2.1.3 Non-Standard Types -> `bibtex-biblatex-aux-entry-alist' | ||
| 491 | ;; Sec. 2.2.2 Data Fields -> `bibtex-biblatex-field-alist' | ||
| 492 | ;; Sec. 2.2.5 Field Aliases -> `bibtex-biblatex-aux-opt-alist' | ||
| 493 | ;; Appendix A Default Crossref setup | ||
| 494 | |||
| 487 | (defcustom bibtex-biblatex-entry-alist | 495 | (defcustom bibtex-biblatex-entry-alist |
| 488 | ;; Compare in biblatex documentation: | ||
| 489 | ;; Sec. 2.1.1 Regular types (required and optional fields) | ||
| 490 | ;; Sec. 2.2.5 Field Aliases | ||
| 491 | ;; Appendix A Default Crossref setup | ||
| 492 | '(("Article" "Article in Journal" | 496 | '(("Article" "Article in Journal" |
| 493 | (("author") ("title") | 497 | (("author") ("title") |
| 494 | ("journaltitle" nil nil 3) ("journal" nil nil -3) | 498 | ("journaltitle" nil nil 3) ("journal" nil nil -3) |
| @@ -546,34 +550,8 @@ for a new entry." | |||
| 546 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | 550 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) |
| 547 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | 551 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) |
| 548 | ("url") ("urldate"))) | 552 | ("url") ("urldate"))) |
| 549 | ("BookInBook" "Book in Collection" ; same as @inbook | 553 | ("BookInBook" "Book in Collection" "InBook") |
| 550 | (("title") ("date" nil nil 1) ("year" nil nil -1)) | 554 | ("SuppBook" "Supplemental Material in a Book" "InBook") |
| 551 | (("author") ("booktitle")) | ||
| 552 | (("bookauthor") ("editor") ("editora") ("editorb") ("editorc") | ||
| 553 | ("translator") ("annotator") ("commentator") ("introduction") ("foreword") | ||
| 554 | ("afterword") ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle") | ||
| 555 | ("maintitleaddon") ("booksubtitle") ("booktitleaddon") | ||
| 556 | ("language") ("origlanguage") ("volume") ("part") ("edition") ("volumes") | ||
| 557 | ("series") ("number") ("note") ("publisher") | ||
| 558 | ("location" nil nil 2) ("address" nil nil -2) ("isbn") ("eid") | ||
| 559 | ("chapter") ("pages") ("addendum") ("pubstate") ("doi") | ||
| 560 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | ||
| 561 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | ||
| 562 | ("url") ("urldate"))) | ||
| 563 | ("SuppBook" "Supplemental Material in a Book" ; same as @inbook | ||
| 564 | (("title") ("date" nil nil 1) ("year" nil nil -1)) | ||
| 565 | (("author") ("booktitle")) | ||
| 566 | (("bookauthor") ("editor") ("editora") ("editorb") ("editorc") | ||
| 567 | ("translator") ("annotator") ("commentator") ("introduction") ("foreword") | ||
| 568 | ("afterword") ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle") | ||
| 569 | ("maintitleaddon") ("booksubtitle") ("booktitleaddon") | ||
| 570 | ("language") ("origlanguage") ("volume") ("part") ("edition") ("volumes") | ||
| 571 | ("series") ("number") ("note") ("publisher") | ||
| 572 | ("location" nil nil 2) ("address" nil nil -2) ("isbn") ("eid") | ||
| 573 | ("chapter") ("pages") ("addendum") ("pubstate") ("doi") | ||
| 574 | ("eprint")("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | ||
| 575 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | ||
| 576 | ("url") ("urldate"))) | ||
| 577 | ("Booklet" "Booklet (Bound, but no Publisher)" | 555 | ("Booklet" "Booklet (Bound, but no Publisher)" |
| 578 | (("author" nil nil 0) ("editor" nil nil 0) ("title") | 556 | (("author" nil nil 0) ("editor" nil nil 0) ("title") |
| 579 | ("date" nil nil 1) ("year" nil nil -1)) | 557 | ("date" nil nil 1) ("year" nil nil -1)) |
| @@ -628,21 +606,7 @@ for a new entry." | |||
| 628 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | 606 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) |
| 629 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | 607 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) |
| 630 | ("url") ("urldate"))) | 608 | ("url") ("urldate"))) |
| 631 | ("SuppCollection" "Supplemental Material in a Collection" ; same as @incollection | 609 | ("SuppCollection" "Supplemental Material in a Collection" "InCollection") |
| 632 | (("author") ("title") | ||
| 633 | ("date" nil nil 1) ("year" nil nil -1)) | ||
| 634 | (("booktitle")) | ||
| 635 | (("editor") ("editora") ("editorb") ("editorc") ("translator") | ||
| 636 | ("annotator") ("commentator") ("introduction") ("foreword") ("afterword") | ||
| 637 | ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle") | ||
| 638 | ("maintitleaddon") ("booksubtitle") ("booktitleaddon") | ||
| 639 | ("language") ("origlanguage") ("volume") ("part") ("edition") | ||
| 640 | ("volumes") ("series") ("number") ("note") ("publisher") | ||
| 641 | ("location" nil nil 2) ("address" nil nil -2) | ||
| 642 | ("isbn") ("eid") ("chapter") ("pages") ("addendum") ("pubstate") ("doi") | ||
| 643 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | ||
| 644 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | ||
| 645 | ("url") ("urldate"))) | ||
| 646 | ("Dataset" "Data Set" | 610 | ("Dataset" "Data Set" |
| 647 | (("author" nil nil 0) ("editor" nil nil 0) ("title") | 611 | (("author" nil nil 0) ("editor" nil nil 0) ("title") |
| 648 | ("date" nil nil 1) ("year" nil nil -1)) | 612 | ("date" nil nil 1) ("year" nil nil -1)) |
| @@ -708,20 +672,7 @@ for a new entry." | |||
| 708 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | 672 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) |
| 709 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | 673 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) |
| 710 | ("url") ("urldate"))) | 674 | ("url") ("urldate"))) |
| 711 | ("SuppPeriodical" "Supplemental Material in a Periodical" ; same as @article | 675 | ("SuppPeriodical" "Supplemental Material in a Periodical" "Article") |
| 712 | (("author") ("title") | ||
| 713 | ("journaltitle" nil nil 3) ("journal" nil nil -3) | ||
| 714 | ("date" nil nil 1) ("year" nil nil -1)) | ||
| 715 | nil | ||
| 716 | (("translator") ("annotator") ("commentator") ("subtitle") ("titleaddon") | ||
| 717 | ("editor") ("editora") ("editorb") ("editorc") ("journalsubtitle") | ||
| 718 | ("journaltitleaddon") ("issuetitle") ("issuesubtitle") ("issuetitleaddon") | ||
| 719 | ("language") ("origlanguage") ("series") ("volume") ("number") ("eid") | ||
| 720 | ("issue") ("month") ("pages") ("version") ("note") ("issn") | ||
| 721 | ("addendum") ("pubstate") ("doi") | ||
| 722 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | ||
| 723 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | ||
| 724 | ("url") ("urldate"))) | ||
| 725 | ("Proceedings" "Single-Volume Conference Proceedings" | 676 | ("Proceedings" "Single-Volume Conference Proceedings" |
| 726 | (("title") ("date" nil nil 1) ("year" nil nil -1)) | 677 | (("title") ("date" nil nil 1) ("year" nil nil -1)) |
| 727 | nil | 678 | nil |
| @@ -760,60 +711,10 @@ for a new entry." | |||
| 760 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | 711 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) |
| 761 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | 712 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) |
| 762 | ("url") ("urldate"))) | 713 | ("url") ("urldate"))) |
| 763 | ("Conference" "Article in Conference Proceedings" ; same as InProceedings | 714 | ("Conference" "Article in Conference Proceedings" "InProceedings") |
| 764 | (("author") | 715 | ("Reference" "Single-Volume Work of Reference" "Collection") |
| 765 | ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)")) | 716 | ("MVReference" "Multi-Volume Work of Reference" "MVCollection") |
| 766 | (("booktitle" "Name of the conference proceedings") | 717 | ("InReference" "Article in a Work of Reference" "InCollection") |
| 767 | ("year")) | ||
| 768 | (("editor") | ||
| 769 | ("volume" "Volume of the conference proceedings in the series") | ||
| 770 | ("number" "Number of the conference proceedings in a small series (overwritten by volume)") | ||
| 771 | ("series" "Series in which the conference proceedings appeared") | ||
| 772 | ("pages" "Pages in the conference proceedings") | ||
| 773 | ("month") ("address") | ||
| 774 | ("organization" "Sponsoring organization of the conference") | ||
| 775 | ("publisher" "Publishing company, its location") | ||
| 776 | ("note"))) | ||
| 777 | ("Reference" "Single-Volume Work of Reference" ; same as @collection | ||
| 778 | (("editor") ("title") ("date" nil nil 1) ("year" nil nil -1)) | ||
| 779 | nil | ||
| 780 | (("editora") ("editorb") ("editorc") ("translator") ("annotator") | ||
| 781 | ("commentator") ("introduction") ("foreword") ("afterword") | ||
| 782 | ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle") | ||
| 783 | ("maintitleaddon") ("language") ("origlanguage") ("volume") | ||
| 784 | ("part") ("edition") ("volumes") ("series") ("number") ("note") | ||
| 785 | ("publisher") ("location" nil nil 2) ("address" nil nil -2) | ||
| 786 | ("isbn") ("eid") ("chapter") ("pages") | ||
| 787 | ("pagetotal") ("addendum") ("pubstate") ("doi") | ||
| 788 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | ||
| 789 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | ||
| 790 | ("url") ("urldate"))) | ||
| 791 | ("MVReference" "Multi-Volume Work of Reference" ; same as @mvcollection | ||
| 792 | (("editor") ("title") ("date" nil nil 1) ("year" nil nil -1)) | ||
| 793 | nil | ||
| 794 | (("editora") ("editorb") ("editorc") ("translator") ("annotator") | ||
| 795 | ("commentator") ("introduction") ("foreword") ("afterword") | ||
| 796 | ("subtitle") ("titleaddon") ("language") ("origlanguage") ("edition") | ||
| 797 | ("volumes") ("series") ("number") ("note") ("publisher") | ||
| 798 | ("location" nil nil 2) ("address" nil nil -2) | ||
| 799 | ("isbn") ("pagetotal") ("addendum") ("pubstate") ("doi") | ||
| 800 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | ||
| 801 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | ||
| 802 | ("url") ("urldate"))) | ||
| 803 | ("InReference" "Article in a Work of Reference" ; same as @incollection | ||
| 804 | (("author") ("title") ("date" nil nil 1) ("year" nil nil -1)) | ||
| 805 | (("booktitle")) | ||
| 806 | (("editor") ("editora") ("editorb") ("editorc") ("translator") | ||
| 807 | ("annotator") ("commentator") ("introduction") ("foreword") ("afterword") | ||
| 808 | ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle") | ||
| 809 | ("maintitleaddon") ("booksubtitle") ("booktitleaddon") | ||
| 810 | ("language") ("origlanguage") ("volume") ("part") ("edition") | ||
| 811 | ("volumes") ("series") ("number") ("note") ("publisher") | ||
| 812 | ("location" nil nil 2) ("address" nil nil -2) | ||
| 813 | ("isbn") ("eid") ("chapter") ("pages") ("addendum") ("pubstate") ("doi") | ||
| 814 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | ||
| 815 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | ||
| 816 | ("url") ("urldate"))) | ||
| 817 | ("Report" "Technical or Research Report" | 718 | ("Report" "Technical or Research Report" |
| 818 | (("author") ("title") ("type") | 719 | (("author") ("title") ("type") |
| 819 | ("institution" nil nil 6) ("school" nil nil -6) | 720 | ("institution" nil nil 6) ("school" nil nil -6) |
| @@ -826,17 +727,7 @@ for a new entry." | |||
| 826 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | 727 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) |
| 827 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | 728 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) |
| 828 | ("url") ("urldate"))) | 729 | ("url") ("urldate"))) |
| 829 | ("Software" "Computer Software" ; Same as @misc. | 730 | ("Software" "Computer Software" "Misc") |
| 830 | (("author" nil nil 0) ("editor" nil nil 0) ("title") | ||
| 831 | ("date" nil nil 1) ("year" nil nil -1)) | ||
| 832 | nil | ||
| 833 | (("subtitle") ("titleaddon") ("language") ("howpublished") ("type") | ||
| 834 | ("version") ("note") ("organization") | ||
| 835 | ("location" nil nil 2) ("address" nil nil -2) | ||
| 836 | ("month") ("addendum") ("pubstate") ("doi") | ||
| 837 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | ||
| 838 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | ||
| 839 | ("url") ("urldate"))) | ||
| 840 | ("Thesis" "PhD or Master's Thesis" | 731 | ("Thesis" "PhD or Master's Thesis" |
| 841 | (("author") ("title") ("type") | 732 | (("author") ("title") ("type") |
| 842 | ("institution" nil nil 6) ("school" nil nil -6) | 733 | ("institution" nil nil 6) ("school" nil nil -6) |
| @@ -852,30 +743,30 @@ for a new entry." | |||
| 852 | ("PhdThesis" "PhD Thesis" | 743 | ("PhdThesis" "PhD Thesis" |
| 853 | (("author") | 744 | (("author") |
| 854 | ("title" "Title of the PhD thesis") | 745 | ("title" "Title of the PhD thesis") |
| 855 | ("school" "School where the PhD thesis was written") | 746 | ("institution") |
| 856 | ("year")) | 747 | ("date" nil nil 1) ("year" nil nil -1)) |
| 857 | nil | ||
| 858 | (("type" "Type of the PhD thesis") | ||
| 859 | ("address" "Address of the school (if not part of field \"school\") or country") | ||
| 860 | ("month") ("note"))) | ||
| 861 | ("MastersThesis" "Master's Thesis" | ||
| 862 | (("author") | ||
| 863 | ("title" "Title of the master's thesis (BibTeX converts it to lowercase)") | ||
| 864 | ("school" "School where the master's thesis was written") | ||
| 865 | ("year")) | ||
| 866 | nil | 748 | nil |
| 867 | (("type" "Type of the master's thesis (if other than \"Master's thesis\")") | 749 | (("subtitle") ("titleaddon") ("language") ("note") |
| 868 | ("address" "Address of the school (if not part of field \"school\") or country") | 750 | ("location" nil nil 2) ("address" nil nil -2) |
| 869 | ("month") ("note"))) | 751 | ("month") ("isbn") ("eid") ("chapter") ("pages") ("pagetotal") |
| 752 | ("addendum") ("pubstate") ("doi") | ||
| 753 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | ||
| 754 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | ||
| 755 | ("url") ("urldate"))) | ||
| 756 | ("MastersThesis" "Master's Thesis" "PhdThesis") | ||
| 870 | ("TechReport" "Technical Report" | 757 | ("TechReport" "Technical Report" |
| 871 | (("author") | 758 | (("author") ("title") |
| 872 | ("title" "Title of the technical report (BibTeX converts it to lowercase)") | 759 | ("institution" nil nil 6) ("school" nil nil -6) |
| 873 | ("institution" "Sponsoring institution of the report") | 760 | ("date" nil nil 1) ("year" nil nil -1)) |
| 874 | ("year")) | ||
| 875 | nil | 761 | nil |
| 876 | (("type" "Type of the report (if other than \"technical report\")") | 762 | (("type") |
| 877 | ("number" "Number of the technical report") | 763 | ("subtitle") ("titleaddon") ("language") ("number") ("version") ("note") |
| 878 | ("address") ("month") ("note"))) | 764 | ("location" nil nil 2) ("address" nil nil -2) |
| 765 | ("month") ("isrn") ("eid") ("chapter") ("pages") | ||
| 766 | ("pagetotal") ("addendum") ("pubstate") ("doi") | ||
| 767 | ("eprint") ("eprintclass" nil nil 4) ("primaryclass" nil nil -4) | ||
| 768 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | ||
| 769 | ("url") ("urldate"))) | ||
| 879 | ("Unpublished" "Unpublished" | 770 | ("Unpublished" "Unpublished" |
| 880 | (("author") ("title") ("date" nil nil 1) ("year" nil nil -1)) | 771 | (("author") ("title") ("date" nil nil 1) ("year" nil nil -1)) |
| 881 | nil | 772 | nil |
| @@ -887,14 +778,88 @@ for a new entry." | |||
| 887 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) | 778 | ("eprinttype" nil nil 5) ("archiveprefix" nil nil -5) |
| 888 | ("url") ("urldate")))) | 779 | ("url") ("urldate")))) |
| 889 | "Alist of biblatex entry types and their associated fields. | 780 | "Alist of biblatex entry types and their associated fields. |
| 890 | It has the same format as `bibtex-BibTeX-entry-alist'." | 781 | It has the same format as `bibtex-BibTeX-entry-alist'. |
| 782 | See also `bibtex-biblatex-aux-entry-alist' which takes precedence." | ||
| 891 | :group 'bibtex | 783 | :group 'bibtex |
| 892 | :version "28.1" | 784 | :version "31.1" |
| 785 | :set (lambda (symbol value) | ||
| 786 | (set-default symbol value) | ||
| 787 | ;; `bibtex-init-dialect' is undefined during loading (no problem). | ||
| 788 | (if (fboundp 'bibtex-init-dialect) | ||
| 789 | (bibtex-init-dialect 'biblatex))) | ||
| 893 | :type 'bibtex-entry-alist | 790 | :type 'bibtex-entry-alist |
| 894 | :risky t) | 791 | :risky t) |
| 895 | 792 | ||
| 793 | (defcustom bibtex-BibTeX-aux-entry-alist | ||
| 794 | '(("Conference" "Article in Conference Proceedings" "InProceedings")) | ||
| 795 | "Auxiliary alist of BibTeX entry types and their associated fields. | ||
| 796 | Its entries take precedence over the entries in `bibtex-BibTeX-entry-alist'. | ||
| 797 | This alist has the same format as `bibtex-BibTeX-entry-alist'." | ||
| 798 | :group 'bibtex | ||
| 799 | :version "31.1" | ||
| 800 | :set (lambda (symbol value) | ||
| 801 | (set-default symbol value) | ||
| 802 | ;; `bibtex-init-dialect' is undefined during loading (no problem). | ||
| 803 | (if (fboundp 'bibtex-init-dialect) | ||
| 804 | (bibtex-init-dialect 'BibTeX))) | ||
| 805 | :type 'bibtex-entry-alist | ||
| 806 | :risky t) | ||
| 807 | |||
| 808 | (defcustom bibtex-biblatex-aux-entry-alist nil | ||
| 809 | "Auxiliary alist of biblatex entry types and their associated fields. | ||
| 810 | Its entries take precedence over the entries in `bibtex-biblatex-entry-alist'. | ||
| 811 | This alist has the same format as `bibtex-BibTeX-entry-alist'. | ||
| 812 | Use this, e.g., for non-standard types, see Sec. 2.1.3 of the biblatex manual." | ||
| 813 | :group 'bibtex | ||
| 814 | :version "31.1" | ||
| 815 | :set (lambda (symbol value) | ||
| 816 | (set-default symbol value) | ||
| 817 | ;; `bibtex-init-dialect' is undefined during loading (no problem). | ||
| 818 | (if (fboundp 'bibtex-init-dialect) | ||
| 819 | (bibtex-init-dialect 'biblatex))) | ||
| 820 | :type 'bibtex-entry-alist | ||
| 821 | :risky t) | ||
| 822 | |||
| 823 | (define-obsolete-variable-alias 'bibtex-user-optional-fields | ||
| 824 | 'bibtex-aux-opt-alist "31.1") | ||
| 825 | (defcustom bibtex-aux-opt-alist | ||
| 826 | '(("annote" "Personal annotation (ignored)")) | ||
| 827 | "Alist of auxiliary optional fields for all entries of all dialects. | ||
| 828 | Elements should be of the same form as the elements of the OPTIONAL alist | ||
| 829 | in `bibtex-BibTeX-entry-alist' (which see). These fields are always present. | ||
| 830 | See also `bibtex-BibTeX-aux-opt-alist' and `bibtex-biblatex-aux-opt-alist' | ||
| 831 | whose fields take precedence over optional fields in | ||
| 832 | `bibtex-BibTeX-entry-alist' and `bibtex-biblatex-entry-alist'." | ||
| 833 | :group 'bibtex | ||
| 834 | :version "31.1" | ||
| 835 | :type '(repeat (bibtex-field-list)) | ||
| 836 | :risky t) | ||
| 837 | |||
| 838 | (defcustom bibtex-BibTeX-aux-opt-alist nil | ||
| 839 | "Alist of auxiliary optional fields for all BibTeX entries. | ||
| 840 | Elements should be of the same form as the elements of the OPTIONAL alist | ||
| 841 | in `bibtex-BibTeX-entry-alist' (which see). These fields take precedence | ||
| 842 | over optional fields in `bibtex-BibTeX-entry-alist'. | ||
| 843 | See also `bibtex-aux-opt-alist' whose fields are always present." | ||
| 844 | :group 'bibtex | ||
| 845 | :version "31.1" | ||
| 846 | :type '(repeat (bibtex-field-list)) | ||
| 847 | :risky t) | ||
| 848 | |||
| 849 | (defcustom bibtex-biblatex-aux-opt-alist nil | ||
| 850 | "Alist of auxiliary optional fields for all biblatex entries. | ||
| 851 | Elements should be of the same form as the elements of the OPTIONAL alist | ||
| 852 | in `bibtex-BibTeX-entry-alist' (which see). These fields take precedence | ||
| 853 | over optional fields in `bibtex-biblatex-entry-alist'. | ||
| 854 | See also `bibtex-aux-opt-alist' whose fields are always present. | ||
| 855 | Use this, e.g., for custom fields, see Sec. 2.2.4 of the biblatex manual." | ||
| 856 | :group 'bibtex | ||
| 857 | :version "31.1" | ||
| 858 | :type '(repeat (bibtex-field-list)) | ||
| 859 | :risky t) | ||
| 860 | |||
| 896 | (define-widget 'bibtex-field-alist 'lazy | 861 | (define-widget 'bibtex-field-alist 'lazy |
| 897 | "Format of `bibtex-BibTeX-entry-alist' and friends." | 862 | "Format of `bibtex-BibTeX-field-alist' and friends." |
| 898 | :type '(repeat (group (string :tag "Field type") | 863 | :type '(repeat (group (string :tag "Field type") |
| 899 | (string :tag "Comment")))) | 864 | (string :tag "Comment")))) |
| 900 | 865 | ||
| @@ -906,12 +871,15 @@ It has the same format as `bibtex-BibTeX-entry-alist'." | |||
| 906 | ("month" "Month of the publication as a string (remove braces)") | 871 | ("month" "Month of the publication as a string (remove braces)") |
| 907 | ("note" "Remarks to be put at the end of the \\bibitem") | 872 | ("note" "Remarks to be put at the end of the \\bibitem") |
| 908 | ("publisher" "Publishing company") | 873 | ("publisher" "Publishing company") |
| 909 | ("address" "Address of the publisher")) | 874 | ("address" "Address of the publisher") |
| 875 | ("crossref" "Reference key of the cross-referenced entry") | ||
| 876 | ("key" "Used as label with certain BibTeX styles")) | ||
| 910 | "Alist of BibTeX fields. | 877 | "Alist of BibTeX fields. |
| 911 | Each element is a list (FIELD COMMENT). COMMENT is used as a default | 878 | Each element is a list (FIELD COMMENT). COMMENT is a comment used with |
| 912 | if `bibtex-BibTeX-entry-alist' does not define a comment for FIELD." | 879 | `bibtex-print-help-message' as a default if `bibtex-BibTeX-entry-alist' |
| 880 | does not define a comment for FIELD." | ||
| 913 | :group 'bibtex | 881 | :group 'bibtex |
| 914 | :version "24.1" | 882 | :version "31.1" |
| 915 | :type 'bibtex-field-alist) | 883 | :type 'bibtex-field-alist) |
| 916 | 884 | ||
| 917 | (defcustom bibtex-biblatex-field-alist | 885 | (defcustom bibtex-biblatex-field-alist |
| @@ -989,7 +957,7 @@ if `bibtex-BibTeX-entry-alist' does not define a comment for FIELD." | |||
| 989 | ("pagination" "Pagination of the work") | 957 | ("pagination" "Pagination of the work") |
| 990 | ("part" "Number of a partial volume") | 958 | ("part" "Number of a partial volume") |
| 991 | ("publisher" "Name(s) of the publisher(s)") | 959 | ("publisher" "Name(s) of the publisher(s)") |
| 992 | ("pubstate" "Publication state of the work, e. g.,'in press'") | 960 | ("pubstate" "Publication state of the work, e.g., 'in press'") |
| 993 | ("reprinttitle" "Title of a reprint of the work") | 961 | ("reprinttitle" "Title of a reprint of the work") |
| 994 | ("series" "Name of a publication series") | 962 | ("series" "Name of a publication series") |
| 995 | ("shortauthor" "Author(s) of the work, given in an abbreviated form") | 963 | ("shortauthor" "Author(s) of the work, given in an abbreviated form") |
| @@ -1010,17 +978,24 @@ if `bibtex-BibTeX-entry-alist' does not define a comment for FIELD." | |||
| 1010 | ("version" "Revision number of a piece of software, a manual, etc.") | 978 | ("version" "Revision number of a piece of software, a manual, etc.") |
| 1011 | ("volume" "Volume of a multi-volume book or a periodical") | 979 | ("volume" "Volume of a multi-volume book or a periodical") |
| 1012 | ("volumes" "Total number of volumes of a multi-volume work") | 980 | ("volumes" "Total number of volumes of a multi-volume work") |
| 1013 | ("year" "Year of publication")) | 981 | ("year" "Year of publication") |
| 982 | ("crossref" "Reference key of the cross-referenced entry") | ||
| 983 | ("key" "Used as label with certain BibTeX styles")) | ||
| 1014 | "Alist of biblatex fields. | 984 | "Alist of biblatex fields. |
| 1015 | It has the same format as `bibtex-BibTeX-field-alist'." | 985 | It has the same format as `bibtex-BibTeX-field-alist'." |
| 1016 | :group 'bibtex | 986 | :group 'bibtex |
| 1017 | :version "28.1" | 987 | :version "31.1" |
| 1018 | :type 'bibtex-field-alist) | 988 | :type 'bibtex-field-alist) |
| 1019 | 989 | ||
| 1020 | (defcustom bibtex-dialect-list '(BibTeX biblatex) | 990 | (defcustom bibtex-dialect-list '(BibTeX biblatex) |
| 1021 | "List of BibTeX dialects known to BibTeX mode. | 991 | "List of BibTeX dialects known to BibTeX mode. |
| 1022 | For each DIALECT (a symbol) a variable bibtex-DIALECT-entry-alist defines | 992 | For each DIALECT (a symbol) the following variables must be defined: |
| 1023 | the allowed entries and bibtex-DIALECT-field-alist defines known field types. | 993 | |
| 994 | bibtex-DIALECT-entry-alist defines the entry types allowed for dialect | ||
| 995 | bibtex-DIALECT-aux-entry-alist defines auxiliary entry types for dialect | ||
| 996 | bibtex-DIALECT-aux-opt-alist defines auxiliary optional fields for dialect | ||
| 997 | bibtex-DIALECT-field-alist defines known field types. | ||
| 998 | |||
| 1024 | Predefined dialects include BibTeX and biblatex." | 999 | Predefined dialects include BibTeX and biblatex." |
| 1025 | :group 'bibtex | 1000 | :group 'bibtex |
| 1026 | :version "24.1" | 1001 | :version "24.1" |
| @@ -1028,7 +1003,7 @@ Predefined dialects include BibTeX and biblatex." | |||
| 1028 | 1003 | ||
| 1029 | (defcustom bibtex-dialect 'BibTeX | 1004 | (defcustom bibtex-dialect 'BibTeX |
| 1030 | "Current BibTeX dialect. For allowed values see `bibtex-dialect-list'. | 1005 | "Current BibTeX dialect. For allowed values see `bibtex-dialect-list'. |
| 1031 | To interactively change the dialect use the command `bibtex-set-dialect'." | 1006 | To change the dialect use the command `bibtex-set-dialect'." |
| 1032 | :group 'bibtex | 1007 | :group 'bibtex |
| 1033 | :version "24.1" | 1008 | :version "24.1" |
| 1034 | :set (lambda (symbol value) | 1009 | :set (lambda (symbol value) |
| @@ -1589,8 +1564,8 @@ Set this variable before loading BibTeX mode." | |||
| 1589 | "C-c C-l" #'bibtex-url | 1564 | "C-c C-l" #'bibtex-url |
| 1590 | "C-c C-a" #'bibtex-search-entries | 1565 | "C-c C-a" #'bibtex-search-entries |
| 1591 | "C-c C-o" #'bibtex-remove-OPT-or-ALT | 1566 | "C-c C-o" #'bibtex-remove-OPT-or-ALT |
| 1592 | ;; Most below functions seem to be undefined, which makes the | 1567 | ;; Most below functions get defined by `bibtex-init-dialect', |
| 1593 | ;; byte-compiler warn if we quote them with #'. | 1568 | ;; which makes the byte-compiler warn if we quote them with #'. |
| 1594 | "C-c C-e TAB" 'bibtex-InProceedings | 1569 | "C-c C-e TAB" 'bibtex-InProceedings |
| 1595 | "C-c C-e i" 'bibtex-InCollection | 1570 | "C-c C-e i" 'bibtex-InCollection |
| 1596 | "C-c C-e I" 'bibtex-InBook | 1571 | "C-c C-e I" 'bibtex-InBook |
| @@ -1704,7 +1679,7 @@ It is an alist with elements (FIELD RULE1 RULE2 ...), | |||
| 1704 | where each RULE is (REGEXP . TO-STR).") | 1679 | where each RULE is (REGEXP . TO-STR).") |
| 1705 | 1680 | ||
| 1706 | (defvar bibtex-pop-previous-search-point nil | 1681 | (defvar bibtex-pop-previous-search-point nil |
| 1707 | "Next point where `bibtex-pop-previous' starts looking for a similar entry.") | 1682 | "Previous point where `bibtex-pop-previous' starts looking for a similar entry.") |
| 1708 | 1683 | ||
| 1709 | (defvar bibtex-pop-next-search-point nil | 1684 | (defvar bibtex-pop-next-search-point nil |
| 1710 | "Next point where `bibtex-pop-next' starts looking for a similar entry.") | 1685 | "Next point where `bibtex-pop-next' starts looking for a similar entry.") |
| @@ -2550,8 +2525,7 @@ Formats current entry according to variable `bibtex-entry-format'." | |||
| 2550 | (nth 3 entry-list))) | 2525 | (nth 3 entry-list))) |
| 2551 | opt-field-list (append (if crossref-key | 2526 | opt-field-list (append (if crossref-key |
| 2552 | (nth 3 entry-list)) | 2527 | (nth 3 entry-list)) |
| 2553 | (nth 4 entry-list) | 2528 | (nth 4 entry-list)) |
| 2554 | bibtex-user-optional-fields) | ||
| 2555 | ;; default list of fields that may appear in this entry | 2529 | ;; default list of fields that may appear in this entry |
| 2556 | default-field-list (append req-field-list opt-field-list) | 2530 | default-field-list (append req-field-list opt-field-list) |
| 2557 | ;; number of ALT fields we may find | 2531 | ;; number of ALT fields we may find |
| @@ -3658,6 +3632,10 @@ if that value is non-nil. | |||
| 3658 | (syntax-propertize-via-font-lock | 3632 | (syntax-propertize-via-font-lock |
| 3659 | bibtex-font-lock-syntactic-keywords)) | 3633 | bibtex-font-lock-syntactic-keywords)) |
| 3660 | (let ((fun (lambda () | 3634 | (let ((fun (lambda () |
| 3635 | ;; `bibtex-dialect' and the other bibtex variables listed here | ||
| 3636 | ;; may appear as file-local variables. So any variables whose | ||
| 3637 | ;; values are derived from these bibtex variables must honor | ||
| 3638 | ;; the file-local values. | ||
| 3661 | (bibtex-set-dialect) | 3639 | (bibtex-set-dialect) |
| 3662 | (setq-local comment-start bibtex-comment-start) | 3640 | (setq-local comment-start bibtex-comment-start) |
| 3663 | (setq-local comment-start-skip | 3641 | (setq-local comment-start-skip |
| @@ -3674,31 +3652,78 @@ if that value is non-nil. | |||
| 3674 | ;; commands don't bug out. | 3652 | ;; commands don't bug out. |
| 3675 | (font-lock-set-defaults)) | 3653 | (font-lock-set-defaults)) |
| 3676 | 3654 | ||
| 3655 | ;; It would be nice to process here `bibtex-include-OPTcrossref' | ||
| 3656 | ;; once and for all, so that then the variable `bibtex-entry-alist' need not | ||
| 3657 | ;; distinguish anymore between CROSSREF and OPTIONAL fields. But even if | ||
| 3658 | ;; an entry is listed in `bibtex-include-OPTcrossref', actual entries need not | ||
| 3659 | ;; use a crossref field. | ||
| 3677 | (defun bibtex-entry-alist (dialect) | 3660 | (defun bibtex-entry-alist (dialect) |
| 3678 | "Return entry-alist for DIALECT." | 3661 | "Return entry-alist for DIALECT." |
| 3679 | (let ((var (intern (format "bibtex-%s-entry-alist" dialect))) | 3662 | (cl-flet ((vfun (fmt) |
| 3680 | entry-alist) | 3663 | (let ((var (intern (format fmt dialect)))) |
| 3681 | (if (boundp var) | 3664 | (if (boundp var) |
| 3682 | (setq entry-alist (symbol-value var)) | 3665 | (symbol-value var) |
| 3683 | (user-error "BibTeX dialect `%s' undefined" dialect)) | 3666 | (user-error "BibTeX dialect `%s': `%s' undefined" |
| 3684 | (if (not (consp (nth 1 (car entry-alist)))) | 3667 | dialect var))))) |
| 3685 | ;; new format | 3668 | (let* ((main-entry-alist (vfun "bibtex-%s-entry-alist")) |
| 3686 | entry-alist | 3669 | (aux-entry-alist (vfun "bibtex-%s-aux-entry-alist")) |
| 3687 | (let (lst) | 3670 | (aux-opt-alist (append (vfun "bibtex-%s-aux-opt-alist") |
| 3688 | (dolist (entry entry-alist) | 3671 | bibtex-aux-opt-alist)) |
| 3689 | (let ((fl (nth 1 entry)) req xref opt) | 3672 | ;; For look-up put auxiliary entries before regular entries. |
| 3690 | (dolist (field (copy-tree (car fl))) | 3673 | (all-alist (append aux-entry-alist main-entry-alist)) |
| 3691 | (if (nth 3 field) (setcar (nthcdr 3 field) 0)) | 3674 | entry-alist) |
| 3692 | (if (or (not (nth 2 entry)) | 3675 | (dolist (entry (mapcar |
| 3693 | (assoc-string (car field) (car (nth 2 entry)) t)) | 3676 | ;; Expand aliases |
| 3694 | (push field req) | 3677 | (lambda (entry) |
| 3695 | (push field xref))) | 3678 | (let ((elt (nth 2 entry)) |
| 3696 | (dolist (field (nth 1 fl)) | 3679 | ref) |
| 3697 | (push field opt)) | 3680 | (cond ((listp elt) ; proper entry |
| 3698 | (push (list (car entry) nil (nreverse req) | 3681 | entry) |
| 3699 | (nreverse xref) (nreverse opt)) | 3682 | ((setq ref (assoc-string elt all-alist t)) ; alias |
| 3700 | lst))) | 3683 | (append (take 2 entry) (nthcdr 2 ref))) |
| 3701 | (nreverse lst))))) | 3684 | (t (user-error "Alias `%s' undefined" entry))))) |
| 3685 | ;; Give higher precedence to entry definitions | ||
| 3686 | ;; in aux-entry-alist. | ||
| 3687 | (reverse (append main-entry-alist aux-entry-alist)))) | ||
| 3688 | ;; Include each entry only once. | ||
| 3689 | (unless (assoc-string (car entry) entry-alist t) | ||
| 3690 | (push (if aux-opt-alist | ||
| 3691 | ;; Splice aux-opt-alist into entry (nondestructively). | ||
| 3692 | ;; Elements in aux-opt-alist take precedence over elements | ||
| 3693 | ;; in opt-alist of entry. | ||
| 3694 | (let ((aux-opt-alist aux-opt-alist)) | ||
| 3695 | (mapc (lambda (field) | ||
| 3696 | (unless (assoc-string (car field) aux-opt-alist t) | ||
| 3697 | (push field aux-opt-alist))) | ||
| 3698 | (reverse (nth 4 entry))) | ||
| 3699 | (append (take 4 entry) (list aux-opt-alist))) | ||
| 3700 | entry) | ||
| 3701 | entry-alist))) | ||
| 3702 | entry-alist))) | ||
| 3703 | |||
| 3704 | (defun bibtex-field-alist (dialect) | ||
| 3705 | "Return field-alist for DIALECT." | ||
| 3706 | ;; This function is used only once by `bibtex-set-dialect' | ||
| 3707 | ;; to set the variable `bibtex-field-alist'. | ||
| 3708 | (cl-flet ((vfun (fmt) | ||
| 3709 | (let ((var (intern (format fmt dialect)))) | ||
| 3710 | (if (boundp var) | ||
| 3711 | (symbol-value var) | ||
| 3712 | (user-error "BibTeX dialect `%s': `%s' undefined" | ||
| 3713 | dialect var))))) | ||
| 3714 | (let ((field-alist (vfun "bibtex-%s-field-alist"))) | ||
| 3715 | (cl-flet ((f-push (field) | ||
| 3716 | (unless (assoc-string (car field) field-alist t) | ||
| 3717 | (push (take 2 field) field-alist)))) | ||
| 3718 | ;; Give higher precedence to entry definitions in aux-opt-alist | ||
| 3719 | (mapc #'f-push (vfun "bibtex-%s-aux-opt-alist")) | ||
| 3720 | (mapc #'f-push bibtex-aux-opt-alist) | ||
| 3721 | (mapc (lambda (entry) | ||
| 3722 | (if (listp (nth 2 entry)) ; not an alias | ||
| 3723 | (mapc #'f-push (apply #'append (nthcdr 2 entry))))) | ||
| 3724 | (append (vfun "bibtex-%s-aux-entry-alist") | ||
| 3725 | (vfun "bibtex-%s-entry-alist"))) | ||
| 3726 | field-alist)))) | ||
| 3702 | 3727 | ||
| 3703 | (defun bibtex-set-dialect (&optional dialect local) | 3728 | (defun bibtex-set-dialect (&optional dialect local) |
| 3704 | "Select BibTeX DIALECT for editing BibTeX files. | 3729 | "Select BibTeX DIALECT for editing BibTeX files. |
| @@ -3714,106 +3739,120 @@ LOCAL is t for interactive calls." | |||
| 3714 | (mapcar #'list bibtex-dialect-list) | 3739 | (mapcar #'list bibtex-dialect-list) |
| 3715 | nil t)) | 3740 | nil t)) |
| 3716 | t)) | 3741 | t)) |
| 3717 | (let ((setfun (if (or local (local-variable-p 'bibtex-dialect)) | 3742 | (setq local (or local (local-variable-p 'bibtex-dialect))) |
| 3718 | (lambda (var val) (set (make-local-variable var) val)) | 3743 | (cl-flet ((setfun (var val) |
| 3719 | 'set))) | 3744 | (if local |
| 3720 | (if dialect (funcall setfun 'bibtex-dialect dialect)) | 3745 | (set (make-local-variable var) val) |
| 3721 | 3746 | (set var val)))) | |
| 3722 | ;; Set internal variables | 3747 | (if dialect (setfun 'bibtex-dialect dialect)) |
| 3723 | (funcall setfun 'bibtex-entry-alist (bibtex-entry-alist bibtex-dialect)) | 3748 | |
| 3724 | (funcall setfun 'bibtex-field-alist | 3749 | ;; Set internal variables. |
| 3725 | (let ((var (intern (format "bibtex-%s-field-alist" | 3750 | (setfun 'bibtex-entry-alist (bibtex-entry-alist bibtex-dialect)) |
| 3726 | bibtex-dialect)))) | 3751 | (setfun 'bibtex-field-alist (bibtex-field-alist bibtex-dialect)) |
| 3727 | (if (boundp var) | 3752 | (setfun 'bibtex-entry-type |
| 3728 | (symbol-value var) | 3753 | (concat "@[ \t]*" |
| 3729 | (user-error "Field types for BibTeX dialect `%s' undefined" | 3754 | (regexp-opt (mapcar #'car bibtex-entry-alist)))) |
| 3730 | bibtex-dialect)))) | 3755 | (setfun 'bibtex-entry-head |
| 3731 | (funcall setfun 'bibtex-entry-type | 3756 | (concat "^[ \t]*\\(" bibtex-entry-type "\\)[ \t]*[({][ \t\n]*\\(" |
| 3732 | (concat "@[ \t]*\\(?:" | 3757 | bibtex-reference-key "\\)")) |
| 3733 | (regexp-opt (mapcar #'car bibtex-entry-alist)) "\\)")) | 3758 | (setfun 'bibtex-entry-maybe-empty-head |
| 3734 | (funcall setfun 'bibtex-entry-head | 3759 | (concat bibtex-entry-head "?")) |
| 3735 | (concat "^[ \t]*\\(" bibtex-entry-type "\\)[ \t]*[({][ \t\n]*\\(" | 3760 | (setfun 'bibtex-any-valid-entry-type |
| 3736 | bibtex-reference-key "\\)")) | 3761 | (concat "^[ \t]*@[ \t]*" |
| 3737 | (funcall setfun 'bibtex-entry-maybe-empty-head | 3762 | (regexp-opt |
| 3738 | (concat bibtex-entry-head "?")) | 3763 | (append '("String" "Preamble") |
| 3739 | (funcall setfun 'bibtex-any-valid-entry-type | 3764 | (mapcar #'car bibtex-entry-alist))))) |
| 3740 | (concat "^[ \t]*@[ \t]*\\(?:" | ||
| 3741 | (regexp-opt | ||
| 3742 | (append '("String" "Preamble") | ||
| 3743 | (mapcar #'car bibtex-entry-alist))) "\\)")) | ||
| 3744 | (setq imenu-generic-expression | 3765 | (setq imenu-generic-expression |
| 3745 | (list (list nil bibtex-entry-head bibtex-key-in-head)) | 3766 | (list (list nil bibtex-entry-head bibtex-key-in-head)) |
| 3746 | imenu-case-fold-search t))) | 3767 | imenu-case-fold-search t))) |
| 3747 | 3768 | ||
| 3748 | ;; Entry commands and menus for BibTeX dialects | 3769 | (defvar bibtex-dialect-select-map |
| 3749 | ;; We do not use `easy-menu-define' here because this gets confused | 3770 | (let ((select-map (make-sparse-keymap))) |
| 3750 | ;; if we want to have multiple versions of the "same" menu. | 3771 | (dolist (dialect (reverse bibtex-dialect-list)) |
| 3751 | (let ((select-map (make-sparse-keymap))) | 3772 | (define-key |
| 3752 | ;; Submenu for selecting the dialect | 3773 | select-map (vector dialect) |
| 3753 | (dolist (dialect (reverse bibtex-dialect-list)) | 3774 | `(menu-item ,(symbol-name dialect) |
| 3754 | (define-key select-map (vector dialect) | 3775 | (lambda () (interactive) (bibtex-set-dialect ',dialect t)) |
| 3755 | `(menu-item ,(symbol-name dialect) | 3776 | :button (:radio . (eq bibtex-dialect ',dialect))))) |
| 3756 | (lambda () (interactive) (bibtex-set-dialect ',dialect t)) | 3777 | select-map) |
| 3757 | :button (:radio . (eq bibtex-dialect ',dialect))))) | 3778 | "Submenu for selecting the BibTeX dialect.") |
| 3758 | ;; We define a menu for each dialect. | 3779 | |
| 3759 | ;; Then we select the menu we want via the :visible keyword | 3780 | ;; We define a menu map for each dialect. |
| 3760 | (dolist (dialect bibtex-dialect-list) | 3781 | ;; Then we select the menu map we want via the :visible keyword |
| 3761 | (let ((entry-alist (bibtex-entry-alist dialect)) | 3782 | |
| 3762 | (menu-map (make-sparse-keymap))) | 3783 | (defun bibtex-init-dialect (dialect) |
| 3763 | (define-key menu-map [select] | 3784 | "Initialize BibTeX DIALECT. |
| 3764 | `(menu-item "BibTeX dialect" ,select-map)) | 3785 | Define commands to insert templates for the entry types of DIALECT. |
| 3765 | (define-key menu-map [nil-2] '(menu-item "--")) | 3786 | Also define a menu map for these commands." |
| 3766 | (define-key menu-map [bibtex-preamble] | 3787 | (let ((menu-map (make-sparse-keymap)) |
| 3767 | '(menu-item "Preamble" bibtex-Preamble)) | 3788 | (aux (length (symbol-value |
| 3768 | (define-key menu-map [bibtex-String] | 3789 | (intern (format "bibtex-%s-aux-entry-alist" dialect))))) |
| 3769 | '(menu-item "String" bibtex-String)) | 3790 | (cnt 0)) |
| 3770 | (define-key menu-map [nil-1] '(menu-item "--")) | 3791 | (define-key menu-map [select] |
| 3771 | (dolist (elt (reverse entry-alist)) | 3792 | `(menu-item "BibTeX dialect" ,bibtex-dialect-select-map)) |
| 3772 | ;; Entry commands | 3793 | (define-key menu-map [nil-2] '(menu-item "--")) |
| 3773 | (let* ((entry (car elt)) | 3794 | (define-key menu-map [bibtex-preamble] |
| 3774 | (fname (intern (format "bibtex-%s" entry)))) | 3795 | '(menu-item "Preamble" bibtex-Preamble)) |
| 3775 | (unless (fboundp fname) | 3796 | (define-key menu-map [bibtex-String] |
| 3776 | (defalias fname | 3797 | '(menu-item "String" bibtex-String)) |
| 3777 | (lambda () | 3798 | (define-key menu-map [nil-1] '(menu-item "--")) |
| 3778 | (:documentation | 3799 | (dolist (elt (reverse (bibtex-entry-alist dialect))) |
| 3779 | (format "Insert a template for a @%s entry; see also `bibtex-entry'." | 3800 | ;; Entry commands |
| 3780 | entry)) | 3801 | (let* ((entry (car elt)) |
| 3781 | (interactive "*") | 3802 | (fname (intern (format "bibtex-%s" entry)))) |
| 3782 | (bibtex-entry entry)))) | 3803 | (unless (fboundp fname) |
| 3783 | ;; Menu entries | 3804 | (defalias fname |
| 3784 | (define-key menu-map (vector fname) | 3805 | (lambda () |
| 3785 | `(menu-item ,(or (nth 1 elt) (car elt)) ,fname)))) | 3806 | (:documentation |
| 3786 | (define-key bibtex-mode-map | 3807 | (format "Insert a template for a @%s entry; see also `bibtex-entry'." |
| 3787 | (vector 'menu-bar dialect) | 3808 | entry)) |
| 3788 | `(menu-item "Entry-Types" ,menu-map | 3809 | (interactive "*") |
| 3789 | :visible (eq bibtex-dialect ',dialect)))))) | 3810 | (bibtex-entry entry)))) |
| 3790 | 3811 | ;; Menu entries | |
| 3791 | (defun bibtex-field-list (entry-type) | 3812 | (define-key menu-map (vector fname) |
| 3792 | "Return list of allowed fields for entry ENTRY-TYPE. | 3813 | `(menu-item ,(or (nth 1 elt) (car elt)) ,fname)) |
| 3814 | ;; Put separator between regular entries in `bibtex-DIALECT-entry-alist' | ||
| 3815 | ;; and auxiliary entries in `bibtex-DIALECT-aux-entry-alist'. | ||
| 3816 | (setq cnt (1+ cnt)) | ||
| 3817 | (if (= aux cnt) | ||
| 3818 | (define-key menu-map [nil-3] '(menu-item "--"))))) | ||
| 3819 | |||
| 3820 | ;; If we already have a menu map for DIALECT, replace it with the new one. | ||
| 3821 | (let ((km (assq 'menu-bar (cdr bibtex-mode-map)))) | ||
| 3822 | (if (and km (setq km (assq dialect (nthcdr 2 km)))) | ||
| 3823 | (setcdr (nthcdr 2 km) (list menu-map | ||
| 3824 | :visible `(eq bibtex-dialect ',dialect))) | ||
| 3825 | (define-key bibtex-mode-map | ||
| 3826 | (vector 'menu-bar dialect) | ||
| 3827 | `(menu-item "Entry-Types" ,menu-map | ||
| 3828 | :visible (eq bibtex-dialect ',dialect))))))) | ||
| 3829 | |||
| 3830 | ;; Initialize BibTeX dialects. | ||
| 3831 | (mapc #'bibtex-init-dialect bibtex-dialect-list) | ||
| 3832 | |||
| 3833 | (defun bibtex-field-list (entry) | ||
| 3834 | "Return list of allowed fields for entry ENTRY. | ||
| 3793 | More specifically, the return value is a cons pair (REQUIRED . OPTIONAL), | 3835 | More specifically, the return value is a cons pair (REQUIRED . OPTIONAL), |
| 3794 | where REQUIRED and OPTIONAL are lists of the required and optional field | 3836 | where REQUIRED and OPTIONAL are lists of the required and optional field |
| 3795 | names for ENTRY-TYPE according to `bibtex-BibTeX-entry-alist' and friends, | 3837 | names for ENTRY according to `bibtex-BibTeX-entry-alist' and friends, |
| 3796 | `bibtex-include-OPTkey', `bibtex-include-OPTcrossref', | 3838 | and `bibtex-include-OPTcrossref'." |
| 3797 | and `bibtex-user-optional-fields'." | 3839 | (let* ((e-list (assoc-string entry bibtex-entry-alist t)) |
| 3798 | (let ((e-list (assoc-string entry-type bibtex-entry-alist t)) | 3840 | (_ (unless e-list |
| 3799 | required optional) | 3841 | (user-error "Fields for BibTeX entry type %s not defined" entry))) |
| 3800 | (unless e-list | 3842 | (crossref (member-ignore-case entry bibtex-include-OPTcrossref)) |
| 3801 | (user-error "Fields for BibTeX entry type %s not defined" entry-type)) | 3843 | (required (if crossref (nth 2 e-list) |
| 3802 | (if (member-ignore-case entry-type bibtex-include-OPTcrossref) | 3844 | (append (nth 2 e-list) (nth 3 e-list)))) |
| 3803 | (setq required (nth 2 e-list) | 3845 | (optional (if crossref |
| 3804 | optional (append (nth 3 e-list) (nth 4 e-list))) | 3846 | (append '(("crossref")) (nth 3 e-list) (nth 4 e-list)) |
| 3805 | (setq required (append (nth 2 e-list) (nth 3 e-list)) | 3847 | (nth 4 e-list)))) |
| 3806 | optional (nth 4 e-list))) | 3848 | ;; The following clause can be removed when the obsolete variable |
| 3807 | (if bibtex-include-OPTkey | 3849 | ;; `bibtex-include-OPTkey' will be removed. |
| 3808 | (push (list "key" "Used as label with certain BibTeX styles" | 3850 | (if (and bibtex-include-OPTkey (not (assoc-string "key" optional t))) |
| 3851 | (push (list "key" nil | ||
| 3809 | (if (or (stringp bibtex-include-OPTkey) | 3852 | (if (or (stringp bibtex-include-OPTkey) |
| 3810 | (functionp bibtex-include-OPTkey)) | 3853 | (functionp bibtex-include-OPTkey)) |
| 3811 | bibtex-include-OPTkey)) | 3854 | bibtex-include-OPTkey)) |
| 3812 | optional)) | 3855 | optional)) |
| 3813 | (if (member-ignore-case entry-type bibtex-include-OPTcrossref) | ||
| 3814 | (push '("crossref" "Reference key of the cross-referenced entry") | ||
| 3815 | optional)) | ||
| 3816 | (setq optional (append optional bibtex-user-optional-fields)) | ||
| 3817 | (cons (bibtex--skip-field-aliases required) | 3856 | (cons (bibtex--skip-field-aliases required) |
| 3818 | (bibtex--skip-field-aliases optional)))) | 3857 | (bibtex--skip-field-aliases optional)))) |
| 3819 | 3858 | ||
| @@ -3823,7 +3862,7 @@ Aliases are fields for which the element ALTERNATIVE is a negative number, | |||
| 3823 | see `bibtex-BibTeX-entry-alist'. The shortened field list is used | 3862 | see `bibtex-BibTeX-entry-alist'. The shortened field list is used |
| 3824 | for the templates of `bibtex-entry', whereas entry validation performed by | 3863 | for the templates of `bibtex-entry', whereas entry validation performed by |
| 3825 | `bibtex-format-entry' uses the full list of fields for an entry." | 3864 | `bibtex-format-entry' uses the full list of fields for an entry." |
| 3826 | ;; FIXME: `bibtex-entry' and `bibtex-format-entry' handle aliases | 3865 | ;; FIXME: `bibtex-entry' and `bibtex-format-entry' handle field aliases |
| 3827 | ;; under the hood in a manner that is largely invisible to users. | 3866 | ;; under the hood in a manner that is largely invisible to users. |
| 3828 | ;; If instead one wanted to display the aliases as alternatives | 3867 | ;; If instead one wanted to display the aliases as alternatives |
| 3829 | ;; in the usual way, field names may get both the ALT and the OPT prefix. | 3868 | ;; in the usual way, field names may get both the ALT and the OPT prefix. |
| @@ -4024,13 +4063,13 @@ interactive calls." | |||
| 4024 | (bibtex-beginning-of-entry) | 4063 | (bibtex-beginning-of-entry) |
| 4025 | (looking-at bibtex-entry-maybe-empty-head) | 4064 | (looking-at bibtex-entry-maybe-empty-head) |
| 4026 | (bibtex-type-in-head))) | 4065 | (bibtex-type-in-head))) |
| 4027 | (field-list (bibtex-field-list type)) | 4066 | (field-list (bibtex-field-list type))) |
| 4028 | (comment (assoc-string field (append (car field-list) | 4067 | (message "%s" (or (nth 1 (assoc-string field |
| 4029 | (cdr field-list)) t))) | 4068 | (append (car field-list) |
| 4030 | (message "%s" (cond ((nth 1 comment) (nth 1 comment)) | 4069 | (cdr field-list)) |
| 4031 | ((setq comment (assoc-string field bibtex-field-alist t)) | 4070 | t)) |
| 4032 | (nth 1 comment)) | 4071 | (nth 1 (assoc-string field bibtex-field-alist t)) |
| 4033 | (t "No comment available")))))) | 4072 | "No comment available"))))) |
| 4034 | 4073 | ||
| 4035 | (defun bibtex-make-field (field &optional move interactive nodelim) | 4074 | (defun bibtex-make-field (field &optional move interactive nodelim) |
| 4036 | "Make a field named FIELD in current BibTeX entry. | 4075 | "Make a field named FIELD in current BibTeX entry. |
| @@ -4593,8 +4632,7 @@ Return t if test was successful, nil otherwise." | |||
| 4593 | (unless crossref | 4632 | (unless crossref |
| 4594 | (copy-sequence (nth 3 entry-list))))) | 4633 | (copy-sequence (nth 3 entry-list))))) |
| 4595 | (opt (append (if crossref (nth 3 entry-list)) | 4634 | (opt (append (if crossref (nth 3 entry-list)) |
| 4596 | (nth 4 entry-list) | 4635 | (nth 4 entry-list))) |
| 4597 | bibtex-user-optional-fields)) | ||
| 4598 | (default (append req opt)) | 4636 | (default (append req opt)) |
| 4599 | (num-alt (let ((n 0)) | 4637 | (num-alt (let ((n 0)) |
| 4600 | (mapc (lambda (x) | 4638 | (mapc (lambda (x) |
| @@ -5335,6 +5373,8 @@ entries from minibuffer." | |||
| 5335 | (message "Buffer is now parsable. Please save it."))) | 5373 | (message "Buffer is now parsable. Please save it."))) |
| 5336 | 5374 | ||
| 5337 | (defun bibtex-completion-at-point-function () | 5375 | (defun bibtex-completion-at-point-function () |
| 5376 | "Compute completion data for BibTeX mode. | ||
| 5377 | For use with `completion-at-point-functions'." | ||
| 5338 | (let ((pnt (point)) | 5378 | (let ((pnt (point)) |
| 5339 | (case-fold-search t) | 5379 | (case-fold-search t) |
| 5340 | (beg (save-excursion | 5380 | (beg (save-excursion |
| @@ -5572,14 +5612,7 @@ A prefix arg negates the value of `bibtex-search-entry-globally'. | |||
| 5572 | Return alist with elements (KEY FILE ENTRY), | 5612 | Return alist with elements (KEY FILE ENTRY), |
| 5573 | where FILE is the BibTeX file of ENTRY." | 5613 | where FILE is the BibTeX file of ENTRY." |
| 5574 | (interactive | 5614 | (interactive |
| 5575 | (list (completing-read | 5615 | (list (completing-read "Field: " bibtex-field-alist nil t) |
| 5576 | "Field: " | ||
| 5577 | (delete-dups | ||
| 5578 | (apply #'append | ||
| 5579 | bibtex-user-optional-fields | ||
| 5580 | (mapcar (lambda (x) (mapcar #'car (apply #'append (nthcdr 2 x)))) | ||
| 5581 | bibtex-entry-alist))) | ||
| 5582 | nil t) | ||
| 5583 | (read-string "Regexp: ") | 5616 | (read-string "Regexp: ") |
| 5584 | (if bibtex-search-entry-globally | 5617 | (if bibtex-search-entry-globally |
| 5585 | (not current-prefix-arg) | 5618 | (not current-prefix-arg) |