annotate lisp/textmodes/bibtex.el @ 14287:6cf50a9ff10f

(find-file-noselect): Fix error message style.
author Karl Heuer <kwzh@gnu.org>
date Wed, 24 Jan 1996 23:25:44 +0000
parents 649ead749232
children 1ae071abac0f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;; bibtex.el --- BibTeX mode for GNU Emacs
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
11373
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
3 ;; Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
4
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
5 ;; Author: Stefan Schoef <schoef@informatik.uni-oldenburg.de>
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
6 ;; Bengt Martensson <ubrinf!mond!bengt>
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
7 ;; Mark Shapiro <shapiro@corto.inria.fr>
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
8 ;; Mike Newton <newton@gumby.cs.caltech.edu>
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
9 ;; Aaron Larson <alarson@src.honeywell.com>
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
10 ;; Maintainer: Stefan Schoef <schoef@informatik.uni-oldenburg.de>
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
11 ;; Keywords: BibTeX, LaTeX, TeX
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
12
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;; This file is part of GNU Emacs.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; it under the terms of the GNU General Public License as published by
1851
b3ce1eae3eb0 Update GPL version.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
17 ;; the Free Software Foundation; either version 2, or (at your option)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; any later version.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; GNU Emacs is distributed in the hope that it will be useful,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 ;; GNU General Public License for more details.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13968
diff changeset
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13968
diff changeset
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13968
diff changeset
28 ;; Boston, MA 02111-1307, USA.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
30 ;;; Commentary:
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13968
diff changeset
31
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
32 ;; Major mode for editing and validating BibTeX files.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
34 ;; Usage:
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
35 ;; See documentation for function bibtex-mode (or type "\M-x describe-mode"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
36 ;; when you are in bibtex-mode).
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
37
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
38 ;; Todo:
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
39 ;; Distribute texinfo file.
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
40
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
41 ;; Known Bugs:
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
42 ;; 1. using regular expressions to match the entire BibTeX entry dies
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
43 ;; on long entries (e.g. those containing abstracts) since
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
44 ;; the length of regular expression matches is fairly limited.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
45 ;; 2. Calling bibtex-find-text in a string entry results in the
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
46 ;; error message "Can't find enclosing Bibtex field" instead of
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
47 ;; moving to the empty string. [reported by gernot@cs.unsw.oz.au]
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
48 ;; 3. Quotes inside quote-parenthesized fields (like
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
49 ;; `author = "Stefan Sch{\"o}f"') break bibtex-validate-buffer.
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
50 ;; Further, you must use braces here, if you want to set
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
51 ;; bibtex-maintain-sorted-entries to a non-nil value.
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
52
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
53 ;; (current keeper: schoef@informatik.uni-oldenburg.de
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
54 ;; previous: alarson@src.honeywell.com)
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
55
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
56 ;;; Code:
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13968
diff changeset
57
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
58 ;; User Options:
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
59
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
60 (defvar bibtex-field-left-delimiter "{"
11373
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
61 "*Set this to { or \" according to your personal preferences.
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
62 This variable is buffer local.")
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
63 (make-variable-buffer-local 'bibtex-field-left-delimiter)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
64
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
65 (defvar bibtex-field-right-delimiter "}"
11373
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
66 "*Set this to } or \" according to your personal preferences.
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
67 This variable is buffer local.")
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
68 (make-variable-buffer-local 'bibtex-field-right-delimiter)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
69
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
70 (defvar bibtex-include-OPTcrossref '("InProceedings" "InCollection")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
71 "*All entries listed here will have an OPTcrossref field.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
72
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
73 (defvar bibtex-include-OPTkey t
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
74 "*If non-nil, all entries will have an OPTkey field.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
75
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
76 (defvar bibtex-include-OPTannote t
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
77 "*If non-nil, all entries will have an OPTannote field.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
78
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
79 (defvar bibtex-mode-user-optional-fields nil
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
80 "*List of optional fields the user wants to have always present.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
81 Entries should be lists of strings with two elements (first element =
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
82 name of the field, second element = comment to appear in the echo area).")
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (defvar bibtex-clean-entry-zap-empty-opts t
561
a819dc25b9e7 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 257
diff changeset
85 "*If non-nil, bibtex-clean-entry will delete all empty optional fields.")
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
86
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
87 (defvar bibtex-sort-ignore-string-entries t
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
88 "*If non-nil, BibTeX @STRING entries are not sort-significant.
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
89 That means they are ignored when determining ordering of the buffer
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
90 (e.g. sorting, locating alphabetical position for new entries, etc.).
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
91 This variable is buffer local.")
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
92 (make-variable-buffer-local 'bibtex-sort-ignore-string-entries)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
93
12770
5488d9efa7de (bibtex-maintain-sorted-entries): Make nil the default.
Richard M. Stallman <rms@gnu.org>
parents: 12700
diff changeset
94 (defvar bibtex-maintain-sorted-entries nil
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
95 "*If non-nil, bibtex-mode maintains all BibTeX entries in sorted order.
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
96 Setting this variable to nil will strip off some comfort (e.g. TAB
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
97 completion for reference keys in minibuffer, automatic detection of
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
98 duplicates) from bibtex-mode. See also bibtex-sort-ignore-string-entries.
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
99 This variable is buffer local.")
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
100 (make-variable-buffer-local 'bibtex-maintain-sorted-entries)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
101
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
102 (defvar bibtex-entry-field-alist
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
103 '(
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
104 ("Article" . (((("author" "Author1 [and Author2 ...] [and others]")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
105 ("title" "Title of the article (BibTeX converts it to lowercase)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
106 ("journal" "Name of the journal (use string, remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
107 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
108 (("volume" "Volume of the journal")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
109 ("number" "Number of the journal")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
110 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
111 ("pages" "Pages in the journal")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
112 ("note" "Remarks to be put at the end of the \\bibitem")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
113 ((("author" "Author1 [and Author2 ...] [and others]")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
114 ("title" "Title of the article (BibTeX converts it to lowercase)"))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
115 (("journal" "Name of the journal (use string, remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
116 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
117 ("volume" "Volume of the journal")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
118 ("number" "Number of the journal")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
119 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
120 ("pages" "Pages in the journal")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
121 ("note" "Remarks to be put at the end of the \\bibitem")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
122 ("Book" . (((("author" "Author1 [and Author2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
123 ("title" "Title of the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
124 ("publisher" "Publishing company")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
125 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
126 (("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
127 ("volume" "Volume of the book in the series")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
128 ("number" "Number of the book in a small series (overwritten by volume)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
129 ("series" "Series in which the book appeared")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
130 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
131 ("edition" "Edition of the book as a capitalized English word")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
132 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
133 ("note" "Remarks to be put at the end of the \\bibitem")))))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
134 ("Booklet" . (((("title" "Title of the booklet (BibTeX converts it to lowercase)"))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
135 (("author" "Author1 [and Author2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
136 ("howpublished" "The way in which the booklet was published")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
137 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
138 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
139 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
140 ("note" "Remarks to be put at the end of the \\bibitem")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
141 ("InBook" . (((("author" "Author1 [and Author2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
142 ("title" "Title of the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
143 ("chapter" "Chapter in the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
144 ("publisher" "Publishing company")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
145 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
146 (("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
147 ("volume" "Volume of the book in the series")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
148 ("number" "Number of the book in a small series (overwritten by volume)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
149 ("series" "Series in which the book appeared")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
150 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
151 ("edition" "Edition of the book as a capitalized English word")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
152 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
153 ("pages" "Pages in the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
154 ("type" "Word to use instead of \"chapter\"")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
155 ("note" "Remarks to be put at the end of the \\bibitem")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
156 ((("author" "Author1 [and Author2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
157 ("title" "Title of the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
158 ("chapter" "Chapter in the book"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
159 (("publisher" "Publishing company")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
160 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
161 ("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
162 ("volume" "Volume of the book in the series")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
163 ("number" "Number of the book in a small series (overwritten by volume)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
164 ("series" "Series in which the book appeared")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
165 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
166 ("edition" "Edition of the book as a capitalized English word")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
167 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
168 ("pages" "Pages in the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
169 ("type" "Word to use instead of \"chapter\"")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
170 ("note" "Remarks to be put at the end of the \\bibitem")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
171 ("InCollection" . (((("author" "Author1 [and Author2 ...] [and others]")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
172 ("title" "Title of the article in book (BibTeX converts it to lowercase)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
173 ("booktitle" "Name of the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
174 ("publisher" "Publishing company")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
175 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
176 (("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
177 ("volume" "Volume of the book in the series")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
178 ("number" "Number of the book in a small series (overwritten by volume)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
179 ("series" "Series in which the book appeared")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
180 ("chapter" "Chapter in the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
181 ("type" "Word to use instead of \"chapter\"")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
182 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
183 ("edition" "Edition of the book as a capitalized English word")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
184 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
185 ("pages" "Pages in the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
186 ("note" "Remarks to be put at the end of the \\bibitem")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
187 ((("author" "Author1 [and Author2 ...] [and others]")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
188 ("title" "Title of the article in book (BibTeX converts it to lowercase)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
189 ("booktitle" "Name of the book"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
190 (("publisher" "Publishing company")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
191 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
192 ("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
193 ("volume" "Volume of the book in the series")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
194 ("number" "Number of the book in a small series (overwritten by volume)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
195 ("series" "Series in which the book appeared")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
196 ("chapter" "Chapter in the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
197 ("type" "Word to use instead of \"chapter\"")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
198 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
199 ("edition" "Edition of the book as a capitalized English word")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
200 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
201 ("pages" "Pages in the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
202 ("note" "Remarks to be put at the end of the \\bibitem")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
203 ("InProceedings" . (((("author" "Author1 [and Author2 ...] [and others]")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
204 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
205 ("booktitle" "Name of the conference proceedings")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
206 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
207 (("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
208 ("volume" "Volume of the conference proceedings in the series")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
209 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
210 ("series" "Series in which the conference proceedings appeared")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
211 ("organization" "Sponsoring organization of the conference")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
212 ("publisher" "Publishing company, its location")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
213 ("address" "Location of the Proceedings")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
214 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
215 ("pages" "Pages in the conference proceedings")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
216 ("note" "Remarks to be put at the end of the \\bibitem")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
217 ((("author" "Author1 [and Author2 ...] [and others]")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
218 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
219 ("booktitle" "Name of the conference proceedings"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
220 (("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
221 ("volume" "Volume of the conference proceedings in the series")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
222 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
223 ("series" "Series in which the conference proceedings appeared")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
224 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
225 ("organization" "Sponsoring organization of the conference")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
226 ("publisher" "Publishing company, its location")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
227 ("address" "Location of the Proceedings")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
228 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
229 ("pages" "Pages in the conference proceedings")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
230 ("note" "Remarks to be put at the end of the \\bibitem")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
231 ("Manual" . (((("title" "Title of the manual"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
232 (("author" "Author1 [and Author2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
233 ("organization" "Publishing organization of the manual")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
234 ("address" "Address of the organization")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
235 ("edition" "Edition of the manual as a capitalized English word")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
236 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
237 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
238 ("note" "Remarks to be put at the end of the \\bibitem")))))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
240 ("MastersThesis" . (((("author" "Author1 [and Author2 ...] [and others]")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
241 ("title" "Title of the master\'s thesis (BibTeX converts it to lowercase)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
242 ("school" "School where the master\'s thesis was written")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
243 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
244 (("address" "Address of the school (if not part of field \"school\") or country")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
245 ("type" "Type of the master\'s thesis")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
246 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
247 ("note" "Remarks to be put at the end of the \\bibitem")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
248 ("Misc" . ((()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
249 (("author" "Author1 [and Author2 ...] [and others]")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
250 ("title" "Title of the reference (BibTeX converts it to lowercase)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
251 ("howpublished" "The way in which the reference was published")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
252 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
253 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
254 ("note" "Remarks to be put at the end of the \\bibitem")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
255 ("PhdThesis" . (((("author" "Author1 [and Author2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
256 ("title" "Title of the PhD. thesis")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
257 ("school" "School where the PhD. thesis was written")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
258 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
259 (("address" "Address of the school (if not part of field \"school\") or country")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
260 ("type" "Type of the PhD. thesis")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
261 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
262 ("note" "Remarks to be put at the end of the \\bibitem")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
263 ("Proceedings" . (((("title" "Title of the conference proceedings")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
264 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
265 (("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
266 ("volume" "Volume of the conference proceedings in the series")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
267 ("number" "Number of the conference proceedings in a small series (overwritten by volume)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
268 ("series" "Series in which the conference proceedings appeared")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
269 ("publisher" "Publishing company, its location")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
270 ("organization" "Sponsoring organization of the conference")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
271 ("address" "Location of the Proceedings")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
272 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
273 ("note" "Remarks to be put at the end of the \\bibitem")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
274 ("TechReport" . (((("author" "Author1 [and Author2 ...] [and others]")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
275 ("title" "Title of the technical report (BibTeX converts it to lowercase)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
276 ("institution" "Sponsoring institution of the report")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
277 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
278 (("type" "Type of the report (if other than \"technical report\")")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
279 ("number" "Number of the technical report")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
280 ("address" "Address of the institution (if not part of field \"institution\") or country")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
281 ("month" "Month of the publication as a string (remove braces)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
282 ("note" "Remarks to be put at the end of the \\bibitem")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
283 ("Unpublished" . (((("author" "Author1 [and Author2 ...] [and others]")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
284 ("title" "Title of the unpublished reference (BibTeX converts it to lowercase)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
285 ("note" "Remarks to be put at the end of the \\bibitem"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
286 (("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
287 ("month" "Month of the publication as a string (remove braces)")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
288 )
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
289
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
290 "Defines reference types and their associated fields.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
291 List of
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
292 (entry-name (required optional) (crossref-required crossref-optional))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
293 triples.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
294 If the third element is nil, the first pair is always to be used.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
295 If not, the second pair is to be used in the case of presence of a
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
296 crossref field and the third in the case of absence.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
297 Required , optional, crossref-required and crossref-optional are lists.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
298 Each element of these lists is a list of strings with two elements
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
299 (first element = name of the field,
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
300 second element = comment to appear in the echo area).")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
301
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
302 (defvar bibtex-predefined-strings
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
303 '(
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
304 ("jan") ("feb") ("mar") ("apr") ("may") ("jun") ("jul") ("aug")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
305 ("sep") ("oct") ("nov") ("dec")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
306 ("acmcs") ("acta") ("cacm") ("ibmjrd") ("ibmsj") ("ieeese")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
307 ("ieeetc") ("ieeetcad") ("ipl") ("jacm") ("jcss") ("scp")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
308 ("sicomp") ("tcs") ("tocs") ("tods") ("tog") ("toms") ("toois")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
309 ("toplas")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
310 )
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
311 "Alist of string definitions.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
312 Should contain the strings defined in the BibTeX style files. Each
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
313 element is a list with just one element: the string.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
314
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
315 (defvar bibtex-string-files nil
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
316 "*List of BibTeX files containing string definitions.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
317 Those files must be specified using pathnames relative to the
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
318 directories specified in $BIBINPUTS. This variable is only evaluated
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
319 when bibtex-mode is entered (i. e. when loading the BibTeX file).")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
320
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
321 (defvar bibtex-help-message t
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
322 "*If not nil print help messages in the echo area on entering a new field.")
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
323
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
324 (defvar bibtex-autokey-names 1
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
325 "*Number of names to use for the automatically generated reference key.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
326 If this is set to anything but a number, all names are used.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
327 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
328
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
329 (defvar bibtex-autokey-name-change-strings
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
330 '(("\\\\\\\"a" "ae") ("\\\\\\\"o" "oe") ("\\\\\\\"u" "ue")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
331 ("\\\\\\\"s" "ss")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
332 ("\\\\\\\"A" "Ae") ("\\\\\\\"O" "Oe") ("\\\\\\\"U" "Ue")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
333 ("{" "") ("}" ""))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
334 "Alist of (old-regexp new-string) pairs.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
335 Any part of name matching a old-regexp is replaced by new-string.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
336 Case of the old-regexp is significant. All regexps are tried in the
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
337 order in which they appear in the list, so be sure to avoid recursion here.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
338 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
339
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
340 (defvar bibtex-autokey-name-length 'infty
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
341 "*Number of characters from name to incorporate into key.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
342 If this is set to anything but a number, all characters are used.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
343 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
344
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
345 (defvar bibtex-autokey-name-separator ""
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
346 "*String that comes between any two names in the key.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
347 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
348
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
349 (defvar bibtex-autokey-year-length 2
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
350 "*Number of rightmost digits from the year field yo incorporate into key.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
351 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
352
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
353 (defvar bibtex-autokey-titlewords 5
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
354 "*Number of title words to use for the automatically generated reference key.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
355 If this is set to anything but a number, all title words are used.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
356 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
357
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
358 (defvar bibtex-autokey-title-terminators
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
359 '("\\." "!" "\\?" ":" ";" "---")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
360 "*Regexp list defining the termination of the main part of the title.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
361 Case of the regexps is ignored.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
362 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
363
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
364 (defvar bibtex-autokey-titlewords-stretch 2
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
365 "*Number of words that can additionally be used from the title.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
366 These words are used only, if a sentence from the title can be ended then.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
367 See the documentation of function bibtex-generate-autokey for further detail.")
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
368
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
369 (defvar bibtex-autokey-titleword-first-ignore
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
370 '("a" "an" "on" "the" "eine?" "der" "die" "das")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
371 "*Determines words that may begin a title but are not to be used in the key.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
372 Each item of the list is a regexp. If the first word of the title matchs a
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
373 regexp from that list, it is not included in the title, even if it is
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
374 capitalized. Regexps in the list must be entered using lowercase letters.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
375
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
376 (defvar bibtex-autokey-titleword-abbrevs nil
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
377 "*Determines exceptions to the usual abbreviation mechanism.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
378 A list of (old-regexp new-string) pairs.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
379 Use all lowercase letters for old-regexp.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
380 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
381
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
382 (defvar bibtex-autokey-titleword-change-strings
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
383 '(("\\\\\\\"a" "ae") ("\\\\\\\"o" "oe") ("\\\\\\\"u" "ue")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
384 ("\\\\\\\"s" "ss")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
385 ("\\\\\\\"A" "Ae") ("\\\\\\\"O" "Oe") ("\\\\\\\"U" "Ue")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
386 ("{" "") ("}" ""))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
387 "Alist of (old-regexp new-string) pairs.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
388 Any part of title word matching a old-regexp is replaced by new-string.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
389 Case of the old-regexp is significant.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
390 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
391
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
392 (defvar bibtex-autokey-titleword-length 5
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
393 "*Number of characters from title words to incorporate into key.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
394 If this is set to anything but a number, all characters are used.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
395 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
396
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
397 (defvar bibtex-autokey-titleword-separator "_"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
398 "*String to be put between the title words.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
399 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
400
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
401 (defvar bibtex-autokey-name-year-separator ""
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
402 "*String to be put between name part and year part of key.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
403 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
404
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
405 (defvar bibtex-autokey-year-title-separator ":_"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
406 "*String to be put between name part and year part of key.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
407 See the documentation of function bibtex-generate-autokey for further detail.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
408
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
409 (defvar bibtex-autokey-edit-before-use t
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
410 "*If non-nil, user is allowed to edit the generated key before it is used.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
411
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
412 (defvar bibtex-font-lock-keywords
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
413 (list
14193
649ead749232 (bibtex-font-lock-keywords, bibtex-mode):
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
414 '("\\(^@\\sw+\\)[ \t]*[({][ \t]*\\([^ \t\n,]*\\)"
649ead749232 (bibtex-font-lock-keywords, bibtex-mode):
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
415 (1 font-lock-keyword-face) (2 font-lock-reference-face))
649ead749232 (bibtex-font-lock-keywords, bibtex-mode):
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
416 ;; reference type and reference label
649ead749232 (bibtex-font-lock-keywords, bibtex-mode):
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
417 '("^[ \t]*\\(OPT\\sw+\\)[ \t]*="
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
418 1 font-lock-comment-face)
14193
649ead749232 (bibtex-font-lock-keywords, bibtex-mode):
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
419 ;; optional field names (treated as comments)
649ead749232 (bibtex-font-lock-keywords, bibtex-mode):
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
420 '("^[ \t]*\\(\\sw+\\)[ \t]*="
649ead749232 (bibtex-font-lock-keywords, bibtex-mode):
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
421 1 font-lock-variable-name-face)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
422 ;; field names
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
423 )
14193
649ead749232 (bibtex-font-lock-keywords, bibtex-mode):
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
424 "*Default expressions to highlight in BibTeX mode.")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
425
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
426 ;; Syntax Table, Keybindings and BibTeX Entry List
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
427 (defvar bibtex-mode-syntax-table
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
428 (let ((st (make-syntax-table)))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
429 ;; [alarson:19920214.1004CST] make double quote a string quote
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
430 (modify-syntax-entry ?\" "\"" st)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
431 (modify-syntax-entry ?$ "$$ " st)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
432 (modify-syntax-entry ?% "< " st)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
433 (modify-syntax-entry ?' "w " st)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
434 (modify-syntax-entry ?@ "w " st)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
435 (modify-syntax-entry ?\\ "\\" st)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
436 (modify-syntax-entry ?\f "> " st)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
437 (modify-syntax-entry ?\n "> " st)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
438 (modify-syntax-entry ?~ " " st)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
439 st))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
440
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
441 (defvar bibtex-mode-map
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
442 (let ((km (make-sparse-keymap)))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
443
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
444 (define-key km "\t" 'bibtex-find-text)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
445 (define-key km "\n" 'bibtex-next-field)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
446 (define-key km "\M-\t" 'bibtex-complete-string)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
447 (define-key km "\C-c\"" 'bibtex-remove-double-quotes-or-braces)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
448 (define-key km "\C-c{" 'bibtex-remove-double-quotes-or-braces)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
449 (define-key km "\C-c}" 'bibtex-remove-double-quotes-or-braces)
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
450 (define-key km "\C-c\C-c" 'bibtex-clean-entry)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
451 (define-key km "\C-c?" 'bibtex-print-help-message)
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
452 (define-key km "\C-c\C-p" 'bibtex-pop-previous)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
453 (define-key km "\C-c\C-n" 'bibtex-pop-next)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
454 (define-key km "\C-c\C-k" 'bibtex-kill-optional-field)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
455 (define-key km "\C-c\C-d" 'bibtex-empty-field)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
456 (define-key km "\C-c$" 'bibtex-ispell-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
457 (define-key km "\M-\C-a" 'bibtex-beginning-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
458 (define-key km "\M-\C-e" 'bibtex-end-of-entry)
4611
5495e1a7a79c (bibtex-mode-map): Change C-c e to C-c C-b.
Richard M. Stallman <rms@gnu.org>
parents: 3618
diff changeset
459 (define-key km "\C-c\C-b" 'bibtex-entry)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
460 (define-key km "\C-c\C-q" 'bibtex-hide-entry-bodies)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
461 (define-key km "\C-c\C-rn" 'bibtex-narrow-to-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
462 (define-key km "\C-c\C-rw" 'widen)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
463 (define-key km "\C-c\C-o" 'bibtex-remove-OPT)
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
464
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
465 (define-key km "\C-c\C-e\C-i" 'bibtex-InProceedings)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
466 (define-key km "\C-c\C-ei" 'bibtex-InCollection)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
467 (define-key km "\C-c\C-eI" 'bibtex-InBook)
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
468 (define-key km "\C-c\C-e\C-a" 'bibtex-Article)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
469 (define-key km "\C-c\C-e\C-b" 'bibtex-InBook)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
470 (define-key km "\C-c\C-eb" 'bibtex-Book)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
471 (define-key km "\C-c\C-eB" 'bibtex-Booklet)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
472 (define-key km "\C-c\C-e\C-c" 'bibtex-InCollection)
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
473 (define-key km "\C-c\C-e\C-m" 'bibtex-Manual)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
474 (define-key km "\C-c\C-em" 'bibtex-MastersThesis)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
475 (define-key km "\C-c\C-eM" 'bibtex-Misc)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
476 (define-key km "\C-c\C-e\C-p" 'bibtex-InProceedings)
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
477 (define-key km "\C-c\C-ep" 'bibtex-Proceedings)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
478 (define-key km "\C-c\C-eP" 'bibtex-PhdThesis)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
479 (define-key km "\C-c\C-e\M-p" 'bibtex-preamble)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
480 (define-key km "\C-c\C-e\C-s" 'bibtex-string)
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
481 (define-key km "\C-c\C-e\C-t" 'bibtex-TechReport)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
482 (define-key km "\C-c\C-e\C-u" 'bibtex-Unpublished)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
483 km))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
484
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
485 (define-key bibtex-mode-map [menu-bar bibtex-edit]
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
486 (cons "BibTeX-Edit" (make-sparse-keymap "BibTeX-Edit")))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
487 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-print-help-message]
12028
f667b7adde92 (bibtex-mode-map): Fix capitalization in menu bar.
Karl Heuer <kwzh@gnu.org>
parents: 11373
diff changeset
488 '("Help about Current Field" . bibtex-print-help-message))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
489 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-complete-string]
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
490 '("String Complete" . bibtex-complete-string))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
491 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-next-field]
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
492 '("Next Field" . bibtex-next-field))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
493 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-find-text]
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
494 '("End of Field" . bibtex-find-text))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
495 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-pop-previous]
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
496 '("Snatch from Similar Preceding Field" . bibtex-pop-previous))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
497 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-pop-next]
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
498 '("Snatch from Similar Following Field" . bibtex-pop-next))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
499 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-remove-OPT]
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
500 '("Remove OPT" . bibtex-remove-OPT))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
501 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-remove-double-quotes-or-braces]
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
502 '("Remove Quotes or Braces" . bibtex-remove-double-quotes-or-braces))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
503 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-clean-entry]
12028
f667b7adde92 (bibtex-mode-map): Fix capitalization in menu bar.
Karl Heuer <kwzh@gnu.org>
parents: 11373
diff changeset
504 '("Clean Up Entry" . bibtex-clean-entry))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
505 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-sort-entries]
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
506 '("Sort Entries" . bibtex-sort-entries))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
507 (define-key bibtex-mode-map [menu-bar bibtex-edit bibtex-validate-buffer]
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
508 '("Validate Entries" . bibtex-validate-buffer))
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
509
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
510 (define-key bibtex-mode-map [menu-bar entry-types]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
511 (cons "Entry-Types" (make-sparse-keymap "Entry-Types")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
512 (define-key bibtex-mode-map [menu-bar entry-types bibtex-preamble]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
513 '("Preamble" . bibtex-preamble))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
514 (define-key bibtex-mode-map [menu-bar entry-types bibtex-string]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
515 '("String" . bibtex-string))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
516 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Misc]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
517 '("Miscellaneous" . bibtex-Misc))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
518 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Unpublished]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
519 '("Unpublished" . bibtex-Unpublished))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
520 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Manual]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
521 '("Technical Manual" . bibtex-Manual))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
522 (define-key bibtex-mode-map [menu-bar entry-types bibtex-TechReport]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
523 '("Technical Report" . bibtex-TechReport))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
524 (define-key bibtex-mode-map [menu-bar entry-types bibtex-MastersThesis]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
525 '("Master's Thesis" . bibtex-MastersThesis))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
526 (define-key bibtex-mode-map [menu-bar entry-types bibtex-PhdThesis]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
527 '("PhD. Thesis" . bibtex-PhdThesis))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
528 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Booklet]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
529 '("Booklet (Bound, but no Publisher/Institution)" . bibtex-Booklet))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
530 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Book]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
531 '("Book" . bibtex-Book))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
532 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Proceedings]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
533 '("Conference Proceedings" . bibtex-Proceedings))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
534 (define-key bibtex-mode-map [menu-bar entry-types bibtex-InBook]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
535 '("Chapter or Pages in a Book" . bibtex-InBook))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
536 (define-key bibtex-mode-map [menu-bar entry-types bibtex-InCollection]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
537 '("Article in a Collection" . bibtex-InCollection))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
538 (define-key bibtex-mode-map [menu-bar entry-types bibtex-InProceedings]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
539 '("Article in Conference Proceedings" . bibtex-InProceedings))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
540 (define-key bibtex-mode-map [menu-bar entry-types bibtex-Article]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
541 '("Article in Journal" . bibtex-Article))
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
542
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
543
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
544
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
545 ;; Internal Variables
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
546
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
547 (defvar bibtex-pop-previous-search-point nil)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
548 ;; Next point where bibtex-pop-previous starts looking for a similar
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
549 ;; entry.
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
550
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
551 (defvar bibtex-pop-next-search-point nil)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
552 ;; Next point where bibtex-pop-next starts looking for a similar entry.
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
553
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
554 (defvar bibtex-completion-candidates nil)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
555 ;; Candidates for bibtex-complete-string. Initialized from
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
556 ;; bibtex-predefined-strings and bibtex-string-files. This variable is
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
557 ;; buffer-local.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
558 (make-variable-buffer-local 'bibtex-completion-candidates)
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
559
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
560 (defvar bibtex-keys nil)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
561 ;; Candidates for TAB completion when entering a reference key using
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
562 ;; the minibuffer. Initialized in bibtex-mode and updated for each
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
563 ;; new entry. This variable is buffer-local.
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
564 (make-variable-buffer-local 'bibtex-keys)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
565
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
566 (defvar bibtex-buffer-last-parsed-for-keys-tick nil)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
567 ;; Remembers the value returned by buffer-modified-tick when buffer
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
568 ;; was parsed for keys the last time.
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
569 (make-variable-buffer-local 'bibtex-keys)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
570
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
571
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
572
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
573 ;; Functions to Parse the BibTeX Entries
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
574
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
575 (defun bibtex-cfield (name text)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
576 ;; Create a regexp for a BibTeX field of name NAME and text TEXT.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
577 (concat ",[ \t\n]*\\("
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578 name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
579 "\\)[ \t\n]*=[ \t\n]*\\("
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
580 text
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
581 "\\)"))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
582 (defconst bibtex-name-in-cfield 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
583 ;; The regexp subexpression number of the name part in bibtex-cfield.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
584
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
585 (defconst bibtex-text-in-cfield 2)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
586 ;; The regexp subexpression number of the text part in bibtex-cfield.
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
587
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
588 (defconst bibtex-field-name "[A-Za-z_-][A-Za-z0-9_-]*")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
589 ;; Regexp defining the name part of a BibTeX field.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
590
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
591 (defconst bibtex-field-const "[0-9A-Za-z][A-Za-z0-9:_+-]*"
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
592 "Format of a bibtex field constant.")
561
a819dc25b9e7 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 257
diff changeset
593
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
594 (defconst bibtex-field-string
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
595 (concat
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
596 "\\("
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
597 "{\\(\\({\\(\\({[^}]*}\\)\\|\\([^{}]\\)\\)*}\\)\\|\\([^{}]\\)\\)*}"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
598 ;; maximal twice nested {}
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
599 "\\)\\|\\("
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
600 "\"[^\"]*[^\\\\]\"\\|\"\""
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
601 "\\)"))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
602 ;; Match either a string or an empty string.
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
603
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
604 (defconst bibtex-field-string-or-const
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
605 (concat bibtex-field-const "\\|" bibtex-field-string))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
606 ;; Match either bibtex-field-string or bibtex-field-const.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
607
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
608 (defconst bibtex-field-text
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
609 (concat
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
610 "\\(" bibtex-field-string-or-const "\\)"
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
611 "\\([ \t\n]+#[ \t\n]+\\(" bibtex-field-string-or-const "\\)\\)*"))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
612 ;; Regexp defining the text part of a BibTeX field: either a string,
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
613 ;; or an empty string, or a constant followed by one or more # /
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
614 ;; constant pairs.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
615
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
616 (defconst bibtex-field
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
617 (bibtex-cfield bibtex-field-name bibtex-field-text))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
618 ;; Regexp defining the format of a BibTeX field.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
619
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
620 (defconst bibtex-name-in-field bibtex-name-in-cfield)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
621 ;; The regexp subexpression number of the name part in BibTeX-field.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
622
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
623 (defconst bibtex-text-in-field bibtex-text-in-cfield)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
624 ;; The regexp subexpression number of the text part in BibTeX-field.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
625
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
626 (defconst bibtex-reference-type "@[A-Za-z]+")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
627 ;; Regexp defining the type part of a BibTeX reference entry.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
628
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
629 (defconst bibtex-reference-key "[A-Za-z][A-Za-z0-9.:;?!`'/*@_+-]*")
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
630 ;; Regexp defining the label part of a BibTeX reference entry.
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
631
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
632 (defconst bibtex-reference-head
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
633 (concat "^\\( \\|\t\\)*\\("
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
634 bibtex-reference-type
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
635 "\\)[ \t]*[({]\\("
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
636 bibtex-reference-key
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
637 "\\)"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
638 ;; Regexp defining format of the header line of a BibTeX reference
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
639 ;; entry.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
640
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
641 (defconst bibtex-reference-maybe-empty-head
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
642 (concat bibtex-reference-head "?"))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
643 ;; Regexp defining format of the header line of a maybe empty
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
644 ;; BibTeX reference entry (without reference key).
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
645
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
646 (defconst bibtex-type-in-head 2)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
647 ;; The regexp subexpression number of the type part in
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
648 ;; bibtex-reference-head.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
649
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
650 (defconst bibtex-key-in-head 3)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
651 ;; The regexp subexpression number of the key part in
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
652 ;; bibtex-reference-head.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
653
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
654 (defconst bibtex-reference
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
655 (concat bibtex-reference-head
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
656 "\\([ \t\n]*" bibtex-field "\\)*"
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
657 "[ \t\n]*,?[ \t\n]*[})]"))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
658 ;; Regexp defining the format of a BibTeX reference entry.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
659
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
660 (defconst bibtex-type-in-reference bibtex-type-in-head)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
661 ;; The regexp subexpression number of the type part in
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
662 ;; bibtex-reference.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
663
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
664 (defconst bibtex-key-in-reference bibtex-key-in-head)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
665 ;; The regexp subexpression number of the key part in
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
666 ;; bibtex-reference.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
667
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
668 (defconst bibtex-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
669 (concat "^[ \t]*@[sS][tT][rR][iI][nN][gG][ \t\n]*[({][ \t\n]*\\("
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
670 bibtex-reference-key
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
671 "\\)[ \t\n]*=[ \t\n]*\\("
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
672 bibtex-field-text
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
673 "\\)[ \t\n]*[})]"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
674 ;; Regexp defining the format of a BibTeX string entry.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
675
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
676 (defconst bibtex-key-in-string 1)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
677 ;; The regexp subexpression of the name part in bibtex-string.
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
678
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
679 (defconst bibtex-text-in-string 2)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
680 ;; The regexp subexpression of the text part in bibtex-string.
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
681
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
682 (defconst bibtex-name-alignment 2)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
683 ;; Alignment for the name part in BibTeX fields. Chosen on aesthetic
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
684 ;; grounds only.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
685
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
686 (defconst bibtex-text-alignment (length " organization = "))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
687 ;; Alignment for the text part in BibTeX fields. Equal to the space
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
688 ;; needed for the longest name part.
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
689
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
690
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
691
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
692 ;; Helper Functions
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
693
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
694 (defun assoc-ignore-case (string alist)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
695 ;; Return non-nil if STRING is `equal' to the car of an element of
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
696 ;; LIST. Comparison is done with case ignored. The value is actually
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
697 ;; the element of LIST whose car is `equal' to STRING.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
698 (or (assoc string alist)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
699 (while (and alist
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
700 (not (string-equal
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
701 (downcase string)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
702 (downcase (car (car alist))))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
703 (setq alist (cdr alist)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
704 (car alist)))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
705
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
706 (defun member-of-regexp (string list)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
707 ;; Return non-nil if STRING is exactly matched by an element of
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
708 ;; LIST. This function is influenced by the actual value of
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
709 ;; `case-fold-search'. The value is actually the tail of LIST whose
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
710 ;; car matches STRING.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
711 (while
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
712 (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
713 list
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
714 (not
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
715 (string-match
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
716 (concat "^" (car list) "$")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
717 string)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
718 (setq list (cdr list)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
719 list)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
720
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
721 (defun assoc-of-regexp (string alist)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
722 ;; Return non-nil if STRING is exactly matched by the car of an
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
723 ;; element of LIST. This function is influenced by the actual value
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
724 ;; of `case-fold-search'. The value is actually the element of LIST
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
725 ;; whose car matches STRING.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
726 (while
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
727 (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
728 alist
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
729 (not
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
730 (string-match
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
731 (concat "^" (car (car alist)) "$")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
732 string)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
733 (setq alist (cdr alist)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
734 (car alist))
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
735
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
736 (defun skip-whitespace-and-comments ()
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
737 (let ((md (match-data)))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
738 (unwind-protect
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
739 (while (cond ((looking-at "\\s>+\\|\\s +")
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
740 ;; was whitespace
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
741 ;; NOTE: also checked end-comment. In latex and
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
742 ;; lisp modes, newline is an end comment, but it
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
743 ;; should also be a whitespace char.
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
744 (goto-char (match-end 0)))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
745 ;; If looking at beginning of comment, skip to end.
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
746 ((looking-at "\\s<")
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
747 (re-search-forward "\\s>"))))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
748 (store-match-data md))))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
749
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
750 (defun map-bibtex-entries (fun)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
751 ;; Call FUN for each BibTeX entry starting with the current. Do this
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
752 ;; to the end of the file. FUN is called with one argument, the key
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
753 ;; of the entry, and with point inside the entry. If
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
754 ;; bibtex-sort-ignore-string-entries is non-nil, FUN will not be called
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
755 ;; for @string entries.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
756 (bibtex-beginning-of-entry)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
757 (while (re-search-forward bibtex-reference-head nil t)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
758 (if (and bibtex-sort-ignore-string-entries
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
759 (string-equal "@string"
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
760 (downcase (buffer-substring-no-properties
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
761 (match-beginning bibtex-type-in-head)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
762 (match-end bibtex-type-in-head)))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
763 nil
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
764 (funcall fun (buffer-substring-no-properties
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
765 (match-beginning bibtex-key-in-head)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
766 (match-end bibtex-key-in-head))))))
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
767
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
768 (defun bibtex-flash-head ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
769 ;; Flash at BibTeX reference head before point, if exists.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
770 (let ((flash))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
771 (cond ((re-search-backward bibtex-reference-head (point-min) t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
772 (goto-char (match-beginning bibtex-type-in-head))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
773 (setq flash (match-end bibtex-key-in-reference)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
774 (t
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
775 (end-of-line)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
776 (skip-chars-backward " \t")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
777 (setq flash (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
778 (beginning-of-line)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
779 (skip-chars-forward " \t")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
780 (if (pos-visible-in-window-p (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
781 (sit-for 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
782 (message "From: %s"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
783 (buffer-substring (point) flash)))))
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
784
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
785 (defun bibtex-move-outside-of-entry ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
786 ;; Make sure we are outside of a BibTeX entry.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
787 (cond ((or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
788 (= (point) (point-max))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
789 (= (point) (point-min))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
790 (looking-at "[ \n]*@")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
791 )
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
792 t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
793 (t
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
794 (backward-paragraph)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
795 (forward-paragraph)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
796 (re-search-forward "[ \t\n]*" (point-max) t))
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
797
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
798 (defun beginning-of-first-bibtex-entry ()
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
799 ;; Go to the beginning of the first BibTeX entry in buffer.
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
800 (goto-char (point-min))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
801 (cond
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
802 ((re-search-forward "^@" nil 'move)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
803 (beginning-of-line))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
804 ((and (bobp) (eobp))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
805 nil)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
806 (t
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
807 (message "Warning: No BibTeX entries found!"))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
808
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
809 (defun bibtex-inside-field ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
810 ;; Try to avoid point being at end of a BibTeX field.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
811 (end-of-line)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
812 (skip-chars-backward " \t")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
813 (cond ((= (preceding-char) ?,)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
814 (forward-char -2)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
815 (cond ((or
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
816 (= (preceding-char) ?})
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
817 (= (preceding-char) ?\"))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
818 (forward-char -1))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
819
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
820 (defun bibtex-enclosing-field ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
821 ;; Search for BibTeX field enclosing point. Point moves to end of
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
822 ;; field; also, use match-beginning and match-end to parse the field.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
823 ;; sct@dcs.edinburgh.ac.uk
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
824 (let ((old-point (point)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
825 (condition-case errname
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
826 (bibtex-enclosing-regexp bibtex-field)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
827 (search-failed
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
828 (goto-char old-point)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
829 (error "Can't find enclosing BibTeX field.")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
830
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
831 (defun bibtex-enclosing-reference ()
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
832 ;; Search for BibTeX reference enclosing point. Point moves to
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
833 ;; beginning of reference. Beginning/end of reference is given by
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
834 ;; (match-beginning/match-end 0).
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
835 (let ((old-point (point)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
836 (if (not
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
837 (re-search-backward bibtex-reference-head (point-min) t))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
838 (progn
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
839 (error "Can't find enclosing BibTeX reference.")
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
840 (goto-char old-point)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
841 (goto-char (match-beginning bibtex-type-in-head))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
842 (let ((pnt (point)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
843 (if (not
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
844 (re-search-forward bibtex-reference (point-max) t))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
845 (progn
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
846 (error "Can't find enclosing BibTeX reference.")
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
847 (goto-char old-point))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
848 (goto-char pnt)))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
849
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
850 (defun bibtex-enclosing-reference-maybe-empty-head ()
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
851 ;; Search for BibTeX reference enclosing point. Point moves to
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
852 ;; beginning of reference. Beginning/end of reference is given by
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
853 ;; (match-beginning/match-end 0).
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
854 (let ((old-point (point)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
855 (if (not
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
856 (re-search-backward
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
857 bibtex-reference-maybe-empty-head (point-min) t))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
858 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
859 (error "Can't find enclosing BibTeX reference.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
860 (goto-char old-point)))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
861 (goto-char (match-beginning bibtex-type-in-head))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
862 (let ((pnt (point)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
863 (if (not
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
864 (re-search-forward
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
865 (concat
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
866 bibtex-reference-maybe-empty-head
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
867 "\\([ \t\n]*" bibtex-field "\\)*"
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
868 "[ \t\n]*,?[ \t\n]*[})]")
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
869 (point-max) t))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
870 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
871 (error "Can't find enclosing BibTeX reference.")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
872 (goto-char old-point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
873 (goto-char pnt)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
874
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
875 (defun bibtex-enclosing-regexp (regexp)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
876 ;; Search for REGEXP enclosing point. Point moves to end of
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
877 ;; REGEXP. See also match-beginning and match-end. If an enclosing
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
878 ;; REGEXP is not found, signals search-failed; point is left in an
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
879 ;; undefined location.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
880 ;; Doesn't something like this exist already?
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
881 ; compute reasonable limits for the loop
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
882 (let* ((initial (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
883 (right (if (re-search-forward regexp (point-max) t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
884 (match-end 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
885 (point-max)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
886 (left
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
887 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
888 (goto-char initial)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
889 (if (re-search-backward regexp (point-min) t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
890 (match-beginning 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
891 (point-min)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
892 ; within the prescribed limits, loop until a match is found
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
893 (goto-char left)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
894 (re-search-forward regexp right nil 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
895 (if (> (match-beginning 0) initial)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
896 (signal 'search-failed (list regexp)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
897 (while (<= (match-end 0) initial)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
898 (re-search-forward regexp right nil 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
899 (if (> (match-beginning 0) initial)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
900 (signal 'search-failed (list regexp))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
901 ))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
902
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
903 (defun bibtex-autokey-change (string change-list)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
904 ;; Returns a string where some regexps are changed according to
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
905 ;; change-list. Every item of change-list is an (old-regexp
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
906 ;; new-string) pair.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
907 (let ((return-string string)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
908 case-fold-search
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
909 (index 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
910 (len (length change-list))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
911 change-item)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
912 (while (< index len)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
913 (setq change-item (elt change-list index))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
914 (while (string-match (car change-item) return-string)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
915 (setq
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
916 return-string
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
917 (concat (substring return-string 0 (match-beginning 0))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
918 (elt change-item 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
919 (substring return-string (match-end 0)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
920 (setq index (1+ index)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
921 return-string))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
922
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
923 (defun bibtex-autokey-abbrev (string len)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
924 ;; Returns an abbreviation of string with at least len
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
925 ;; characters. String is aborted only after a consonant or at the
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
926 ;; word end. If len is not a number, string is returned unchanged.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
927 (let* ((string-length (length string))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
928 (len (if (numberp len)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
929 (min len string-length)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
930 len))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
931 (return-string (if (numberp len)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
932 (substring string 0 len)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
933 (index len)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
934 (vowels '(?a ?e ?i ?o ?u ?A ?E ?I ?O ?U)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
935 (if (numberp len)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
936 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
937 (while (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
938 (< index string-length)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
939 (member (elt return-string
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
940 (1- (length return-string)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
941 vowels))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
942 (setq return-string (concat return-string
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
943 (substring
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
944 string index (1+ index)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
945 index (1+ index)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
946 return-string)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
947 string)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
948
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
949 (defun bibtex-generate-autokey ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
950 "Generates automatically a key from the author/editor and the title field.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
951 The generation algorithm works as follows:
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
952 1. If there is a non-empty author (preferred) or editor field,
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
953 use it for the name part of the key.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
954 2. Change any substring found in `bibtex-autokey-name-change-strings'
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
955 to the corresponding new one (see documentation of this variable
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
956 for further detail).
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
957 3. For every of the first `bibtex-autokey-names' names in the
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
958 \"name\" field, determine the last name.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
959 4. From every last name, take at least `bibtex-autokey-name-length'
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
960 characters (abort only after a consonant or at a word end).
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
961 5. Build the name part of the key by concatenating all abbreviated last
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
962 names with the string `bibtex-autokey-name-separator' between
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
963 any two.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
964 6. Build the year part of the key by truncating the contents of the
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
965 \"year\" field to the rightmost `bibtex-autokey-year-length'
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
966 digits (useful values are 2 and 4).
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
967 7. For the title part of the key change the contents of the \"title\"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
968 field of the reference according to
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
969 `bibtex-autokey-titleword-change-strings' to the corresponding
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
970 new one (see documentation of this variable for further detail).
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
971 8. Abbreviate the result to the string up to (but not including) the
13968
cc71d8efd948 (bibtex-generate-autokey, bibtex-find-entry-location):
Karl Heuer <kwzh@gnu.org>
parents: 13728
diff changeset
972 first occurrence of a regexp matched by the items of
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
973 `bibtex-autokey-title-terminators' and delete the first
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
974 word if it appears in `bibtex-autokey-titleword-first-ignore'.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
975 Build the title part of the key by using at least the first
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
976 `bibtex-autokey-titlewords' capitalized words from this
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
977 abbreviated title. If the abbreviated title ends after maximal
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
978 `bibtex-autokey-titlewords' + `bibtex-autokey-titlewords-stretch'
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
979 capitalized words, all capitalized words from the abbreviated title
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
980 are used.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
981 9. For every used title word that appears in
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
982 `bibtex-autokey-titleword-abbrevs' use the corresponding abbreviation
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
983 (see documentation of this variable for further detail).
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
984 10. From every title word not generated by an abbreviation, take at
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
985 least `bibtex-autokey-titleword-length' characters (abort only after
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
986 a consonant or at a word end).
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
987 11. Build the title part of the key by concatenating all abbreviated
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
988 title words with the string `bibtex-autokey-titleword-separator'
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
989 between any two.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
990 12. At least, to get the key, concatenate the name part, the year part
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
991 and the title part with `bibtex-autokey-name-year-separator'
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
992 between the name and the year if both are non-empty and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
993 `bibtex-autokey-year-title-separator' between the year and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
994 the title if both are non-empty."
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
995
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
996 (let* ((pnt (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
997 (min
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
998 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
999 (bibtex-beginning-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1000 (point)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1001 (max
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1002 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1003 (bibtex-end-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1004 (point)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1005 (namefield
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1006 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1007 (goto-char min)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1008 (if (or
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1009 (re-search-forward "^[ \t]*author[ \t]*=" max t)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1010 (re-search-forward "^[ \t]*editor[ \t]*=" max t))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1011 (let* (bibtex-help-message
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1012 (start (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1013 (bibtex-find-text t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1014 (point)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1015 (end (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1016 (bibtex-find-text nil)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1017 (point))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1018 (bibtex-autokey-change
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1019 (buffer-substring-no-properties start end)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1020 bibtex-autokey-name-change-strings))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1021 "")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1022 (namelist
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1023 (mapcar
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1024 (function
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1025 (lambda (fullname)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1026 (bibtex-autokey-abbrev
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1027 (if (string-match "," fullname)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1028 (substring fullname 0 (match-beginning 0))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1029 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1030 (if (string-match " [^ ]*$" fullname)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1031 (substring
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1032 fullname (1+ (match-beginning 0)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1033 fullname)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1034 bibtex-autokey-name-length)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1035 ;; Gather all names into a list
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1036 (let (names
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1037 (counter 0))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1038 (while (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1039 (not (equal namefield ""))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1040 (or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1041 (not (numberp bibtex-autokey-names))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1042 (< counter bibtex-autokey-names)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1043 (if (string-match " and " namefield)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1044 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1045 (setq
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1046 names
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1047 (append names
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1048 (list
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1049 (downcase
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1050 (substring
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1051 namefield 0 (match-beginning 0)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1052 namefield
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1053 (substring namefield (match-end 0))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1054 (setq names
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1055 (append names (list (downcase namefield)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1056 namefield ""))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1057 (setq counter (1+ counter)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1058 names)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1059 (namepart (mapconcat (function (lambda (name) name))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1060 namelist
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1061 bibtex-autokey-name-separator))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1062 (yearfield
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1063 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1064 (goto-char min)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1065 (if (re-search-forward
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1066 "^[ \t]*year[ \t]*=[ \t]*\\([0-9]*\\)" max t)
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1067 (buffer-substring-no-properties
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1068 (match-beginning 1) (match-end 1))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1069 "")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1070 (yearpart
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1071 (if (equal yearfield "")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1072 ""
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1073 (substring yearfield
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1074 (- (length yearfield)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1075 bibtex-autokey-year-length))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1076 (titlestring
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1077 (let ((case-fold-search t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1078 (titlefield
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1079 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1080 (goto-char min)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1081 (if (re-search-forward
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1082 "^[ \t]*title[ \t]*=" max t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1083 (let* (bibtex-help-message
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1084 (start (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1085 (bibtex-find-text t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1086 (point)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1087 (end (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1088 (bibtex-find-text nil)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1089 (point))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1090 (bibtex-autokey-change
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1091 (buffer-substring-no-properties start end)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1092 bibtex-autokey-titleword-change-strings))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1093 "")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1094 case-fold-search
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1095 (index 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1096 (numberofitems
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1097 (length bibtex-autokey-title-terminators)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1098 (while (< index numberofitems)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1099 (if (string-match
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1100 (elt bibtex-autokey-title-terminators index)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1101 titlefield)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1102 (setq titlefield
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1103 (substring titlefield 0 (match-beginning 0))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1104 (setq index (1+ index)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1105 titlefield))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1106 (titlelist
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1107 (mapcar
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1108 (function
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1109 (lambda (titleword)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1110 (let ((abbrev
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1111 (assoc-of-regexp
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1112 titleword bibtex-autokey-titleword-abbrevs)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1113 (if abbrev
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1114 (elt abbrev 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1115 (bibtex-autokey-abbrev
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1116 titleword
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1117 bibtex-autokey-titleword-length)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1118 ;; Gather all titlewords into a list
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1119 (let (titlewords
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1120 titlewords-extra
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1121 case-fold-search
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1122 (counter 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1123 (first t))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1124 (while (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1125 (not (equal titlestring ""))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1126 (or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1127 (not (numberp bibtex-autokey-titlewords))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1128 (< counter (+
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1129 bibtex-autokey-titlewords
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1130 bibtex-autokey-titlewords-stretch))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1131 (if (string-match "\\b[A-Z][A-Za-z0-9]*" titlestring)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1132 (let* ((end-match (match-end 0))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1133 (titleword
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1134 (downcase (substring titlestring
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1135 (match-beginning 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1136 end-match))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1137 (if (or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1138 (not (numberp bibtex-autokey-titlewords))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1139 (< counter bibtex-autokey-titlewords))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1140 (if (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1141 first
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1142 (member-of-regexp
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1143 titleword
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1144 bibtex-autokey-titleword-first-ignore))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1145 (setq counter -1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1146 (setq titlewords
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1147 (append titlewords (list titleword))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1148 (setq
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1149 titlewords-extra
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1150 (append titlewords-extra (list titleword))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1151 (setq titlestring
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1152 (substring titlestring end-match)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1153 (setq titlestring ""))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1154 (setq first nil
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1155 counter (1+ counter)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1156 (if (string-match "\\b[A-Z][^ ]*\\b" titlestring)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1157 titlewords
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1158 (append titlewords titlewords-extra)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1159 (titlepart (mapconcat (function (lambda (name) name))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1160 titlelist
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1161 bibtex-autokey-titleword-separator))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1162 (autokey
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1163 (concat
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1164 namepart
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1165 (if (not
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1166 (or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1167 (equal namepart "")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1168 (equal yearpart "")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1169 bibtex-autokey-name-year-separator)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1170 yearpart
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1171 (if (not
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1172 (or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1173 (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1174 (equal namepart "")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1175 (equal yearpart ""))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1176 (equal titlepart "")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1177 bibtex-autokey-year-title-separator)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1178 titlepart)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1179 (goto-char pnt)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1180 autokey))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1181
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1182 (defun bibtex-parse-keys (add &optional abortable)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1183 ;; Sets bibtex-keys to the keys used in the whole (possibly
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1184 ;; restricted) buffer (either as entry keys or as crossref entries).
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1185 ;; If ADD is non-nil adds the new keys to bibtex-keys instead of
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1186 ;; simply resetting it. If ABORTABLE is non-nil abort on user input.
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1187 (if bibtex-maintain-sorted-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1188 (let ((labels (if add
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1189 bibtex-keys))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1190 label
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1191 (case-fold-search t))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1192 (save-excursion
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1193 (goto-char (point-min))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1194 (if (not add)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1195 (message "Parsing reference keys..."))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1196
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1197 (if (not
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1198 (catch 'userkey
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1199 (while
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1200 (re-search-forward
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1201 (concat
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1202 "\\("
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1203 bibtex-reference-head
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1204 "\\)\\|\\("
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1205 "^[ \t\n]*crossref[ \t\n]*=[ \t\n]*[{\"]\\([A-Za-z][]A-Za-z0-9.:;?!`'()/*@_+-]*\\)[}\"],?$"
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1206 "\\)")
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1207 nil t)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1208 (if (and
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1209 abortable
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1210 (input-pending-p))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1211 (throw 'userkey t))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1212 (if (match-beginning (1+ bibtex-key-in-head))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1213 (setq
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1214 label
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1215 (buffer-substring-no-properties
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1216 (match-beginning (1+ bibtex-key-in-head))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1217 (match-end (1+ bibtex-key-in-head))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1218 (setq
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1219 label
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1220 (buffer-substring-no-properties
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1221 (match-beginning (+ 3 bibtex-key-in-head))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1222 (match-end (+ 3 bibtex-key-in-head)))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1223 (if (not (assoc label labels))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1224 (setq labels
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1225 (cons (list label) labels))))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1226 (progn
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1227 (setq
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1228 bibtex-buffer-last-parsed-for-keys-tick
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1229 (buffer-modified-tick))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1230 (if (not add)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1231 (message "Parsing reference keys... done"))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1232 (setq bibtex-keys labels)))))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1233
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1234 (defun bibtex-auto-fill-function ()
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1235 (let ((fill-prefix (make-string (+ bibtex-text-alignment 1) ? )))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1236 (do-auto-fill)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1237
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1238
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1239
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1240 ;; Interactive Functions:
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1241
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1242 ;;;###autoload
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1243 (defun bibtex-mode ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1244 "Major mode for editing BibTeX files.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1245
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1246 \\{bibtex-mode-map}
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1247
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1248 A command such as \\[bibtex-Book] will outline the fields for a BibTeX book entry.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1249
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1250 The optional fields start with the string OPT, and thus ignored by BibTeX.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1251 The OPT string may be removed from a field with \\[bibtex-remove-OPT].
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1252 \\[bibtex-kill-optional-field] kills the current optional field entirely.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1253 \\[bibtex-remove-double-quotes-or-braces] removes the double-quotes or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1254 braces around the text of the current field. \\[bibtex-empty-field]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1255 replaces the text of the current field with the default \"\" or {}.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1256
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1257 The command \\[bibtex-clean-entry] cleans the current entry, i.e. (i) removes
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1258 double-quotes or braces from entirely numerical fields, (ii) removes
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1259 OPT from all non-empty optional fields, (iii) removes all empty
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1260 optional fields, and (iv) checks that no non-optional fields are empty.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1261
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1262 Use \\[bibtex-find-text] to position the cursor at the end of the current field.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1263 Use \\[bibtex-next-field] to move to end of the next field.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1264
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1265 The following may be of interest as well:
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1266
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1267 Functions:
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1268 bibtex-entry
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1269 bibtex-print-help-message
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1270 bibtex-beginning-of-entry
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1271 bibtex-end-of-entry
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1272 bibtex-ispell-abstract
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1273 bibtex-narrow-to-entry
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1274 bibtex-hide-entry-bodies
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1275 bibtex-sort-entries
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1276 bibtex-validate-buffer
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1277 bibtex-pop-previous
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1278 bibtex-pop-next
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1279 bibtex-complete-string
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1280
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1281 Variables:
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1282 bibtex-field-left-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1283 bibtex-field-right-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1284 bibtex-include-OPTcrossref
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1285 bibtex-include-OPTkey
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1286 bibtex-include-OPTannote
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1287 bibtex-mode-user-optional-fields
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1288 bibtex-clean-entry-zap-empty-opts
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1289 bibtex-sort-ignore-string-entries
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1290 bibtex-maintain-sorted-entries
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1291 bibtex-entry-field-alist
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1292 bibtex-predefined-strings
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1293 bibtex-string-files
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1294
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1295 ---------------------------------------------------------
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1296 Entry to this mode calls the value of bibtex-mode-hook if that value is
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1297 non-nil."
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1298 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1299 (kill-all-local-variables)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1300 (use-local-map bibtex-mode-map)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1301 (setq major-mode 'bibtex-mode)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1302 (setq mode-name "BibTeX")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1303 (set-syntax-table bibtex-mode-syntax-table)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1304 (setq bibtex-completion-candidates bibtex-predefined-strings)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1305 (mapcar
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1306 (function
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1307 (lambda (filename)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1308 ;; collect pathnames
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1309 (let* ((bib (getenv "BIBINPUTS"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1310 (path (if bib
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1311 bib
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1312 "."))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1313 (dirs
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1314 (mapcar
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1315 (function
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1316 (lambda (dirname) ;; strips off trailing slashes
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1317 (let ((len (length dirname)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1318 (if (equal (elt dirname (1- len)) "/")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1319 (substring dirname 0 (1- (1- len)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1320 dirname))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1321 (let (actdirs)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1322 (while (string-match ":" path)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1323 (setq actdirs
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1324 (append actdirs
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1325 (list (substring
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1326 path 0
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1327 (1- (match-end 0)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1328 path (substring path (match-end 0))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1329 (append actdirs (list path)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1330 (filename (if (string-match "\.bib$" filename)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1331 filename
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1332 (concat filename ".bib")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1333 fullfilename
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1334 (item 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1335 (size (length dirs)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1336 ;; test filenames
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1337 (while (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1338 (< item size)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1339 (not (file-readable-p
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1340 (setq fullfilename
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1341 (concat (elt dirs item) "/" filename)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1342 (setq item (1+ item)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1343 (if (< item size)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1344 ;; file was found
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1345 (let ((curbuf (current-buffer))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1346 (bufname (make-temp-name ""))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1347 (compl bibtex-completion-candidates))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1348 (create-file-buffer bufname)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1349 (set-buffer bufname)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1350 (insert-file-contents fullfilename)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1351 (goto-char (point-min))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1352 (while (re-search-forward bibtex-string nil t)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1353 (setq
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1354 compl
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1355 (append
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1356 compl
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1357 (list
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1358 (list (buffer-substring-no-properties
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1359 (match-beginning bibtex-key-in-string)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1360 (match-end bibtex-key-in-string)))))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1361 (kill-buffer bufname)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1362 (set-buffer curbuf)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1363 (setq bibtex-completion-candidates compl))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1364 (error "File %s not in $BIBINPUTS paths" filename)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1365 bibtex-string-files)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1366 (add-hook
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1367 'auto-save-hook
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1368 (function
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1369 (lambda ()
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1370 (if (and
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1371 bibtex-maintain-sorted-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1372 (eq major-mode 'bibtex-mode)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1373 (not
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1374 (eq (buffer-modified-tick)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1375 bibtex-buffer-last-parsed-for-keys-tick)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1376 (bibtex-parse-keys nil t)))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1377 (bibtex-parse-keys nil)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1378 (make-local-variable 'paragraph-start)
10869
b8e678e5c4de (bibtex-mode): Remove ^ from paragraph-start.
Boris Goldowsky <boris@gnu.org>
parents: 10353
diff changeset
1379 (setq paragraph-start "[ \f\n\t]*$")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1380 (make-local-variable 'comment-start)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1381 (setq comment-start "%")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1382 (auto-fill-mode 1)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1383 (setq auto-fill-function 'bibtex-auto-fill-function)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1384 (set (make-local-variable 'font-lock-defaults)
14193
649ead749232 (bibtex-font-lock-keywords, bibtex-mode):
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1385 '(bibtex-font-lock-keywords
649ead749232 (bibtex-font-lock-keywords, bibtex-mode):
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1386 nil t ((?_ . "w") (?- . "w") (?$ . "\""))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1387 (run-hooks 'bibtex-mode-hook))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1388
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1389 (defun bibtex-entry (entry-type &optional required optional)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1390 "Inserts a new BibTeX entry.
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1391 Calls the value of bibtex-add-entry-hook if that value is non-nil."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1392 (interactive (let* ((completion-ignore-case t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1393 (e-t (completing-read
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1394 "Entry Type: "
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1395 bibtex-entry-field-alist
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1396 nil t)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1397 (list e-t)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1398 (if (and (null required) (null optional))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1399 (let* ((e (assoc-ignore-case entry-type bibtex-entry-field-alist))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1400 (r-n-o (elt e 1))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1401 (c-ref (elt e 2)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1402 (if (null e)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1403 (error "Bibtex entry type %s not defined!" entry-type))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1404 (if (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1405 (member entry-type bibtex-include-OPTcrossref)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1406 c-ref)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1407 (setq required (elt c-ref 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1408 optional (elt c-ref 1))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1409 (setq required (elt r-n-o 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1410 optional (elt r-n-o 1)))))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1411 (let ((key
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1412 (if bibtex-maintain-sorted-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1413 (completing-read
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1414 (format "%s key: " entry-type)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1415 bibtex-keys))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1416 (if bibtex-maintain-sorted-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1417 (bibtex-find-entry-location key)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1418 (bibtex-move-outside-of-entry))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1419 (insert "@" entry-type "{")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1420 (if key
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1421 (insert key))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1422 (save-excursion
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1423 (mapcar 'bibtex-make-field required)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1424 (if (member entry-type bibtex-include-OPTcrossref)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1425 (bibtex-make-optional-field '("crossref")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1426 (if bibtex-include-OPTkey
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1427 (bibtex-make-optional-field '("key")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1428 (mapcar 'bibtex-make-optional-field optional)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1429 (mapcar 'bibtex-make-optional-field
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1430 bibtex-mode-user-optional-fields)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1431 (if bibtex-include-OPTannote
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1432 (bibtex-make-optional-field '("annote")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1433 (insert "\n}\n\n"))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1434 (bibtex-next-field t)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1435 (run-hooks 'bibtex-add-entry-hook)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1436
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1437 (defun bibtex-print-help-message ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1438 "Prints helpful information about current field in current BibTeX entry."
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1439 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1440 (let* ((pnt (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1441 (field-name
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1442 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1443 (beginning-of-line)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1444 (condition-case errname
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1445 (bibtex-enclosing-regexp bibtex-field)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1446 (search-failed
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1447 (goto-char pnt)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1448 (error "Not on BibTeX field")))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1449 (let ((mb (match-beginning bibtex-name-in-field))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1450 (me (match-end bibtex-name-in-field)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1451 (goto-char mb)
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1452 (buffer-substring-no-properties
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1453 (if (looking-at "OPT")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1454 (+ 3 mb)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1455 mb)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1456 me))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1457 (reference-type
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1458 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1459 (re-search-backward
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1460 bibtex-reference-maybe-empty-head nil t)
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1461 (buffer-substring-no-properties
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1462 (1+ (match-beginning bibtex-type-in-head))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1463 (match-end bibtex-type-in-head))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1464 (entry-list
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1465 (assoc-ignore-case reference-type
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1466 bibtex-entry-field-alist))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1467 (c-r-list (elt entry-list 2))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1468 (req-opt-list
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1469 (if (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1470 (member reference-type bibtex-include-OPTcrossref)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1471 c-r-list)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1472 c-r-list
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1473 (elt entry-list 1)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1474 (list-of-entries (append
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1475 (elt req-opt-list 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1476 (elt req-opt-list 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1477 bibtex-mode-user-optional-fields
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1478 (if (member
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1479 reference-type
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1480 bibtex-include-OPTcrossref)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1481 '(("crossref"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1482 "Label of the crossreferenced entry")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1483 (if bibtex-include-OPTannote
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1484 '(("annote"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1485 "Personal annotation (ignored)")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1486 (if bibtex-include-OPTkey
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1487 '(("key"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1488 "Key used for label creation if author and editor fields are missing"))))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1489 (goto-char pnt)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1490 (if (assoc field-name list-of-entries)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1491 (message (elt (assoc field-name list-of-entries) 1))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1492 (message "NO COMMENT AVAILABLE"))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1493
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1494 (defun bibtex-make-field (e-t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1495 "Makes a field named E-T in current BibTeX entry."
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1496 (interactive "sBibTeX field name: ")
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1497 (let ((name (if (consp e-t)
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1498 (elt e-t 0)
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1499 e-t)))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1500 (if (interactive-p)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1501 (progn
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1502 (bibtex-find-text nil)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1503 (if (looking-at "[}\"]")
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1504 (forward-char 1))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1505 (insert ",\n")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1506 (indent-to-column bibtex-name-alignment)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1507 (insert name " = ")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1508 (indent-to-column bibtex-text-alignment)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1509 (insert bibtex-field-left-delimiter bibtex-field-right-delimiter)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1510 (if (interactive-p)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1511 (forward-char -1))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1512
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1513 (defun bibtex-make-optional-field (e-t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1514 "Makes an optional field named E-T in current BibTeX entry."
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1515 (if (consp e-t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1516 (setq e-t (cons (concat "OPT" (car e-t)) (cdr e-t)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1517 (setq e-t (concat "OPT" e-t)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1518 (bibtex-make-field e-t))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1519
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1520 (defun bibtex-beginning-of-entry ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1521 "Move to beginning of BibTeX entry.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1522 If inside an entry, move to the beginning of it, otherwise move to the
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1523 beginning of the previous entry."
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1524 (interactive)
11373
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
1525 (if (looking-at "^@")
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
1526 (forward-char))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1527 (re-search-backward "^@" nil 'move))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1528
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1529 (defun bibtex-end-of-entry ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1530 "Move to end of BibTeX entry.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1531 If inside an entry, move to the end of it, otherwise move to the end
11373
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
1532 of the previous entry."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1533 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1534 (bibtex-beginning-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1535 (let ((parse-sexp-ignore-comments t))
11373
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
1536 (forward-sexp 2) ;; skip entry type and body
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1537 ))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1538
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1539 (defun bibtex-ispell-entry ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1540 "Spell whole BibTeX entry."
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1541 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1542 (ispell-region (progn (bibtex-beginning-of-entry) (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1543 (progn (bibtex-end-of-entry) (point))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1544
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1545 (defun bibtex-ispell-abstract ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1546 "Spell abstract of BibTeX entry."
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1547 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1548 (let ((pnt (bibtex-end-of-entry)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1549 (bibtex-beginning-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1550 (if (null
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1551 (re-search-forward "^[ \t]*[OPT]*abstract[ \t]*=" pnt))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1552 (error "No abstract in entry.")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1553 (ispell-region (point)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1554 (save-excursion (forward-sexp) (point))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1555
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1556 (defun bibtex-narrow-to-entry ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1557 "Narrow buffer to current BibTeX entry."
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1558 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1559 (save-excursion
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1560 (narrow-to-region (progn (bibtex-beginning-of-entry) (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1561 (progn (bibtex-end-of-entry) (point)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1562
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1563
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1564 (defun bibtex-hide-entry-bodies (&optional arg)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1565 "Hide all lines between first and last BibTeX entries not beginning with @.
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1566 With argument, show all text."
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1567 (interactive "P")
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1568 (save-excursion
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1569 (beginning-of-first-bibtex-entry)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1570 ;; subst-char-in-region modifies the buffer, despite what the
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1571 ;; documentation says...
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1572 (let ((modifiedp (buffer-modified-p))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1573 (buffer-read-only nil))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1574 (if arg
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1575 (subst-char-in-region (point) (point-max) ?\r ?\n t)
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1576 (while (save-excursion (re-search-forward "\n[^@]" (point-max) t))
5309
dc1a3f9ea36d (hide-bibtex-entry-bodies): Don't use replace-regexp.
Richard M. Stallman <rms@gnu.org>
parents: 4611
diff changeset
1577 ;; (save-excursion (replace-regexp "\n\\([^@]\\)" "\r\\1"))
dc1a3f9ea36d (hide-bibtex-entry-bodies): Don't use replace-regexp.
Richard M. Stallman <rms@gnu.org>
parents: 4611
diff changeset
1578 (save-excursion
dc1a3f9ea36d (hide-bibtex-entry-bodies): Don't use replace-regexp.
Richard M. Stallman <rms@gnu.org>
parents: 4611
diff changeset
1579 (while (re-search-forward "\n\\([^@]\\)" nil t)
dc1a3f9ea36d (hide-bibtex-entry-bodies): Don't use replace-regexp.
Richard M. Stallman <rms@gnu.org>
parents: 4611
diff changeset
1580 (replace-match "\r\\1" nil nil)))))
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1581 (setq selective-display (not arg))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1582 (set-buffer-modified-p modifiedp))))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1583
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1584 (defun bibtex-sort-entries ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1585 "Sort BibTeX entries alphabetically by key.
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1586 Text outside of BibTeX entries is not affected. If
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1587 bibtex-sort-ignore-string-entries is non-nil, @string entries will be
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1588 ignored."
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1589 (interactive)
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1590 (save-restriction
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1591 (beginning-of-first-bibtex-entry)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1592 (narrow-to-region
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1593 (point)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1594 (save-excursion
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1595 (goto-char (point-max))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1596 (bibtex-end-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1597 (point)))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1598 (if bibtex-sort-ignore-string-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1599 (if (re-search-forward bibtex-reference nil 'move)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1600 (goto-char (match-beginning 0))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1601 (sort-subr
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1602 nil
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1603 ;; NEXTREC function
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1604 (function
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1605 (lambda ()
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1606 (if bibtex-sort-ignore-string-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1607 (if (re-search-forward bibtex-reference nil 'move)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1608 (goto-char (match-beginning 0)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1609 (if (re-search-forward bibtex-reference-head nil 'move)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1610 (goto-char (match-beginning 0))))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1611 ;; ENDREC function
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1612 'bibtex-end-of-entry
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1613 ;; STARTKEY function
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1614 (function
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1615 (lambda ()
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1616 (if bibtex-sort-ignore-string-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1617 (progn
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1618 (re-search-forward bibtex-reference)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1619 (buffer-substring-no-properties
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1620 (match-beginning bibtex-key-in-reference)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1621 (match-end bibtex-key-in-reference)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1622 (re-search-forward bibtex-reference-head)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1623 (buffer-substring-no-properties
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1624 (match-beginning bibtex-key-in-head)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1625 (match-end bibtex-key-in-head)))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1626 ;; ENDKEY function
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1627 nil)))
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1628
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1629 (defun bibtex-find-entry-location (entry-name &optional ignore-dups)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1630 "Looking for place to put the BibTeX entry named ENTRY-NAME.
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1631 Performs a binary search (therefore, buffer is assumed to be in sorted
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1632 order, without duplicates (see \\[bibtex-validate-buffer]), if it is
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1633 not, bibtex-find-entry-location will fail). If entry-name is already
13968
cc71d8efd948 (bibtex-generate-autokey, bibtex-find-entry-location):
Karl Heuer <kwzh@gnu.org>
parents: 13728
diff changeset
1634 used as a reference key, an error is signaled. However, if optional
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1635 variable IGNORE-DUPS is non-nil, no error messages about duplicate
13968
cc71d8efd948 (bibtex-generate-autokey, bibtex-find-entry-location):
Karl Heuer <kwzh@gnu.org>
parents: 13728
diff changeset
1636 entries are signaled, but the error handling is assumed to be made in
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1637 the calling function. Nil is returned, if an duplicate entry error
13968
cc71d8efd948 (bibtex-generate-autokey, bibtex-find-entry-location):
Karl Heuer <kwzh@gnu.org>
parents: 13728
diff changeset
1638 occurred, and t in all other cases."
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1639 (let* ((left
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1640 (progn
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1641 (beginning-of-first-bibtex-entry)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1642 (if bibtex-sort-ignore-string-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1643 (re-search-forward bibtex-reference nil `move)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1644 (bibtex-end-of-entry))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1645 (point)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1646 (right
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1647 (progn
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1648 (goto-char (point-max))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1649 (if bibtex-sort-ignore-string-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1650 (re-search-backward bibtex-reference nil `move)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1651 (bibtex-beginning-of-entry))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1652 (point)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1653 actual-point
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1654 actual-key
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1655 (done (>= left right))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1656 new
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1657 dup)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1658 (while (not done)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1659 (setq actual-point (/ (+ left right) 2))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1660 (goto-char actual-point)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1661 (bibtex-beginning-of-entry)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1662 (setq actual-key
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1663 (if bibtex-sort-ignore-string-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1664 (progn
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1665 (re-search-forward bibtex-reference)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1666 (buffer-substring-no-properties
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1667 (match-beginning bibtex-key-in-reference)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1668 (match-end bibtex-key-in-reference)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1669 (re-search-forward bibtex-reference-head)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1670 (buffer-substring-no-properties
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1671 (match-beginning bibtex-key-in-head)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1672 (match-end bibtex-key-in-head))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1673 (cond
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1674 ((string-lessp entry-name actual-key)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1675 (setq new (match-beginning 0))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1676 (if (equal right new)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1677 (setq done t)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1678 (setq right new)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1679 ((string-lessp actual-key entry-name)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1680 (setq new (match-end 0))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1681 (if (equal left new)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1682 (setq done t)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1683 (setq left new)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1684 ((string-equal actual-key entry-name)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1685 (setq dup t
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1686 done t)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1687 (if (not ignore-dups)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1688 (error "Entry with key `%s' already exists!" entry-name)))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1689 (if dup
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1690 nil
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1691 (goto-char right)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1692 (if (re-search-forward bibtex-reference nil t)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1693 (progn
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1694 (setq actual-key
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1695 (buffer-substring-no-properties
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1696 (match-beginning bibtex-key-in-reference)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1697 (match-end bibtex-key-in-reference)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1698 (if (string-lessp actual-key entry-name)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1699 ;; even greater than last entry --> we must append
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1700 (progn
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1701 (goto-char (match-end 0))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1702 (newline (forward-line 2))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1703 (beginning-of-line))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1704 (goto-char right))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1705 t)))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1706
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1707 (defun bibtex-validate-buffer ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1708 "Validate if the current BibTeX buffer is syntactically correct.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1709 Any garbage (e.g. comments) before the first \"@\" is not tested (so
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1710 you can put comments here)."
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1711 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1712 (let ((pnt (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1713 (max (point-max)))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1714 ;; looking if entries fit syntactical structure
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1715 (goto-char (point-min))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1716 (while (< (re-search-forward "@\\|\\'") max)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1717 (forward-char -1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1718 (let ((p (point)))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1719 (if (or
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1720 (looking-at "@string")
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1721 (looking-at "@preamble"))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1722 (forward-char)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1723 (if (not (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1724 (re-search-forward bibtex-reference nil t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1725 (equal p (match-beginning 0))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1726 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1727 (goto-char p)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1728 (error "Bad entry begins here"))))))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1729 ;; looking if entries are balanced (a single non-escaped quote
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1730 ;; inside braces is not detected by the former check, but
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1731 ;; bibtex-sort-entries stumbles about it
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1732 (goto-char (point-min))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1733 (map-bibtex-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1734 (function
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1735 (lambda (current)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1736 (bibtex-beginning-of-entry)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1737 (forward-sexp 2))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1738 ;; looking for correct sort order and duplicates
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1739 (if bibtex-maintain-sorted-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1740 (let ((entry-name (make-string 10 255))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1741 (previous nil)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1742 point)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1743 (beginning-of-first-bibtex-entry)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1744 (map-bibtex-entries
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1745 (function
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1746 (lambda (current)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1747 (cond ((or (null previous)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1748 (string< previous current))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1749 (setq previous current
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1750 point (point)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1751 ((string-equal previous current)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1752 (error "Duplicate here with previous!"))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1753 (t
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1754 (error "Entries out of order here!"))))))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1755 (goto-char pnt)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1756 (message "BibTeX buffer is syntactically correct")))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1757
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1758 (defun bibtex-next-field (arg)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1759 "Finds end of text of next BibTeX field; with arg, to its beginning."
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1760 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1761 (bibtex-inside-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1762 (let ((start (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1763 (condition-case ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1764 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1765 (bibtex-enclosing-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1766 (goto-char (match-end 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1767 (forward-char 2))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1768 (error
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1769 (goto-char start)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1770 (end-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1771 (forward-char 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1772 (bibtex-find-text arg))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1773
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1774 (defun bibtex-find-text (arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1775 "Go to end of text of current field; with arg, go to beginning."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1776 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1777 (bibtex-inside-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1778 (bibtex-enclosing-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1779 (if arg
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1780 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1781 (goto-char (match-beginning bibtex-text-in-field))
11373
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
1782 (if (looking-at "[{\"]")
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1783 (forward-char 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1784 (goto-char (match-end bibtex-text-in-field))
11373
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
1785 (if (or
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
1786 (= (preceding-char) ?})
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
1787 (= (preceding-char) ?\"))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1788 (forward-char -1)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1789 (if bibtex-help-message
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1790 (bibtex-print-help-message)))
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1791
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1792 (defun bibtex-remove-OPT ()
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1793 "Removes the 'OPT' starting optional arguments and goes to end of text."
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1794 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1795 (bibtex-inside-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1796 (bibtex-enclosing-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1797 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1798 (goto-char (match-beginning bibtex-name-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1799 (if (looking-at "OPT")
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1800 ;; sct@dcs.edinburgh.ac.uk
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1801 (progn
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1802 (delete-char (length "OPT"))
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1803 (search-forward "=")
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1804 (delete-horizontal-space)
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
1805 (indent-to-column bibtex-text-alignment))))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1806 (bibtex-inside-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1807
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1808 (defun bibtex-remove-double-quotes-or-braces ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1809 "Removes \"\" or {} around string."
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1810 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1811 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1812 (bibtex-inside-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1813 (bibtex-enclosing-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1814 (let ((start (match-beginning bibtex-text-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1815 (stop (match-end bibtex-text-in-field)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1816 (goto-char stop)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1817 (forward-char -1)
11373
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
1818 (if (looking-at "[}\"]")
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1819 (delete-char 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1820 (goto-char start)
11373
8381a25d021e (bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Richard M. Stallman <rms@gnu.org>
parents: 10869
diff changeset
1821 (if (looking-at "[{\"]")
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1822 (delete-char 1)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1823
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1824 (defun bibtex-kill-optional-field ()
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1825 "Kill the entire enclosing optional BibTeX field."
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1826 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1827 (bibtex-inside-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1828 (bibtex-enclosing-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1829 (goto-char (match-beginning bibtex-name-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1830 (let ((the-end (match-end 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1831 (the-beginning (match-beginning 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1832 (if (looking-at "OPT")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1833 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1834 (goto-char the-end)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1835 (skip-chars-forward " \t\n,")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1836 (kill-region the-beginning the-end))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1837 (error "Mandatory fields can't be killed"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1838
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1839 (defun bibtex-empty-field ()
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1840 "Delete the text part of the current field, replace with empty text."
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1841 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1842 (bibtex-inside-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1843 (bibtex-enclosing-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1844 (goto-char (match-beginning bibtex-text-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1845 (kill-region (point) (match-end bibtex-text-in-field))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1846 (insert (concat bibtex-field-left-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1847 bibtex-field-right-delimiter))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1848 (bibtex-find-text t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1849
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1850 (defun bibtex-pop-previous (arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1851 "Replace text of current field with the text of similar field in previous entry.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1852 With arg, go up ARG entries. Repeated, goes up so many times. May be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1853 intermixed with \\[bibtex-pop-next] (bibtex-pop-next)."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1854 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1855 (bibtex-inside-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1856 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1857 ; parse current field
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1858 (bibtex-enclosing-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1859 (let ((start-old-text (match-beginning bibtex-text-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1860 (stop-old-text (match-end bibtex-text-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1861 (start-name (match-beginning bibtex-name-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1862 (stop-name (match-end bibtex-name-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1863 (new-text))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1864 (goto-char start-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1865 ; construct regexp for previous field with same name as this one
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1866 (let ((matching-entry
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1867 (bibtex-cfield
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1868 (buffer-substring-no-properties (if (looking-at "OPT")
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1869 (+ (point) (length "OPT"))
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1870 (point))
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1871 stop-name)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1872 bibtex-field-text)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1873 ; if executed several times in a row, start each search where the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1874 ; last one finished
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1875 (cond ((or (eq last-command 'bibtex-pop-previous)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1876 (eq last-command 'bibtex-pop-next))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1877 t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1878 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1879 (t
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1880 (bibtex-enclosing-reference-maybe-empty-head)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1881 (setq bibtex-pop-previous-search-point (point))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1882 (setq bibtex-pop-next-search-point (match-end 0))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1883 (goto-char bibtex-pop-previous-search-point)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1884 ; Now search for arg'th previous similar field
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1885 (cond
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1886 ((re-search-backward matching-entry (point-min) t arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1887 (setq new-text
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1888 (buffer-substring-no-properties
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1889 (match-beginning bibtex-text-in-cfield)
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1890 (match-end bibtex-text-in-cfield)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1891 ;; change delimiters, if any changes needed
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1892 (cond
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1893 ((and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1894 (equal bibtex-field-left-delimiter "{")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1895 (eq (aref new-text 0) ?\")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1896 (eq (aref new-text (1- (length new-text))) ?\"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1897 (aset new-text 0 ?\{)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1898 (aset new-text (1- (length new-text)) ?\}))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1899 ((and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1900 (equal bibtex-field-left-delimiter "\"")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1901 (eq (aref new-text 0) ?\{)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1902 (eq (aref new-text (1- (length new-text))) ?\}))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1903 (aset new-text 0 ?\")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1904 (aset new-text (1- (length new-text)) ?\"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1905 ((or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1906 (not (eq (aref new-text 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1907 (aref bibtex-field-left-delimiter 0)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1908 (not (eq (aref new-text (1- (length new-text)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1909 (aref bibtex-field-right-delimiter 0))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1910 (setq new-text (concat bibtex-field-left-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1911 new-text
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1912 bibtex-field-right-delimiter))))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1913 ; Found a matching field. Remember boundaries.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1914 (setq bibtex-pop-next-search-point (match-end 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1915 (setq bibtex-pop-previous-search-point (match-beginning 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1916 (bibtex-flash-head)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1917 ; Go back to where we started, delete old text, and pop new.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1918 (goto-char stop-old-text)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1919 (delete-region start-old-text stop-old-text)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1920 (insert new-text))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1921 (t ; search failed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1922 (error "No previous matching BibTeX field."))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1923 (setq this-command 'bibtex-pop-previous))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1924
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1925 (defun bibtex-pop-next (arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1926 "Replace text of current field with the text of similar field in next entry.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1927 With arg, go up ARG entries. Repeated, goes up so many times. May be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1928 intermixed with \\[bibtex-pop-previous] (bibtex-pop-previous)."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1929 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1930 (bibtex-inside-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1931 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1932 ; parse current field
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1933 (bibtex-enclosing-field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1934 (let ((start-old-text (match-beginning bibtex-text-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1935 (stop-old-text (match-end bibtex-text-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1936 (start-name (match-beginning bibtex-name-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1937 (stop-name (match-end bibtex-name-in-field))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1938 (new-text))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1939 (goto-char start-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1940 ; construct regexp for next field with same name as this one,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1941 ; ignoring possible OPT's
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1942 (let ((matching-entry
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1943 (bibtex-cfield
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1944 (buffer-substring-no-properties (if (looking-at "OPT")
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1945 (+ (point) (length "OPT"))
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1946 (point))
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1947 stop-name)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1948 bibtex-field-text)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1949
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1950 ; if executed several times in a row, start each search where the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1951 ; last one finished
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1952 (cond ((or (eq last-command 'bibtex-pop-next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1953 (eq last-command 'bibtex-pop-previous))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1954 t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1955 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1956 (t
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1957 (bibtex-enclosing-reference-maybe-empty-head)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1958 (setq bibtex-pop-previous-search-point (point))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1959 (setq bibtex-pop-next-search-point (match-end 0))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1960 (goto-char bibtex-pop-next-search-point)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1961
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1962 ; Now search for arg'th next similar field
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1963 (cond
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1964 ((re-search-forward matching-entry (point-max) t arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1965 (setq new-text
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1966 (buffer-substring-no-properties
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1967 (match-beginning bibtex-text-in-cfield)
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1968 (match-end bibtex-text-in-cfield)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1969 ;; change delimiters, if any changes needed
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1970 (cond
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1971 ((and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1972 (equal bibtex-field-left-delimiter "{")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1973 (eq (aref new-text 0) ?\")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1974 (eq (aref new-text (1- (length new-text))) ?\"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1975 (aset new-text 0 ?\{)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1976 (aset new-text (1- (length new-text)) ?\}))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1977 ((and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1978 (equal bibtex-field-left-delimiter "\"")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1979 (eq (aref new-text 0) ?\{)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1980 (eq (aref new-text (1- (length new-text))) ?\}))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1981 (aset new-text 0 ?\")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1982 (aset new-text (1- (length new-text)) ?\"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1983 ((or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1984 (not (eq (aref new-text 0)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1985 (aref bibtex-field-left-delimiter 0)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1986 (not (eq (aref new-text (1- (length new-text)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1987 (aref bibtex-field-right-delimiter 0))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1988 (setq new-text (concat bibtex-field-left-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1989 new-text
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1990 bibtex-field-right-delimiter))))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1991 ; Found a matching field. Remember boundaries.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1992 (setq bibtex-pop-next-search-point (match-end 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1993 (setq bibtex-pop-previous-search-point (match-beginning 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1994 (bibtex-flash-head)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1995 ; Go back to where we started, delete old text, and pop new.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1996 (goto-char stop-old-text)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1997 (delete-region start-old-text stop-old-text)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1998 (insert new-text))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1999 (t ; search failed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2000 (error "No next matching BibTeX field."))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2001 (setq this-command 'bibtex-pop-next))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2002
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2003 (defun bibtex-clean-entry (&optional arg)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2004 "Finish editing the current BibTeX entry and clean it up.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2005 For all optional fields of current BibTeX entry: if empty, kill the
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2006 whole field; otherwise, remove the \"OPT\" string in the name; if text
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2007 numerical, remove double-quotes. For all mandatory fields: if empty,
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2008 signal error. If label of entry is empty or a prefix argument was
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2009 given, calculate a new entry label."
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2010 (interactive "P")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2011 (bibtex-beginning-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2012 (let ((start (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2013 crossref-there)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2014 (save-restriction
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2015 (narrow-to-region start (save-excursion (bibtex-end-of-entry) (point)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2016 (while (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2017 (re-search-forward bibtex-field (point-max) t 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2018 (not crossref-there))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2019 ;; determine if reference has crossref entry
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2020 (let ((begin-name (match-beginning bibtex-name-in-field))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2021 (begin-text (match-beginning bibtex-text-in-field)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2022 (goto-char begin-name)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2023 (if (looking-at "\\(OPTcrossref\\)\\|\\(crossref\\)")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2024 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2025 (goto-char begin-text)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2026 (if (not (looking-at
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2027 (concat
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2028 bibtex-field-left-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2029 bibtex-field-right-delimiter)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2030 (setq crossref-there t))))))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2031 (bibtex-enclosing-reference-maybe-empty-head)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2032 (re-search-forward bibtex-reference-type)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2033 (let ((begin-type (1+ (match-beginning 0)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2034 (end-type (match-end 0)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2035 (goto-char start)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2036 (while (re-search-forward bibtex-field (point-max) t 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2037 (let ((begin-field (match-beginning 0))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2038 (end-field (match-end 0))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2039 (begin-name (match-beginning bibtex-name-in-field))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2040 (end-name (match-end bibtex-name-in-field))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2041 (begin-text (match-beginning bibtex-text-in-field))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2042 (end-text (match-end bibtex-text-in-field))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2043 )
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2044 (goto-char begin-name)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2045 (cond ((and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2046 (looking-at "OPT")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2047 bibtex-clean-entry-zap-empty-opts)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2048 (goto-char begin-text)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2049 (if (looking-at
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2050 (concat
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2051 bibtex-field-left-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2052 bibtex-field-right-delimiter))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2053 ;; empty: delete whole field if really optional
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2054 ;; (missing crossref handled) or complain
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2055 (if (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2056 (not crossref-there)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2057 (assoc
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2058 (downcase
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2059 (buffer-substring-no-properties
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2060 (+ (length "OPT") begin-name) end-name))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2061 (car (car (cdr
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2062 (assoc-ignore-case
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2063 (buffer-substring-no-properties
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2064 begin-type end-type)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2065 bibtex-entry-field-alist))))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2066 ;; field is not really optional
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2067 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2068 (goto-char begin-name)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2069 (delete-char (length "OPT"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2070 ;; make field non-OPT
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2071 (search-forward "=")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2072 (delete-horizontal-space)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2073 (indent-to-column bibtex-text-alignment)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2074 (forward-char)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2075 ;; and loop to go through next test
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2076 (error "Mandatory field ``%s'' is empty"
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2077 (buffer-substring-no-properties
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2078 begin-name
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2079 end-name)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2080 ;; field is optional
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2081 (delete-region begin-field end-field))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2082 ;; otherwise: not empty, delete "OPT"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2083 (goto-char begin-name)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2084 (delete-char (length "OPT"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2085 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2086 ;; fixup alignment. [alarson:19920309.2047CST]
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2087 (search-forward "=")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2088 (delete-horizontal-space)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2089 (indent-to-column bibtex-text-alignment))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2090 (goto-char begin-field) ; and loop to go through next test
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2091 ))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2092 (t
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2093 (goto-char begin-text)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2094 (cond ((looking-at (concat
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2095 bibtex-field-left-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2096 "[0-9]+"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2097 bibtex-field-right-delimiter))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2098 ;; if numerical,
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2099 (goto-char end-text)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2100 (delete-char -1) ; delete enclosing double-quotes
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2101 (goto-char begin-text)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2102 (delete-char 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2103 (goto-char end-field) ; go to end for next search
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2104 (forward-char -2) ; to compensate for the 2 quotes deleted
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2105 )
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2106 ((looking-at (concat
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2107 bibtex-field-left-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2108 bibtex-field-right-delimiter))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2109 ;; if empty quotes, complain
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2110 (forward-char 1)
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2111 (if (not (or (equal (buffer-substring-no-properties
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2112 begin-name
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2113 (+ begin-name 3))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2114 "OPT")
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2115 (equal (buffer-substring-no-properties
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2116 begin-name
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2117 (+ begin-name 3))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2118 "opt")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2119 (error "Mandatory field ``%s'' is empty"
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2120 (buffer-substring-no-properties
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2121 begin-name end-name))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2122 (t
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2123 (goto-char end-field)))))))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2124 (goto-char start)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2125 (bibtex-end-of-entry))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2126 (let* ((eob (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2127 (bibtex-end-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2128 (point)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2129 (key (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2130 (bibtex-beginning-of-entry)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2131 (if (re-search-forward
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2132 bibtex-reference-head eob t)
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2133 (buffer-substring-no-properties
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2134 (match-beginning bibtex-key-in-head)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2135 (match-end bibtex-key-in-head))))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2136 (if (or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2137 arg
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2138 (not key))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2139 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2140 (let ((autokey
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2141 (if bibtex-autokey-edit-before-use
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2142 (read-from-minibuffer "Key to use: "
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2143 (bibtex-generate-autokey))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2144 (bibtex-generate-autokey))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2145 (bibtex-beginning-of-entry)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2146 (re-search-forward bibtex-reference-maybe-empty-head)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2147 (if (match-beginning bibtex-key-in-head)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2148 (delete-region (match-beginning bibtex-key-in-head)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2149 (match-end bibtex-key-in-head)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2150 (insert autokey)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2151 (let ((start (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2152 (bibtex-beginning-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2153 (point)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2154 (end (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2155 (bibtex-end-of-entry)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2156 (re-search-forward "^@" nil 'move)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2157 (beginning-of-line)
10353
363bf89a3081 (bibtex-clean-entry): Killing text while editing
Richard M. Stallman <rms@gnu.org>
parents: 10219
diff changeset
2158 (point)))
363bf89a3081 (bibtex-clean-entry): Killing text while editing
Richard M. Stallman <rms@gnu.org>
parents: 10219
diff changeset
2159 last-command)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2160 (kill-region start end)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2161 (let ((success
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2162 (or
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2163 (not bibtex-maintain-sorted-entries)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2164 (bibtex-find-entry-location autokey t))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2165 (yank)
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2166 (setq kill-ring (cdr kill-ring))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2167 (forward-char -1)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2168 (bibtex-beginning-of-entry)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2169 (re-search-forward bibtex-reference-head)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2170 (if (not success)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2171 (error
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2172 "New inserted reference may be a duplicate."))))))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2173 (save-excursion
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2174 (let ((start (progn (bibtex-beginning-of-entry) (point)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2175 (end (progn (bibtex-end-of-entry) (point))))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2176 (save-restriction
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2177 (narrow-to-region start end)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2178 (bibtex-parse-keys t)))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2179
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2180 (defun bibtex-complete-string ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2181 "Complete word fragment before point to longest prefix of a defined string.
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2182 If point is not after the part of a word, all strings are listed."
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2183 (interactive "*")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2184 (let* ((end (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2185 (beg (save-excursion
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2186 (re-search-backward "[ \t{\"]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2187 (forward-char 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2188 (point)))
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2189 (part-of-word (buffer-substring-no-properties beg end))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2190 (string-list (copy-sequence bibtex-completion-candidates))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2191 (case-fold-search t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2192 (completion (save-excursion
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2193 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2194 (while (re-search-backward
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2195 bibtex-string (point-min) t)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2196 (setq string-list
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2197 (cons
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2198 (list
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2199 (buffer-substring-no-properties
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2200 (match-beginning bibtex-key-in-string)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2201 (match-end bibtex-key-in-string)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2202 string-list)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2203 (setq string-list
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2204 (sort string-list
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2205 (lambda(x y)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2206 (string-lessp
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2207 (car x)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2208 (car y)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2209 (try-completion part-of-word string-list)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2210 (cond ((eq completion t)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2211 (bibtex-remove-double-quotes-or-braces))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2212 ((null completion)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2213 (error "Can't find completion for \"%s\"" part-of-word))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2214 ((not (string= part-of-word completion))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2215 (delete-region beg end)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2216 (insert completion)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2217 (if (assoc completion string-list)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2218 (bibtex-remove-double-quotes-or-braces)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2219 (t
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2220 (message "Making completion list...")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2221 (let ((list (all-completions part-of-word string-list)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2222 (with-output-to-temp-buffer "*Completions*"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2223 (display-completion-list list)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2224 (message "Making completion list...done")))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2225
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2226 (defun bibtex-Article ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2227 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2228 (bibtex-entry "Article"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2229
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2230 (defun bibtex-Book ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2231 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2232 (bibtex-entry "Book"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2233
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2234 (defun bibtex-Booklet ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2235 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2236 (bibtex-entry "Booklet"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2237
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2238 (defun bibtex-InBook ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2239 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2240 (bibtex-entry "InBook"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2241
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2242 (defun bibtex-InCollection ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2243 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2244 (bibtex-entry "InCollection"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2245
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2246 (defun bibtex-InProceedings ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2247 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2248 (bibtex-entry "InProceedings"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2249
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2250 (defun bibtex-Manual ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2251 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2252 (bibtex-entry "Manual"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2253
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2254 (defun bibtex-MastersThesis ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2255 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2256 (bibtex-entry "MastersThesis"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2257
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2258 (defun bibtex-Misc ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2259 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2260 (bibtex-entry "Misc"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2261
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2262 (defun bibtex-PhdThesis ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2263 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2264 (bibtex-entry "PhdThesis"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2265
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2266 (defun bibtex-Proceedings ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2267 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2268 (bibtex-entry "Proceedings"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2269
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2270 (defun bibtex-TechReport ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2271 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2272 (bibtex-entry "TechReport"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2273
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2274 (defun bibtex-Unpublished ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2275 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2276 (bibtex-entry "Unpublished"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2277
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2278 (defun bibtex-string ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2279 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2280 (bibtex-move-outside-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2281 (insert
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2282 (concat
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2283 "@string{ = "
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2284 bibtex-field-left-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2285 bibtex-field-right-delimiter
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2286 "}\n"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2287 (forward-line -1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2288 (forward-char 8))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2289
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2290 (defun bibtex-preamble ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2291 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2292 (bibtex-move-outside-of-entry)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2293 (insert "@Preamble{}\n")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2294 (forward-line -1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2295 (forward-char 10))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2296
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2297
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2298
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
2299 ;; Make BibTeX a Feature
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2300
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2301 (provide 'bibtex)
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
2302
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2303
2602
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
2304 ;;; bibtex.el ends here