annotate lisp/textmodes/bibtex.el @ 31383:860d7ac182e3

(vc-rcs-show-log-entry): New function. (vc-rcs-checkin, vc-rcs-checkout): Don't set all properties. (vc-rcs-register): If there is no RCS subdir, ask the user whether to create one. (vc-rcs-state-heuristic): Use file-ownership-preserved-p. (vc-rcs-checkout): Remove the error-handling for missing-rcs. (vc-rcs-state-heuristic): Don't use file-writable-p. (vc-rcs-print-log): Insert in the current buffer. (vc-rcs-diff): Insert in the current buffer and remove unused arg CMP. (vc-rcs-workfile-unchanged-p): Use vc-do-command instead of vc-simple-command. (vc-rcs-fetch-master-state): Removed check for unlocked-changes to avoid doing a diff when opening a file. (vc-rcs-state): Added check for unlocked-changes. (vc-rcs-header): Escape Id. (vc-rcs-workfile-unchanged-p): Remove optional arg VERSION. (vc-rcs-state): Call vc-workfile-unchanged-p, not the RCS-specific version. (vc-rcs-state-heuristic): Use file-writable-p instead of comparing userids. (vc-rcs-fetch-master-state): Handle the case where rcs is missing. Simplify the logic by eliminating unreachable code. (vc-rcs-diff): Only pass `2' to vc-do-command if necessary and just do a recursive call if we need to retry. (vc-rcs-checkout): Handle the case where rcs is missing by making the buffer read-write if requested and re-signalling the error. (vc-rcs-find-most-recent-rev): New function. The code derives from the old vc-parse-buffer but uses the revision number rather than the date (much easier to compare robustly). (vc-rcs-fetch-master-state): Use `with-temp-buffer'. Adapt to the new vc-parse-buffer (and vc-rcs-find-most-recent-rev). Find the locking-user more directly. Check strict locking and set checkout-model appropriately. (vc-rcs-parse-locks): Remove. (vc-rcs-latest-on-branch-p): Use with-temp-buffer and adapt to the new vc-parse-buffer (and vc-rcs-find-most-recent-rev). (vc-rcs-system-release): Use with-current-buffer and vc-parse-buffer. (vc-rcs-register, vc-rcs-checkout): Use with-current-buffer. Merge in code from vc-rcs-hooks.el. Don't require 'vc anymore. (vc-rcs-responsible-p): Use expand-file-name instead of concat and file-directory-p instead of file-exists-p. (vc-rcs-exists): Remove. (vc-rcs-header): New var. Update Copyright. (vc-rcs-rename-file): New function. (vc-rcs-diff): Remove unused `backend' variable. (vc-rcs-clear-headers): New function; code moved here from vc-clear-headers in vc.el. (tail): Provide vc-rcs and remove vc-rcs-logentry-check. (vc-rcs-register): Parse command output to find master file name and workfile version. (vc-rcs-checkout): Removed call to vc-file-clear-masterprops. Require vc and vc-rcs-hooks. (vc-rcs-trunk-p, vc-rcs-branch-part): Move to vc-rcs-hooks. (vc-rcs-backend-release-p): Remove (use vc-rcs-release-p). (vc-release-greater-or-equal-p): Move from vc. (vc-rcs-trunk-p, vc-rcs-branch-p, vc-rcs-branch-part, vc-rcs-minor-part, vc-rcs-previous-version): Remove duplicates. (vc-rcs-checkout): Add a missing `new-version' argument in the call to vc-rcs-latest-on-branch-p. Hopefully that was the right one. (vc-rcs-steal-lock): Renamed from `vc-rcs-steal'. Updated everything to use `vc-checkout-model'. (vc-rcs-backend-release-p): function added. other stuff updated to reference this function instead of the old `vc-backend-release-p'. (vc-rcs-logentry-check): Function added. (vc-rcs-checkin, vc-rcs-previous-version) (vc-rcs-checkout): Name space cleaned up. No more revision number crunching function names that are not prefixed with vc-rcs. (vc-rcs-checkout-model): Function added. References to `vc-checkout-model' replaced. (vc-rcs-admin): Added the query-only option as required by the vc.el file. (vc-rcs-exists): Function added. (vc-*-checkout): Use with-temp-file instead of /bin/sh. Merged from mainline (vc-rcs-latest-on-branch-p): Moved to vc-rcs-hooks.el. (vc-rcs-latest-on-branch-p, vc-rcs-trunk-p) (vc-rcs-branch-p, vc-rcs-branch-part, vc-rcs-minor-part) (vc-rcs-previous-version): Functions added. (vc-rcs-diff): Function added. (vc-rcs-checkout) Bug (typo) found and fixed. (vc-rcs-register-switches) Variable `vc-rcs-register-switches' added. Require vc when compiling. (vc-rcs-print-log, vc-rcs-assign-name, vc-rcs-merge) (vc-rcs-check-headers, vc-rcs-steal, vc-rcs-uncheck, vc-rcs-revert) (vc-rcs-checkin): New functions (code from vc.el). (vc-rcs-previous-version, vc-rcs-system-release, vc-rcs-checkout): Doc fix. (vc-rcs-release): Deleted. (Duplicated vc-rcs-system-release). (vc-rcs-trunk-p, vc-rcs-branch-p, vc-rcs-branch-part) (vc-rcs-minor-part, vc-rcs-previous-version, vc-rcs-release) (vc-rcs-release-p, vc-rcs-admin, vc-rcs-checkout): New functions from vc.el. (vc-rcs-system-release): Renamed from vc-rcs-backend-release.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 04 Sep 2000 19:47:43 +0000
parents 5e135f0faf1d
children ad7104908c16
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
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
3 ;; Copyright (C) 1992, 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
4
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
5 ;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de>
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
6 ;; Bengt Martensson <bengt@mathematik.uni-Bremen.de>
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>
20359
7fca0e4ce5e8 (bibtex-maintainer-address, bibtex-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 19638
diff changeset
10 ;; Maintainer: Dirk Herrmann <D.Herrmann@tu-bs.de>
10219
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"
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
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
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
41 ;;; Code:
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
42
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
43 (eval-when-compile
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
44 (require 'compile))
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13968
diff changeset
45
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
46
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
47 ;; Bug Reporting
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
48
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
49 (defconst
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
50 bibtex-maintainer-address "Dirk Herrmann <D.Herrmann@tu-bs.de>")
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
51 ;; current maintainer
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
52
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
53 (defconst
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
54 bibtex-maintainer-salutation "Hallo Dirk,")
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
55 ;; current maintainer
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
56
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
57 (defconst
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
58 bibtex-version "(emacs 20.4)")
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
59 ;; current version of the bibtex.el file
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
60
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
61
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
62 ;; User Options:
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
63
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
64 (defgroup bibtex nil
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
65 "BibTeX mode."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
66 :group 'tex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
67 :prefix "bibtex-")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
68
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
69 (defgroup bibtex-autokey nil
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
70 "Generates automatically a key from the author/editor and the title field"
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
71 :group 'bibtex
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
72 :prefix "bibtex-autokey-")
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
73
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
74 (defcustom bibtex-mode-hook nil
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
75 "List of functions to call on entry to BibTeX mode."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
76 :group 'bibtex
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
77 :type 'hook)
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
78
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
79 (defcustom bibtex-field-delimiters 'braces
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
80 "*Controls type of field delimiters used.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
81 Set this to `braces' or `double-quotes' according to your personal
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
82 preferences. This variable is buffer-local."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
83 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
84 :type '(choice (const braces)
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
85 (const double-quotes)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
86 (make-variable-buffer-local 'bibtex-field-delimiters)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
87
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
88 (defcustom bibtex-entry-delimiters 'braces
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
89 "*Controls type of entry delimiters used.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
90 Set this to `braces' or `parentheses' according to your personal
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
91 preferences. This variable is buffer-local."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
92 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
93 :type '(choice (const braces)
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
94 (const parentheses)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
95 (make-variable-buffer-local 'bibtex-entry-delimiters)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
96
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
97 (defcustom bibtex-include-OPTcrossref '("InProceedings" "InCollection")
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
98 "*All entries listed here will have an OPTcrossref field."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
99 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
100 :type '(repeat string))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
101
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
102 (defcustom bibtex-include-OPTkey t
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
103 "*If non-nil, all entries will have an OPTkey field.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
104 If this is a string, it will be used as the initial field text.
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
105 If this is a function, it will be called to generate the initial field text."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
106 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
107 :type '(choice (const :tag "None" nil)
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
108 (string :tag "Initial text")
22599
a9b371a8e835 (bibtex-include-OPTkey): Use `other' widget
Andreas Schwab <schwab@suse.de>
parents: 22563
diff changeset
109 (function :tag "Initialize Function" :value fun)
a9b371a8e835 (bibtex-include-OPTkey): Use `other' widget
Andreas Schwab <schwab@suse.de>
parents: 22563
diff changeset
110 (other :tag "Default" t)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
111
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
112 (defcustom bibtex-user-optional-fields
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
113 '(("annote" "Personal annotation (ignored)"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
114 "*List of optional fields the user wants to have always present.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
115 Entries should be of the same form as the OPTIONAL and
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
116 CROSSREF-OPTIONAL lists in `bibtex-entry-field-alist' (see documentation
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
117 of this variable for details)."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
118 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
119 :type '(repeat
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
120 (group (string :tag "Field")
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
121 (string :tag "Comment")
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
122 (option (group :inline t
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
123 :extra-offset -4
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
124 (choice :tag "Init" :value ""
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
125 string
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
126 function))))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
127
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
128 (defcustom bibtex-entry-format '(opts-or-alts numerical-fields)
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
129 "*Controls type of formatting performed by `bibtex-clean-entry'.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
130 It may be t, nil, or a list of symbols out of the following:
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
131 opts-or-alts Delete empty optional and alternative fields and
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
132 remove OPT and ALT prefixes from used fields.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
133 numerical-fields Delete delimiters around numeral fields.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
134 page-dashes Change double dashes in page field to single dash
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
135 (for scribe compatibility).
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
136 inherit-booktitle If entry contains a crossref field and booktitle
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
137 field is empty, it is set to the contents of the
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
138 title field of the crossreferenced entry.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
139 Caution: this will work only if buffer is
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
140 correctly sorted.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
141 realign Realign entries, so that field texts and perhaps equal
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
142 signs (depending on the value of
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
143 `bibtex-align-at-equal-sign') begin in the same column.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
144 last-comma Add or delete comma on end of last field in entry,
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
145 according to value of `bibtex-comma-after-last-field'.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
146 delimiters Change delimiters according to variables
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
147 `bibtex-field-delimiters' and `bibtex-entry-delimiters'.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
148 unify-case Change case of entry and field names.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
149
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
150 The value t means do all of the above formatting actions.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
151 The value nil means do no formatting at all."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
152 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
153 :type '(choice (const :tag "None" nil)
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
154 (const :tag "All" t)
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
155 (set :menu-tag "Some"
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
156 (const opts-or-alts)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
157 (const numerical-fields)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
158 (const page-dashes)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
159 (const inherit-booktitle)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
160 (const realign)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
161 (const last-comma)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
162 (const delimiters)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
163 (const unify-case))))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
165 (defcustom bibtex-clean-entry-hook nil
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
166 "*List of functions to call when entry has been cleaned.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
167 Functions are called with point inside the cleaned entry, and the buffer
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
168 narrowed to just the entry."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
169 :group 'bibtex
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
170 :type 'hook)
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
171
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
172 (defcustom bibtex-sort-ignore-string-entries t
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
173 "*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
174 That means they are ignored when determining ordering of the buffer
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
175 (e.g., sorting, locating alphabetical position for new entries, etc.).
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
176 This variable is buffer-local."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
177 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
178 :type 'boolean)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
179 (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
180
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
181 (defcustom bibtex-maintain-sorted-entries nil
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
182 "*If non-nil, BibTeX mode maintains all BibTeX entries in sorted order.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
183 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
184 completion for reference keys in minibuffer, automatic detection of
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
185 duplicates) from BibTeX mode. See also `bibtex-sort-ignore-string-entries'.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
186 This variable is buffer-local."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
187 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
188 :type 'boolean)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
189 (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
190
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
191 (defcustom bibtex-field-kill-ring-max 20
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
192 "*Max length of `bibtex-field-kill-ring' before discarding oldest elements."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
193 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
194 :type 'integer)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
195
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
196 (defcustom bibtex-entry-kill-ring-max 20
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
197 "*Max length of `bibtex-entry-kill-ring' before discarding oldest elements."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
198 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
199 :type 'integer)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
200
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
201 (defcustom bibtex-parse-keys-timeout 60
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
202 "*Specifies interval for parsing buffers.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
203 All BibTeX buffers in Emacs are parsed if Emacs has been idle
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
204 `bibtex-parse-keys-timeout' seconds. Only buffers which were modified
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
205 after last parsing and which are maintained in sorted order are parsed."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
206 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
207 :type 'integer)
15637
405b1ecbf8ba (bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents: 15565
diff changeset
208
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
209 (defvar bibtex-entry-field-alist
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
210 '(
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
211 ("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
212 ("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
213 ("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
214 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
215 (("volume" "Volume of the journal")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
216 ("number" "Number of the journal (only allowed if entry contains volume)")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
217 ("pages" "Pages in the journal")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
218 ("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
219 ("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
220 ((("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
221 ("title" "Title of the article (BibTeX converts it to lowercase)"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
222 (("pages" "Pages in the journal")
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
223 ("journal" "Name of the journal (use string, remove braces)")
10219
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 ("volume" "Volume of the journal")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
226 ("number" "Number of the journal")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
227 ("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
228 ("note" "Remarks to be put at the end of the \\bibitem")))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
229 ("Book" . (((("author" "Author1 [and Author2 ...] [and others]" "" t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
230 ("editor" "Editor1 [and Editor2 ...] [and others]" "" t)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
231 ("title" "Title of the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
232 ("publisher" "Publishing company")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
233 ("year" "Year of publication"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
234 (("volume" "Volume of the book in the series")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
235 ("number" "Number of the book in a small series (overwritten by volume)")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
236 ("series" "Series in which the book appeared")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
237 ("address" "Address of the publisher")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
238 ("edition" "Edition of the book as a capitalized English word")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
239 ("month" "Month of the publication as a string (remove braces)")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
240 ("note" "Remarks to be put at the end of the \\bibitem")))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
241 ((("author" "Author1 [and Author2 ...] [and others]" "" t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
242 ("editor" "Editor1 [and Editor2 ...] [and others]" "" t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
243 ("title" "Title of the book"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
244 (("publisher" "Publishing company")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
245 ("year" "Year of publication")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
246 ("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
247 ("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
248 ("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
249 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
250 ("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
251 ("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
252 ("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
253 ("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
254 (("author" "Author1 [and Author2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
255 ("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
256 ("address" "Address of the publisher")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
257 ("month" "Month of the publication as a string (remove braces)")
10219
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 ("note" "Remarks to be put at the end of the \\bibitem")))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
260 ("InBook" . (((("author" "Author1 [and Author2 ...] [and others]" "" t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
261 ("editor" "Editor1 [and Editor2 ...] [and others]" "" t)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
262 ("title" "Title of the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
263 ("chapter" "Chapter in the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
264 ("publisher" "Publishing company")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
265 ("year" "Year of publication"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
266 (("volume" "Volume of the book in the series")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
267 ("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
268 ("series" "Series in which the book appeared")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
269 ("type" "Word to use instead of \"chapter\"")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
270 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
271 ("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
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 ("pages" "Pages in the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
274 ("note" "Remarks to be put at the end of the \\bibitem")))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
275 ((("author" "Author1 [and Author2 ...] [and others]" "" t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
276 ("editor" "Editor1 [and Editor2 ...] [and others]" "" t)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
277 ("title" "Title of the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
278 ("chapter" "Chapter in the book"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
279 (("pages" "Pages in the book")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
280 ("publisher" "Publishing company")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
281 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
282 ("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
283 ("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
284 ("series" "Series in which the book appeared")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
285 ("type" "Word to use instead of \"chapter\"")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
286 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
287 ("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
288 ("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
289 ("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
290 ("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
291 ("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
292 ("booktitle" "Name of the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
293 ("publisher" "Publishing company")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
294 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
295 (("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
296 ("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
297 ("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
298 ("series" "Series in which the book appeared")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
299 ("type" "Word to use instead of \"chapter\"")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
300 ("chapter" "Chapter in the book")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
301 ("pages" "Pages in the book")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
302 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
303 ("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
304 ("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
305 ("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
306 ((("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
307 ("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
308 ("booktitle" "Name of the book"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
309 (("pages" "Pages in the book")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
310 ("publisher" "Publishing company")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
311 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
312 ("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
313 ("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
314 ("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
315 ("series" "Series in which the book appeared")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
316 ("type" "Word to use instead of \"chapter\"")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
317 ("chapter" "Chapter in the book")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
318 ("address" "Address of the publisher")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
319 ("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
320 ("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
321 ("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
322 ("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
323 ("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
324 ("booktitle" "Name of the conference proceedings")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
325 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
326 (("editor" "Editor1 [and Editor2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
327 ("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
328 ("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
329 ("series" "Series in which the conference proceedings appeared")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
330 ("pages" "Pages in the conference proceedings")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
331 ("address" "Location of the Proceedings")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
332 ("month" "Month of the publication as a string (remove braces)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
333 ("organization" "Sponsoring organization of the conference")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
334 ("publisher" "Publishing company, its location")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
335 ("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
336 ((("author" "Author1 [and Author2 ...] [and others]")
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
337 ("title" "Title of the article in proceedings (BibTeX converts it to lowercase)"))
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
338 (("booktitle" "Name of the conference proceedings")
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
339 ("pages" "Pages in the conference proceedings")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
340 ("year" "Year of publication")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
341 ("editor" "Editor1 [and Editor2 ...] [and others]")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
342 ("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
343 ("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
344 ("series" "Series in which the conference proceedings appeared")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
345 ("address" "Location of the Proceedings")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
346 ("month" "Month of the publication as a string (remove braces)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
347 ("organization" "Sponsoring organization of the conference")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
348 ("publisher" "Publishing company, its location")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
349 ("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
350 ("Manual" . (((("title" "Title of the manual"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
351 (("author" "Author1 [and Author2 ...] [and others]")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
352 ("organization" "Publishing organization of the manual")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
353 ("address" "Address of the organization")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
354 ("edition" "Edition of the manual as a capitalized English word")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
355 ("month" "Month of the publication as a string (remove braces)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
356 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
357 ("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
358 ("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
359 ("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
360 ("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
361 ("year" "Year of publication"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
362 (("type" "Type of the master\'s thesis (if other than \"Master\'s thesis\")")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
363 ("address" "Address of the school (if not part of field \"school\") or country")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
364 ("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
365 ("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
366 ("Misc" . ((()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
367 (("author" "Author1 [and Author2 ...] [and others]")
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
368 ("title" "Title of the work (BibTeX converts it to lowercase)")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
369 ("howpublished" "The way in which the work was published")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
370 ("month" "Month of the publication as a string (remove braces)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
371 ("year" "Year of publication")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
372 ("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
373 ("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
374 ("title" "Title of the PhD. thesis")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
375 ("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
376 ("year" "Year of publication"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
377 (("type" "Type of the PhD. thesis")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
378 ("address" "Address of the school (if not part of field \"school\") or country")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
379 ("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
380 ("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
381 ("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
382 ("year" "Year of publication"))
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
383 (("booktitle" "Title of the proceedings for cross references")
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
384 ("editor" "Editor1 [and Editor2 ...] [and others]")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
385 ("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
386 ("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
387 ("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
388 ("address" "Location of the Proceedings")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
389 ("month" "Month of the publication as a string (remove braces)")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
390 ("organization" "Sponsoring organization of the conference")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
391 ("publisher" "Publishing company, its location")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
392 ("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
393 ("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
394 ("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
395 ("institution" "Sponsoring institution of the report")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
396 ("year" "Year of publication"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
397 (("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
398 ("number" "Number of the technical report")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
399 ("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
400 ("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
401 ("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
402 ("Unpublished" . (((("author" "Author1 [and Author2 ...] [and others]")
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
403 ("title" "Title of the unpublished work (BibTeX converts it to lowercase)")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
404 ("note" "Remarks to be put at the end of the \\bibitem"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
405 (("month" "Month of the publication as a string (remove braces)")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
406 ("year" "Year of publication")))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
407 )
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
408
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
409 "Defines entry types and their associated fields.
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
410 List of
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
411 (ENTRY-NAME (REQUIRED OPTIONAL) (CROSSREF-REQUIRED CROSSREF-OPTIONAL))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
412 triples.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
413 If the third element is nil, the first pair is always used.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
414 If not, the second pair is used in the case of presence of a crossref
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
415 field and the third in the case of absence.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
416 REQUIRED, OPTIONAL, CROSSREF-REQUIRED and CROSSREF-OPTIONAL are lists.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
417 Each element of these lists is a list of the form
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
418 (FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG).
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
419 COMMENT-STRING, INIT, and ALTERNATIVE-FLAG are optional.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
420 FIELD-NAME is the name of the field, COMMENT-STRING the comment to
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
421 appear in the echo area, INIT is either the initial content of the
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
422 field or a function, which is called to determine the initial content
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
423 of the field, and ALTERNATIVE-FLAG (either nil or t) marks if the
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
424 field is an alternative. ALTERNATIVE-FLAG may be t only in the
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
425 REQUIRED or CROSSREF-REQUIRED lists.")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
426
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
427 (defvar bibtex-comment-start "@Comment ")
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
428
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
429 (defcustom bibtex-add-entry-hook nil
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
430 "List of functions to call when entry has been inserted."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
431 :group 'bibtex
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
432 :type 'hook)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
433
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
434 (defcustom bibtex-predefined-month-strings
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
435 '(
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
436 ("jan") ("feb") ("mar") ("apr") ("may") ("jun")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
437 ("jul") ("aug") ("sep") ("oct") ("nov") ("dec")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
438 )
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
439 "Alist of month string definitions.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
440 Should contain all strings used for months in the BibTeX style files.
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
441 Each element is a list with just one element: the string."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
442 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
443 :type '(repeat
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
444 (list string)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
445
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
446 (defcustom bibtex-predefined-strings
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
447 (append
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
448 bibtex-predefined-month-strings
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
449 '(
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
450 ("acmcs") ("acta") ("cacm") ("ibmjrd") ("ibmsj") ("ieeese")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
451 ("ieeetc") ("ieeetcad") ("ipl") ("jacm") ("jcss") ("scp")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
452 ("sicomp") ("tcs") ("tocs") ("tods") ("tog") ("toms") ("toois")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
453 ("toplas")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
454 ))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
455 "Alist of string definitions.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
456 Should contain the strings defined in the BibTeX style files. Each
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
457 element is a list with just one element: the string."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
458 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
459 :type '(repeat
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
460 (list string)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
461
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
462 (defcustom bibtex-string-files nil
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
463 "*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
464 Those files must be specified using pathnames relative to the
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
465 directories specified in `bibtex-string-file-path'. This variable is only
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
466 evaluated when BibTeX mode is entered (i.e., when loading the BibTeX
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
467 file)."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
468 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
469 :type '(repeat file))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
470
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
471 (defvar bibtex-string-file-path (getenv "BIBINPUTS")
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
472 "*Colon separated list of paths to search for `bibtex-string-files'.")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
473
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
474 (defcustom bibtex-help-message t
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
475 "*If not nil print help messages in the echo area on entering a new field."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
476 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
477 :type 'boolean)
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
478
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
479 (defcustom bibtex-autokey-prefix-string ""
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
480 "*String to use as a prefix for all generated keys.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
481 See the documentation of function `bibtex-generate-autokey' for more detail."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
482 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
483 :type 'string)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
484
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
485 (defcustom bibtex-autokey-names 1
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
486 "*Number of names to use for the automatically generated reference key.
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
487 If this is variable is nil, all names are used.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
488 Possibly more names are used according to `bibtex-autokey-names-stretch'.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
489 See the documentation of function `bibtex-generate-autokey' for more detail."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
490 :group 'bibtex-autokey
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
491 :type '(choice (const :tag "All" infty)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
492 integer))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
493
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
494 (defcustom bibtex-autokey-names-stretch 0
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
495 "*Number of names that can additionally be used.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
496 These names are used only, if all names are used then.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
497 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
498 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
499 :type 'integer)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
500
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
501 (defcustom bibtex-autokey-additional-names ""
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
502 "*String to prepend to the generated key if not all names could be used.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
503 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
504 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
505 :type 'string)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
506
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
507 (defvar bibtex-autokey-transcriptions
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
508 '(
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
509 ;; language specific characters
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
510 ("\\\\aa" "a")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
511 ("\\\\AA" "A")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
512 ("\\\"a\\|\\\\\\\"a\\|\\\\ae" "ae")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
513 ("\\\"A\\|\\\\\\\"A\\|\\\\AE" "Ae")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
514 ("\\\\i" "i")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
515 ("\\\\j" "j")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
516 ("\\\\l" "l")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
517 ("\\\\L" "L")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
518 ("\\\"o\\|\\\\\\\"o\\|\\\\o\\|\\\\oe" "oe")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
519 ("\\\"O\\|\\\\\\\"O\\|\\\\O\\|\\\\OE" "Oe")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
520 ("\\\"s\\|\\\\\\\"s" "ss")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
521 ("\\\"u\\|\\\\\\\"u" "ue")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
522 ("\\\"U\\|\\\\\\\"U" "Ue")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
523 ;; accents
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
524 ("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" "")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
525 ;; braces
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
526 ("{" "") ("}" ""))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
527 "Alist of (old-regexp new-string) pairs.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
528 Used by the default values of `bibtex-autokey-name-change-strings' and
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
529 `bibtex-autokey-titleword-change-strings'. Defaults to translating some
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
530 language specific characters to their ASCII transcriptions, and
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
531 removing any character accents.")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
532
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
533 (defcustom bibtex-autokey-name-change-strings
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
534 bibtex-autokey-transcriptions
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
535 "Alist of (OLD-REGEXP NEW-STRING) pairs.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
536 Any part of name matching a OLD-REGEXP is replaced by NEW-STRING.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
537 Case is significant in OLD-REGEXP. All regexps are tried in the
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
538 order in which they appear in the list, so be sure to avoid inifinite
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
539 loops here.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
540 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
541 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
542 :type '(repeat
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
543 (list (regexp :tag "Old")
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
544 (string :tag "New"))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
545
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
546 (defcustom bibtex-autokey-name-case-convert 'downcase
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
547 "*Function called for each name to perform case conversion.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
548 See the documentation of function `bibtex-generate-autokey' for more detail."
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
549 :group 'bibtex-autokey
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
550 :type '(choice (const :tag "Preserve case" identity)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
551 (const :tag "Downcase" downcase)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
552 (const :tag "Capitalize" capitalize)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
553 (const :tag "Upcase" upcase)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
554 (function :tag "Conversion function")))
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
555
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
556 (defcustom bibtex-autokey-name-length 'infty
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
557 "*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
558 If this is set to anything but a number, all characters are used.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
559 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
560 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
561 :type '(choice (const :tag "All" infty)
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
562 integer))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
563
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
564 (defcustom bibtex-autokey-name-separator ""
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
565 "*String that comes between any two names in the key.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
566 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
567 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
568 :type 'string)
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
569
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
570 (defcustom bibtex-autokey-year-length 2
20866
2501e131622d (bibtex-autokey-year-length): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 20459
diff changeset
571 "*Number of rightmost digits from the year field to incorporate into key.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
572 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
573 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
574 :type 'integer)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
575
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
576 (defcustom bibtex-autokey-year-use-crossref-entry t
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
577 "*If non-nil use year field from crossreferenced entry if necessary.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
578 If this variable is non-nil and the current entry has no year, but a
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
579 valid crossref entry, the year field from the crossreferenced entry is
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
580 used.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
581 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
582 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
583 :type 'boolean)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
584
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
585 (defcustom bibtex-autokey-titlewords 5
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
586 "*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
587 If this is set to anything but a number, all title words are used.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
588 Possibly more words from the title are used according to
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
589 `bibtex-autokey-titlewords-stretch'.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
590 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
591 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
592 :type '(choice (const :tag "All" infty)
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
593 integer))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
594
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
595 (defcustom bibtex-autokey-title-terminators
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
596 '("\\." "!" "\\?" ":" ";" "--")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
597 "*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
598 Case of the regexps is ignored.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
599 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
600 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
601 :type '(repeat regexp))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
602
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
603 (defcustom bibtex-autokey-titlewords-stretch 2
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
604 "*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
605 These words are used only, if a sentence from the title can be ended then.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
606 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
607 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
608 :type 'integer)
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
609
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
610 (defcustom bibtex-autokey-titleword-ignore
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
611 '("A" "An" "On" "The" "Eine?" "Der" "Die" "Das"
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
612 "[^A-Z].*" ".*[^a-zA-Z0-9].*")
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
613 "*Determines words from the title that are not to be used in the key.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
614 Each item of the list is a regexp. If a word of the title matchs a
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
615 regexp from that list, it is not included in the title part of the key.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
616 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
617 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
618 :type '(repeat regexp))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
619
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
620 (defcustom bibtex-autokey-titleword-case-convert 'downcase
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
621 "*Function called for each titleword to perform case conversion.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
622 See the documentation of function `bibtex-generate-autokey' for more detail."
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
623 :group 'bibtex-autokey
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
624 :type '(choice (const :tag "Preserve case" identity)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
625 (const :tag "Downcase" downcase)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
626 (const :tag "Capitalize" capitalize)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
627 (const :tag "Upcase" upcase)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
628 (function :tag "Conversion function")))
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
629
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
630 (defcustom bibtex-autokey-titleword-abbrevs nil
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
631 "*Determines exceptions to the usual abbreviation mechanism.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
632 An alist of (OLD-REGEXP NEW-STRING) pairs. Case is ignored
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
633 in matching against OLD-REGEXP, and the first matching pair is used.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
634 See the documentation of function `bibtex-generate-autokey' for details.")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
635
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
636 (defcustom bibtex-autokey-titleword-change-strings
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
637 bibtex-autokey-transcriptions
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
638 "Alist of (OLD-REGEXP NEW-STRING) pairs.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
639 Any part of title word matching a OLD-REGEXP is replaced by NEW-STRING.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
640 Case is significant in OLD-REGEXP. All regexps are tried in the
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
641 order in which they appear in the list, so be sure to avoid inifinite
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
642 loops here.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
643 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
644 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
645 :type '(repeat
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
646 (list (regexp :tag "Old")
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
647 (string :tag "New"))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
648
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
649 (defcustom bibtex-autokey-titleword-length 5
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
650 "*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
651 If this is set to anything but a number, all characters are used.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
652 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
653 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
654 :type '(choice (const :tag "All" infty)
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
655 integer))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
656
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
657 (defcustom bibtex-autokey-titleword-separator "_"
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
658 "*String to be put between the title words.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
659 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
660 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
661 :type 'string)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
662
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
663 (defcustom bibtex-autokey-name-year-separator ""
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
664 "*String to be put between name part and year part of key.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
665 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
666 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
667 :type 'string)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
668
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
669 (defcustom bibtex-autokey-year-title-separator ":_"
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
670 "*String to be put between name part and year part of key.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
671 See the documentation of function `bibtex-generate-autokey' for details."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
672 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
673 :type 'string)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
674
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
675 (defcustom bibtex-autokey-edit-before-use t
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
676 "*If non-nil, user is allowed to edit the generated key before it is used."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
677 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
678 :type 'boolean)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
679
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
680 (defcustom bibtex-autokey-before-presentation-function nil
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
681 "Function to call before the generated key is presented.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
682 If non-nil this should be a single function, which is called before
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
683 the generated key is presented (in entry or, if
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
684 `bibtex-autokey-edit-before-use' is t, in minibuffer). This function
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
685 must take one argument (the automatically generated key), and must
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
686 return with a string (the key to use)."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
687 :group 'bibtex-autokey
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
688 :type 'function)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
689
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
690 (defcustom bibtex-entry-offset 0
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
691 "*Offset for BibTeX entries.
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
692 Added to the value of all other variables which determine colums."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
693 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
694 :type 'integer)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
695
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
696 (defcustom bibtex-field-indentation 2
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
697 "*Starting column for the name part in BibTeX fields."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
698 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
699 :type 'integer)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
700
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
701 (defcustom bibtex-text-indentation
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
702 (+
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
703 bibtex-field-indentation
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
704 (length "organization = "))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
705 "*Starting column for the text part in BibTeX fields.
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
706 Should be equal to the space needed for the longest name part."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
707 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
708 :type 'integer)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
709
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
710 (defcustom bibtex-contline-indentation
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
711 (+ bibtex-text-indentation 1)
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
712 "*Starting column for continuation lines of BibTeX fields."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
713 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
714 :type 'integer)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
715
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
716 (defcustom bibtex-align-at-equal-sign nil
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
717 "*If non-nil, align fields at equal sign instead of field text.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
718 If non-nil, the column for the equal sign is
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
719 the value of `bibtex-text-indentation', minus 2."
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
720 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
721 :type 'boolean)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
722
19460
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
723 (defcustom bibtex-comma-after-last-field nil
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
724 "*If non-nil, a comma is put at end of last field in the entry template."
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
725 :group 'bibtex
f15d80b084d8 Customized.
Richard M. Stallman <rms@gnu.org>
parents: 18502
diff changeset
726 :type 'boolean)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
727
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
728 ;; bibtex-font-lock-keywords is a user option as well, but since the
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
729 ;; patterns used to define this variable are defined in a later
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
730 ;; section of this file, it is defined later.
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
731
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
732 ;; Special support taking care of variants
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
733 (if (boundp 'mark-active)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
734 (defun bibtex-mark-active ()
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
735 ;; In Emacs mark-active indicates if mark is active.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
736 mark-active)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
737 (defun bibtex-mark-active ()
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
738 ;; In XEmacs (mark) returns nil when not active.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
739 (if zmacs-regions (mark) (mark t))))
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
740
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
741 (if (fboundp 'run-with-idle-timer)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
742 ;; timer.el is distributed with Emacs
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
743 (fset 'bibtex-run-with-idle-timer 'run-with-idle-timer)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
744 ;; timer.el is not distributed with XEmacs
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
745 ;; Notice that this does not (yet) pass the arguments, but they
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
746 ;; are not used (yet) in bibtex.el. Fix if needed.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
747 (defun bibtex-run-with-idle-timer (secs repeat function &rest args)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
748 (start-itimer "bibtex" function secs (if repeat secs nil) t)))
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
749
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
750
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
751 ;; Support for hideshow minor mode
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
752 (defun bibtex-hs-forward-sexp (arg)
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
753 "Replacement for `forward-sexp' to be used by `hs-minor-mode'."
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
754 (if (< arg 0)
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
755 (backward-sexp 1)
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
756 (if (looking-at "@\\S(*\\s(")
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
757 (progn
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
758 (goto-char (match-end 0))
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
759 (forward-char -1)
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
760 (forward-sexp 1))
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
761 (forward-sexp 1))))
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
762
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
763 (add-to-list
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
764 'hs-special-modes-alist
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
765 '(bibtex-mode "@\\S(*\\s(" "\\s)" nil bibtex-hs-forward-sexp nil))
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
766
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
767
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
768 ;; 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
769 (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
770 (let ((st (make-syntax-table)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
771 (modify-syntax-entry ?\" "\"" st)
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
772 (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
773 (modify-syntax-entry ?% "< " st)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
774 (modify-syntax-entry ?' "w " st)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
775 (modify-syntax-entry ?@ "w " st)
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
776 (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
777 (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
778 (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
779 (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
780 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
781
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
782 (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
783 (let ((km (make-sparse-keymap)))
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
784 ;; The Key `C-c&' is reserved for reftex.el
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
785 (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
786 (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
787 (define-key km "\M-\t" 'bibtex-complete-string)
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
788 (define-key km [(meta tab)] 'bibtex-complete-key)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
789 (define-key km "\C-c\"" 'bibtex-remove-delimiters)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
790 (define-key km "\C-c{" 'bibtex-remove-delimiters)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
791 (define-key km "\C-c}" 'bibtex-remove-delimiters)
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
792 (define-key km "\C-c\C-c" 'bibtex-clean-entry)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
793 (define-key km "\C-c\C-q" 'bibtex-fill-entry)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
794 (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
795 (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
796 (define-key km "\C-c\C-n" 'bibtex-pop-next)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
797 (define-key km "\C-c\C-k" 'bibtex-kill-field)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
798 (define-key km "\C-c\M-k" 'bibtex-copy-field-as-kill)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
799 (define-key km "\C-c\C-w" 'bibtex-kill-entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
800 (define-key km "\C-c\M-w" 'bibtex-copy-entry-as-kill)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
801 (define-key km "\C-c\C-y" 'bibtex-yank)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
802 (define-key km "\C-c\M-y" 'bibtex-yank-pop)
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
803 (define-key km "\C-c\C-d" 'bibtex-empty-field)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
804 (define-key km "\C-c\C-f" 'bibtex-make-field)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
805 (define-key km "\C-c$" 'bibtex-ispell-abstract)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
806 (define-key km "\M-\C-a" 'bibtex-beginning-of-entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
807 (define-key km "\M-\C-e" 'bibtex-end-of-entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
808 (define-key km "\C-\M-l" 'bibtex-reposition-window)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
809 (define-key km "\C-\M-h" 'bibtex-mark-entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
810 (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
811 (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
812 (define-key km "\C-c\C-rw" 'widen)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
813 (define-key km "\C-c\C-o" 'bibtex-remove-OPT-or-ALT)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
814 (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
815 (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
816 (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
817 (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
818 (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
819 (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
820 (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
821 (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
822 (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
823 (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
824 (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
825 (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
826 (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
827 (define-key km "\C-c\C-eP" 'bibtex-PhdThesis)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
828 (define-key km "\C-c\C-e\M-p" 'bibtex-Preamble)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
829 (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
830 (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
831 (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
832 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
833
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
834 (easy-menu-define
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
835 bibtex-edit-menu bibtex-mode-map "BibTeX-Edit Menu in BibTeX mode"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
836 '("BibTeX-Edit"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
837 ("Moving inside an Entry"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
838 ["End of Field" bibtex-find-text t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
839 ["Next Field" bibtex-next-field t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
840 ["Beginning of Entry" bibtex-beginning-of-entry t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
841 ["End of Entry" bibtex-end-of-entry t])
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
842 ("Operating on Current Entry"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
843 ["Fill Entry" bibtex-fill-entry t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
844 ["Clean Entry" bibtex-clean-entry t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
845 "--"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
846 ["Kill Entry" bibtex-kill-entry t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
847 ["Copy Entry to Kill Ring" bibtex-copy-entry-as-kill t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
848 ["Paste Most Recently Killed Entry" bibtex-yank t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
849 ["Paste Previously Killed Entry" bibtex-yank-pop t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
850 "--"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
851 ["Ispell Entry" bibtex-ispell-entry t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
852 ["Ispell Entry Abstract" bibtex-ispell-abstract t]
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
853 ["Narrow to Entry" bibtex-narrow-to-entry t]
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
854 "--"
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
855 ["View Cite Locations (RefTeX)" reftex-view-crossref-from-bibtex
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
856 (fboundp 'reftex-view-crossref-from-bibtex)])
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
857 ("Operating on Current Field"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
858 ["Remove Delimiters" bibtex-remove-delimiters t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
859 ["Remove OPT or ALT Prefix" bibtex-remove-OPT-or-ALT t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
860 ["Clear Field" bibtex-empty-field t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
861 "--"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
862 ["Kill Field" bibtex-kill-field t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
863 ["Copy Field to Kill Ring" bibtex-copy-field-as-kill t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
864 ["Paste Most Recently Killed Field" bibtex-yank t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
865 ["Paste Previously Killed Field" bibtex-yank-pop t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
866 "--"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
867 ["Make New Field" bibtex-make-field t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
868 "--"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
869 ["Snatch from Similar Following Field" bibtex-pop-next t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
870 ["Snatch from Similar Preceding Field" bibtex-pop-previous t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
871 "--"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
872 ["String Complete" bibtex-complete-string t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
873 ["Key Complete" bibtex-complete-key t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
874 "--"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
875 ["Help about Current Field" bibtex-print-help-message t])
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
876 ("Operating on Buffer or Region"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
877 ["Validate Entries" bibtex-validate t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
878 ["Sort Entries" bibtex-sort-buffer t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
879 ["Reformat Entries" bibtex-reformat t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
880 ["Count Entries" bibtex-count-entries t])
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
881 ("Miscellaneous"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
882 ["Convert Alien Buffer" bibtex-convert-alien t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
883 ["Submit Bug Report" bibtex-submit-bug-report t])))
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
884
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
885 (easy-menu-define
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
886 bibtex-entry-menu bibtex-mode-map "Entry-Types Menu in BibTeX mode"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
887 (list "Entry-Types"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
888 ["Article in Journal" bibtex-Article t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
889 ["Article in Conference Proceedings" bibtex-InProceedings t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
890 ["Article in a Collection" bibtex-InCollection t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
891 ["Chapter or Pages in a Book" bibtex-InBook t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
892 ["Conference Proceedings" bibtex-Proceedings t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
893 ["Book" bibtex-Book t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
894 ["Booklet (Bound, but no Publisher/Institution)" bibtex-Booklet t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
895 ["PhD. Thesis" bibtex-PhdThesis t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
896 ["Master's Thesis" bibtex-MastersThesis t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
897 ["Technical Report" bibtex-TechReport t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
898 ["Technical Manual" bibtex-Manual t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
899 ["Unpublished" bibtex-Unpublished t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
900 ["Miscellaneous" bibtex-Misc t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
901 ["String" bibtex-String t]
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
902 ["Preamble" bibtex-Preamble t]))
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
903
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
904
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
905 ;; 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
906
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
907 (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
908 ;; 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
909 ;; 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
910
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
911 (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
912 ;; 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
913
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
914 (defvar bibtex-field-kill-ring nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
915 ;; Ring of least recently killed fields. At most
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
916 ;; bibtex-field-kill-ring-max items are kept here.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
917
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
918 (defvar bibtex-field-kill-ring-yank-pointer nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
919 ;; The tail of bibtex-field-kill-ring whose car is the last item yanked.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
920
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
921 (defvar bibtex-entry-kill-ring nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
922 ;; Ring of least recently killed entries. At most
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
923 ;; bibtex-entry-kill-ring-max items are kept here.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
924
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
925 (defvar bibtex-entry-kill-ring-yank-pointer nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
926 ;; The tail of bibtex-entry-kill-ring whose car is the last item yanked.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
927
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
928 (defvar bibtex-last-kill-command nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
929 ;; Holds the type of the last kill command (either 'field or 'entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
930
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
931 (defvar bibtex-strings nil)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
932 ;; Candidates for bibtex-complete-string. Initialized from
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
933 ;; bibtex-predefined-strings and bibtex-string-files.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
934 (make-variable-buffer-local 'bibtex-strings)
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
935
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
936 (defvar bibtex-reference-keys nil)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
937 ;; Candidates for TAB completion when entering a reference key using
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
938 ;; the minibuffer. Also used for bibtex-complete-key. Initialized in
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
939 ;; bibtex-mode and updated for each new entry.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
940 (make-variable-buffer-local 'bibtex-reference-keys)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
941
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
942 (defvar bibtex-buffer-last-parsed-tick nil)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
943 ;; 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
944 ;; was parsed for keys the last time.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
945 (make-variable-buffer-local 'bibtex-buffer-last-parsed-tick)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
946
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
947 (defvar bibtex-parse-idle-timer nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
948 ;; Stores if timer is already installed
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
949
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
950 (defvar bibtex-progress-lastperc nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
951 ;; Holds the last reported percentage for the progress message
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
952
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
953 (defvar bibtex-progress-lastmes nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
954 ;; Holds the last reported progress message
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
955
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
956 (defvar bibtex-progress-interval nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
957 ;; Holds the chosen interval
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
958
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
959 (defvar bibtex-key-history nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
960 ;; Used to store the history list for reading keys
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
961
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
962 (defvar bibtex-entry-type-history nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
963 ;; Used to store the history list for reading entry types
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
964
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
965 (defvar bibtex-field-history nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
966 ;; Used to store the history list for reading field names
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
967
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
968 (defvar bibtex-reformat-previous-options nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
969 ;; Used to store the last reformat options given
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
970
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
971 (defvar bibtex-reformat-previous-reference-keys nil)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
972 ;; Used to store the last reformat reference keys option given
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
973
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
974
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
975 ;; Functions to Parse the BibTeX Entries
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
976
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
977 (defconst bibtex-field-name "[^\"#%'(),={} \t\n0-9][^\"#%'(),={} \t\n]*")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
978 ;; Regexp defining the name part of a BibTeX field.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
979
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
980 (defconst bibtex-entry-type (concat "@" bibtex-field-name))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
981 ;; Regexp defining the type part of a BibTeX entry.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
982
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
983 (defconst bibtex-reference-key "[][a-zA-Z0-9.:;?!`'/*@+=|()<>&_^$-]+")
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
984 ;; Regexp defining the reference key part of a BibTeX entry
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
985
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
986 (defun bibtex-parse-nested-braces (nesting-level)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
987 "*Starting on an opening brace, find the corresponding closing brace.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
988 When the function is called, NESTING-LEVEL has to be set to `0'."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
989 (cond ((looking-at "{")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
990 (search-forward-regexp "{[^{}]*")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
991 (bibtex-parse-nested-braces (+ nesting-level 1)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
992 ((looking-at "}")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
993 (forward-char 1)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
994 (if (= nesting-level 1)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
995 (point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
996 (search-forward-regexp "[^{}]*")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
997 (bibtex-parse-nested-braces (- nesting-level 1))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
998 (t nil)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
999
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1000 (defun bibtex-parse-field-string-braced ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1001 "*Parse a field string enclosed by braces.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1002 The field string has to be syntactically correct, which means that the number
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1003 of opening and closing braces has to match. If this is the case, a pair
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1004 containing the start and end position of the field string is returned, nil
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1005 otherwise."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1006 (save-match-data
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1007 (let ((starting-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1008 (end-point nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1009 (if (looking-at "{")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1010 (setq end-point (bibtex-parse-nested-braces 0)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1011 (goto-char starting-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1012 (if end-point
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1013 (cons starting-point end-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1014 nil))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1015
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1016 (defun bibtex-parse-quoted-string ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1017 "*Starting on an opening quote, find the corresponding closing quote."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1018 (let ((rx (concat "\""
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1019 "\\("
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1020 "[^\"\\]" ;; anything but quote or backslash
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1021 "\\|"
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1022 "\\("
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1023 "\\\\\\(.\\|\n\\)" ;; any backslash quoted character
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1024 "\\)"
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1025 "\\)*"
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1026 "\"")))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1027 (if (looking-at rx)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1028 (search-forward-regexp rx nil t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1029 nil)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1030
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1031 (defun bibtex-parse-field-string-quoted ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1032 "*Parse a field string enclosed by quotes.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1033 If a syntactically correct string is found, a pair containing the start and
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1034 end position of the field string is returned, nil otherwise."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1035 (save-match-data
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1036 (let ((starting-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1037 (end-point nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1038 (if (looking-at "\"")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1039 (setq end-point (bibtex-parse-quoted-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1040 (goto-char starting-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1041 (if end-point
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1042 (cons starting-point end-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1043 nil))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1044
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1045 (defun bibtex-parse-field-string ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1046 "*Parse a field string enclosed by braces or quotes.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1047 If a syntactically correct string is found, a pair containing the start and
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1048 end position of the field string is returned, nil otherwise."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1049 (save-match-data
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1050 (let ((starting-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1051 (boundaries (or (bibtex-parse-field-string-braced)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1052 (bibtex-parse-field-string-quoted))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1053 (goto-char starting-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1054 boundaries)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1055
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1056 (defun bibtex-search-forward-field-string (bound)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1057 "*Search forward to find a field string enclosed by braces or quotes.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1058 If a syntactically correct string is found, a pair containing the start and
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1059 end position of the field string is returned, nil otherwise. The search is
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1060 delimited by BOUND."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1061 (save-match-data
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1062 (let ((starting-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1063 (boundaries nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1064 (while (and (not boundaries) (< (point) bound))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1065 (if (search-forward-regexp "[{\"]" bound 'move)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1066 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1067 (goto-char (match-beginning 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1068 (let ((temp-boundaries (or (bibtex-parse-field-string-braced)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1069 (bibtex-parse-field-string-quoted))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1070 (if (and temp-boundaries (<= (cdr temp-boundaries) bound))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1071 (setq boundaries temp-boundaries)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1072 (forward-char 1))))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1073 (goto-char starting-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1074 boundaries)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1075
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1076 (defun bibtex-parse-association (parse-lhs parse-rhs)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1077 "*Parse a string of the format <left hand side = right-hand-side>.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1078 The functions PARSE-LHS and PARSE-RHS are used to parse the corresponding
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1079 substrings. These functions are expected to return nil if parsing is not
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1080 successfull. If both functions return non-nil, a pair containing the returned
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1081 values of the functions PARSE-LHS and PARSE-RHSis returned."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1082 (save-match-data
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1083 (let ((starting-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1084 (left (funcall parse-lhs))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1085 (right nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1086 (if (and left (looking-at "[ \t\n]*=[ \t\n]*"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1087 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1088 (goto-char (match-end 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1089 (setq right (funcall parse-rhs))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1090 (goto-char starting-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1091 (if (and left right)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1092 (cons left right)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1093 nil))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1094
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1095 (defvar bibtex-field-name-for-parsing nil)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1096 ;; Temporary variable storing the name string to be parsed by the callback
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1097 ;; function bibtex-parse-field-name.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1098 (make-variable-buffer-local 'bibtex-field-name-for-parsing)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1099
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1100 (defun bibtex-parse-field-name ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1101 "*Parse the field name stored in bibtex-field-name-for-parsing.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1102 If the field name is found, return a triple consisting of the position of the
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1103 very first character of the match, the actual starting position of the name
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1104 part and end position of the match."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1105 (if (looking-at ",[ \t\n]*")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1106 (let ((start (point)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1107 (goto-char (match-end 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1108 (if (looking-at bibtex-field-name-for-parsing)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1109 (let ((boundaries (list start (match-beginning 0) (match-end 0))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1110 (goto-char (match-end 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1111 boundaries)))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1112
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1113 (defconst bibtex-field-const "[][a-zA-Z0-9.:;?!`'/*@+=|<>&_^$-]+")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1114 ;; Regexp defining a bibtex field constant
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
1115
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1116 (defun bibtex-parse-field-text ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1117 "*Parse the text part of a BibTeX field.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1118 The text part is either a string, or an empty string, or a constant followed
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1119 by one or more <# (string|constant)> pairs. If a syntactically correct text
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1120 is found, a pair containing the start and end position of the text is
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1121 returned, nil otherwise."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1122 (let ((starting-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1123 (end-point nil)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1124 (failure nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1125 (while (and (not end-point) (not failure))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1126 (if (looking-at bibtex-field-const)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1127 (goto-char (match-end 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1128 (let ((boundaries (bibtex-parse-field-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1129 (if boundaries
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1130 (goto-char (cdr boundaries))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1131 (setq failure t))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1132 (if (not (looking-at "[ \t\n]*#[ \t\n]*"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1133 (setq end-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1134 (goto-char (match-end 0))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1135 (if (and (not failure) end-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1136 (cons starting-point end-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1137 nil)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1138
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1139 (defun bibtex-parse-field (name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1140 "*Parse a BibTeX field of regexp NAME.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1141 If a syntactically correct field is found, a pair containing the boundaries of
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1142 the name and text parts of the field is returned."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1143 (setq bibtex-field-name-for-parsing name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1144 (bibtex-parse-association 'bibtex-parse-field-name
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1145 'bibtex-parse-field-text))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1146
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1147 (defun bibtex-search-forward-field (name bound)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1148 "*Search forward to find a field of name NAME.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1149 If a syntactically correct field is found, a pair containing the boundaries of
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1150 the name and text parts of the field is returned. The search is limited by
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1151 BOUND."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1152 (save-match-data
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1153 (setq bibtex-field-name-for-parsing name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1154 (let ((starting-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1155 (boundaries nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1156 (while (and (not boundaries)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1157 (< (point) bound)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1158 (search-forward "," bound t))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1159 (goto-char (match-beginning 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1160 (let ((temp-boundaries
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1161 (bibtex-parse-association 'bibtex-parse-field-name
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1162 'bibtex-parse-field-text)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1163 (if (and temp-boundaries (<= (cdr (cdr temp-boundaries)) bound))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1164 (setq boundaries temp-boundaries)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1165 (forward-char 1))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1166 (goto-char starting-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1167 boundaries)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1168
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1169 (defun bibtex-search-backward-field (name bound)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1170 "*Search backward to find a field of name NAME.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1171 If a syntactically correct field is found, a pair containing the boundaries of
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1172 the name and text parts of the field is returned. The search is limited by
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1173 BOUND."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1174 (save-match-data
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1175 (setq bibtex-field-name-for-parsing name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1176 (let ((starting-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1177 (boundaries nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1178 (while (and (not boundaries)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1179 (>= (point) bound)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1180 (search-backward "," bound t))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1181 (let ((temp-boundaries
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1182 (bibtex-parse-association 'bibtex-parse-field-name
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1183 'bibtex-parse-field-text)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1184 (if temp-boundaries
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1185 (setq boundaries temp-boundaries))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1186 (goto-char starting-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1187 boundaries)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1188
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1189 (defun bibtex-start-of-field (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1190 (car (car bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1191 (defun bibtex-end-of-field (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1192 (cdr (cdr bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1193 (defun bibtex-start-of-name-in-field (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1194 (car (cdr (car bounds))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1195 (defun bibtex-end-of-name-in-field (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1196 (car (cdr (cdr (car bounds)))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1197 (defun bibtex-start-of-text-in-field (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1198 (car (cdr bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1199 (defun bibtex-end-of-text-in-field (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1200 (cdr (cdr bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1201
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1202 (defun bibtex-parse-string-prefix ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1203 "*Parse the prefix part of a bibtex string, including the reference key.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1204 If the string prefix is found, return a triple consisting of the position of
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1205 the very first character of the match, the actual starting position of the
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1206 reference key and the end position of the match."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1207 (let* ((case-fold-search t))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1208 (if (looking-at "^[ \t]*@string[ \t\n]*[({][ \t\n]*")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1209 (let ((start (point)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1210 (goto-char (match-end 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1211 (if (looking-at bibtex-reference-key)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1212 (let ((boundaries (list start (match-beginning 0) (match-end 0))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1213 (goto-char (match-end 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1214 boundaries))))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1215
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1216 (defun bibtex-parse-string-postfix ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1217 "*Parse the postfix part of a bibtex string, including the text.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1218 If the string postfix is found, return a triple consisting of the position of
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1219 the actual starting and ending position of the text and the very last
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1220 character of the string entry."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1221 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1222 (text-boundaries (bibtex-parse-field-text)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1223 (if text-boundaries
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1224 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1225 (goto-char (cdr text-boundaries))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1226 (if (looking-at "[ \t\n]*[})]")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1227 (let ((boundaries (list (car text-boundaries)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1228 (cdr text-boundaries)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1229 (match-end 0))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1230 (goto-char (match-end 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1231 boundaries))))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1232
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1233 (defun bibtex-parse-string ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1234 "*Parse a BibTeX string entry.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1235 If a syntactically correct entry is found, a pair containing the boundaries of
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1236 the reference key and text parts of the entry is returned."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1237 (bibtex-parse-association 'bibtex-parse-string-prefix
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1238 'bibtex-parse-string-postfix))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1239
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1240 (defun bibtex-search-forward-string ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1241 "*Search forward to find a bibtex string entry.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1242 If a syntactically correct entry is found, a pair containing the boundaries of
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1243 the reference key and text parts of the string is returned."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1244 (save-match-data
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1245 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1246 (starting-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1247 (boundaries nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1248 (while (and (not boundaries)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1249 (search-forward-regexp
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1250 "^[ \t]*@string[ \t\n]*[({][ \t\n]*" nil t))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1251 (goto-char (match-beginning 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1252 (let ((temp-boundaries (bibtex-parse-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1253 (if temp-boundaries
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1254 (setq boundaries temp-boundaries)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1255 (forward-char 1))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1256 (goto-char starting-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1257 boundaries)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1258
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1259 (defun bibtex-search-backward-string ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1260 "*Search backward to find a bibtex string entry.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1261 If a syntactically correct entry is found, a pair containing the boundaries of
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1262 the reference key and text parts of the field is returned."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1263 (save-match-data
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1264 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1265 (starting-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1266 (boundaries nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1267 (while (and (not boundaries)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1268 (search-backward-regexp
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1269 "^[ \t]*@string[ \t\n]*[({][ \t\n]*" nil t))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1270 (goto-char (match-beginning 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1271 (let ((temp-boundaries (bibtex-parse-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1272 (if temp-boundaries
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1273 (setq boundaries temp-boundaries))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1274 (goto-char starting-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1275 boundaries)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1276
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1277 (defun bibtex-end-of-string (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1278 (car (cdr (cdr (cdr bounds)))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1279 (defun bibtex-start-of-reference-key-in-string (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1280 (car (cdr (car bounds))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1281 (defun bibtex-end-of-reference-key-in-string (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1282 (car (cdr (cdr (car bounds)))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1283 (defun bibtex-start-of-text-in-string (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1284 (car (cdr bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1285 (defun bibtex-end-of-text-in-string (bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1286 (car (cdr (cdr bounds))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1287
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1288 (defconst bibtex-entry-head
15637
405b1ecbf8ba (bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents: 15565
diff changeset
1289 (concat "^[ \t]*\\("
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1290 bibtex-entry-type
24620
ea2988489a80 (bibtex-reference-head): Allow entries to start with a newline.
Karl Heuer <kwzh@gnu.org>
parents: 22649
diff changeset
1291 "\\)[ \t]*[({][ \t\n]*\\("
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1292 bibtex-reference-key
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1293 "\\)"))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1294 ;; Regexp defining format of the header line of a BibTeX entry.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1295
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1296 (defconst bibtex-entry-maybe-empty-head
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1297 (concat bibtex-entry-head "?"))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1298 ;; Regexp defining format of the header line of a maybe empty
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1299 ;; BibTeX entry (possibly without reference key).
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1300
15637
405b1ecbf8ba (bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents: 15565
diff changeset
1301 (defconst bibtex-type-in-head 1)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1302 ;; The regexp subexpression number of the type part in
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1303 ;; bibtex-entry-head.
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1304
15637
405b1ecbf8ba (bibtex-reference-head): Allow spaces and tabs between
Karl Heuer <kwzh@gnu.org>
parents: 15565
diff changeset
1305 (defconst bibtex-key-in-head 2)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1306 ;; The regexp subexpression number of the key part in
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1307 ;; bibtex-entry-head.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1308
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1309 (defconst bibtex-entry-postfix "[ \t\n]*,?[ \t\n]*[})]")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1310 ;; Regexp defining the postfix of a bibtex entry
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1311
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1312 (defconst bibtex-key-in-entry bibtex-key-in-head)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1313 ;; The regexp subexpression number of the key part in a bibtex 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
1314
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
1315 (defvar bibtex-font-lock-keywords
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
1316 (list
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1317 ;; entry type and reference key
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1318 (list bibtex-entry-maybe-empty-head
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
1319 (list bibtex-type-in-head 'font-lock-function-name-face)
20953
f3f9df46d008 Changed font-lock-reference-face to font-lock-constant-face.
Simon Marshall <simon@gnu.org>
parents: 20907
diff changeset
1320 (list bibtex-key-in-head 'font-lock-constant-face nil t))
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
1321 ;; comments
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1322 (list
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
1323 (concat "^\\([ \t]*" bibtex-comment-start ".*\\)$")
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
1324 1 'font-lock-comment-face)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
1325 ;; optional field names (treated as comments)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1326 (list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1327 (concat "^[ \t]*\\(OPT" bibtex-field-name "\\)[ \t]*=")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1328 1 'font-lock-comment-face)
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
1329 ;; field names
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
1330 (list (concat "^[ \t]*\\(" bibtex-field-name "\\)[ \t]*=")
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
1331 1 'font-lock-variable-name-face)
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
1332 "*Default expressions to highlight in BibTeX mode."))
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
1333 ;; now all needed patterns are defined
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
1334
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1335
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1336
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
1337 ;; 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
1338
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
1339 (defun bibtex-delete-whitespace ()
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1340 ;; Delete all whitespace starting at point
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1341 (if (looking-at "[ \t\n]+")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1342 (delete-region (point) (match-end 0))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1343
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
1344 (defun bibtex-current-line ()
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1345 ;; this computes line number of point regardless whether the buffer
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1346 ;; is narrowed
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1347 (+ (count-lines 1 (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1348 (if (equal (current-column) 0) 1 0)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1349
17700
d28dbbfabfb1 (assoc-ignore-case): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 15852
diff changeset
1350 (defun bibtex-member-of-regexp (string list)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1351 ;; Return non-nil if STRING is exactly matched by an element of
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
1352 ;; LIST. The value is actually the tail of LIST whose
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1353 ;; car matches STRING.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1354 (let* (case-fold-search)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1355 (while
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1356 (and list (not (string-match (concat "^" (car list) "$") string)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1357 (setq list (cdr list)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1358 list))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1359
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
1360 (defun bibtex-assoc-of-regexp (string alist)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1361 ;; Return non-nil if STRING is exactly matched by the car of an
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1362 ;; element of LIST (case ignored). The value is actually the element
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1363 ;; of LIST whose car matches STRING.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1364 (let* ((case-fold-search t))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1365 (while
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1366 (and alist
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1367 (not (string-match (concat "^" (car (car alist)) "$") string)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1368 (setq alist (cdr alist)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1369 (car alist)))
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1370
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
1371 (defun bibtex-skip-to-valid-entry (&optional backward)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1372 ;; If not at beginning of valid BibTeX entry, move to beginning of
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1373 ;; the next valid one. With argument backward non-nil, move backward
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1374 ;; to beginning of previous valid one. A valid entry is a
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1375 ;; syntactical correct one with type contained in
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1376 ;; bibtex-entry-field-alist or, if bibtex-sort-ignore-string-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1377 ;; is nil, a syntactical correct string entry.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1378 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1379 (valid-bibtex-entry
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1380 (concat
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1381 "@[ \t]*\\("
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1382 (mapconcat
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1383 (lambda (type)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1384 (concat "\\(" (car type) "\\)"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1385 bibtex-entry-field-alist
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1386 "\\|")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1387 "\\)"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1388 found)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1389 (while (and (not found)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1390 (not (if backward
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1391 (bobp)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1392 (eobp))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1393 (let ((pnt (point)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1394 (cond
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1395 ((looking-at valid-bibtex-entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1396 (if (and
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1397 (bibtex-search-entry nil nil t)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1398 (equal (match-beginning 0) pnt))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1399 (setq found t)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1400 ((and (not bibtex-sort-ignore-string-entries)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1401 (bibtex-parse-string))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1402 (setq found t)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1403 (if found
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1404 (goto-char pnt)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1405 (if backward
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1406 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1407 (goto-char (1- pnt))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1408 (if (re-search-backward "^[ \t]*\\(@\\)" nil 'move)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1409 (goto-char (match-beginning 1))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1410 (goto-char (1+ pnt))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1411 (if (re-search-forward "^[ \t]*@" nil 'move)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1412 (forward-char -1))))))))
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
1413
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
1414 (defun bibtex-map-entries (fun)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1415 ;; 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
1416 ;; 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
1417 ;; of the entry, and with point inside the entry. If
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1418 ;; bibtex-sort-ignore-string-entries is non-nil, FUN will not be
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1419 ;; called for @String entries.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1420 (let* ((case-fold-search t))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1421 (bibtex-beginning-of-entry)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1422 (while (re-search-forward bibtex-entry-maybe-empty-head nil t)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1423 (let ((pnt (point))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1424 (entry-type
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1425 (downcase (buffer-substring-no-properties
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1426 (1+ (match-beginning bibtex-type-in-head))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1427 (match-end bibtex-type-in-head))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1428 (reference-key
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1429 (if (match-beginning bibtex-key-in-head)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1430 (buffer-substring-no-properties
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1431 (match-beginning bibtex-key-in-head)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1432 (match-end bibtex-key-in-head))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1433 "")))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1434 (if (or
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1435 (and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1436 (not bibtex-sort-ignore-string-entries)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1437 (string-equal "string" (downcase entry-type)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1438 (assoc-ignore-case entry-type bibtex-entry-field-alist))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1439 (funcall fun reference-key))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1440 (goto-char pnt)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1441 (bibtex-end-of-entry)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1442
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1443 (defun bibtex-progress-message (&optional flag interval)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1444 ;; echos a message about progress of current buffer
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1445 ;; if flag is a string, the message is initialized (in this case a
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1446 ;; value for INTERVAL may be given as well (if not this is set to 5))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1447 ;; if flag is done, the message is deinitialized
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1448 ;; if flag is absent, a message is echoed if point was incremented
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1449 ;; at least INTERVAL percent since last message was echoed
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1450 (let* ((size (- (point-max) (point-min)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1451 (perc (if (= size 0)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1452 100
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1453 (/ (* 100 (- (point) (point-min))) size))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1454 (if (or (and (not flag)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1455 (>= perc
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1456 (+ bibtex-progress-interval bibtex-progress-lastperc)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1457 (stringp flag))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1458 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1459 (if (stringp flag)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1460 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1461 (setq bibtex-progress-lastmes flag)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1462 (if interval
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1463 (setq bibtex-progress-interval interval)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1464 (setq bibtex-progress-interval 5))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1465 (setq bibtex-progress-lastperc perc)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1466 (message (concat bibtex-progress-lastmes " (%d%%)") perc))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1467 (if (equal flag 'done)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1468 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1469 (message (concat bibtex-progress-lastmes " (done)"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1470 (setq bibtex-progress-lastmes nil))))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1471
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1472
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1473 (defun bibtex-field-left-delimiter ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1474 ;; returns a string dependent on bibtex-field-delimiters
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1475 (if (equal bibtex-field-delimiters 'braces)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1476 "{"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1477 "\""))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1478
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1479 (defun bibtex-field-right-delimiter ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1480 ;; returns a string dependent on bibtex-field-delimiters
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1481 (if (equal bibtex-field-delimiters 'braces)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1482 "}"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1483 "\""))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1484
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1485 (defun bibtex-entry-left-delimiter ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1486 ;; returns a string dependent on bibtex-field-delimiters
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1487 (if (equal bibtex-entry-delimiters 'braces)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1488 "{"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1489 "("))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1490
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1491 (defun bibtex-entry-right-delimiter ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1492 ;; returns a string dependent on bibtex-field-delimiters
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1493 (if (equal bibtex-entry-delimiters 'braces)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1494 "}"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1495 ")"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1496
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1497 (defun bibtex-search-entry
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1498 (empty-head &optional bound noerror backward)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1499 ;; A helper function necessary since the failure stack size limit for
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1500 ;; regexps was reduced in emacs 19.32.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1501 ;; It searches for a BibTeX entry (maybe without a reference key if
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1502 ;; EMPTY-HEAD is t).
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1503 ;; BOUND and NOERROR are exactly as in re-search-forward. If
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1504 ;; BACKWARD is non-nil, search is done in reverse direction. After
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1505 ;; call to this function MATCH-BEGINNING and MATCH-END functions are
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1506 ;; defined, but only for the head part of the entry (especially
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1507 ;; (match-end 0) just gives the end of the head part).
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1508 (let ((pnt (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1509 (prefix (if empty-head
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1510 bibtex-entry-maybe-empty-head
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1511 bibtex-entry-head)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1512 (if backward
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1513 (let (found)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1514 (while (and (not found)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1515 (re-search-backward prefix bound noerror))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1516 (setq found (bibtex-search-entry empty-head pnt t)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1517 (if found
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1518 (goto-char (match-beginning 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1519 (if (equal noerror nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1520 ;; yell
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1521 (error "Search of BibTeX entry failed"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1522 (if (equal noerror t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1523 ;; don't move
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1524 (goto-char pnt))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1525 nil))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1526 (let ((limit (if bound bound (point-max)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1527 md
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1528 found)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1529 (while (and (not found)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1530 (re-search-forward prefix bound noerror))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1531 (setq md (match-data))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1532 ;; save match-data of prefix regexp
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1533 (let ((entry-closer
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1534 (if (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1535 (goto-char (match-end bibtex-type-in-head))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1536 (looking-at "[ \t]*("))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1537 ;; entry opened with parenthesis
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1538 ")"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1539 "}")))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1540 (let ((infix-start (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1541 (finished nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1542 (while (not finished)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1543 (if (and (looking-at "[ \t\n]*")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1544 (<= (match-end 0) limit))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1545 (goto-char (match-end 0)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1546 (let ((bounds (bibtex-parse-field bibtex-field-name)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1547 (if (and bounds (<= (bibtex-end-of-field bounds) limit))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1548 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1549 (goto-char (bibtex-end-of-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1550 (setq infix-start (point)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1551 (goto-char infix-start)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1552 (setq finished t)))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1553 ;; This matches the infix* part. The AND construction assures
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1554 ;; that BOUND is respected.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1555 (if (and (looking-at bibtex-entry-postfix)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1556 (string-equal
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1557 (buffer-substring-no-properties
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1558 (1- (match-end 0)) (match-end 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1559 entry-closer)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1560 (<= (match-end 0) limit))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1561 (progn
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1562 (re-search-forward bibtex-entry-postfix)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1563 (setq found t)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1564 (if found
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1565 (progn
21169
422a28894f3a (bibtex-search-reference): store-match-data => set-match-data.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
1566 (set-match-data md)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1567 ;; to set match-beginning/end again
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1568 (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1569 (if (equal noerror nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1570 ;; yell
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1571 (error "Search of BibTeX entry failed"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1572 (if (equal noerror t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1573 ;; don't move
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1574 (goto-char pnt))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1575 nil)))))
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1576
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1577 (defun bibtex-flash-head ()
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1578 ;; Flash at BibTeX entry head before point, if exists.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1579 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1580 flash)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1581 (cond ((re-search-backward bibtex-entry-head nil t)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1582 (goto-char (match-beginning bibtex-type-in-head))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1583 (setq flash (match-end bibtex-key-in-entry)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1584 (t
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1585 (end-of-line)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1586 (skip-chars-backward " \t")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1587 (setq flash (point))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1588 (beginning-of-line)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1589 (skip-chars-forward " \t")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1590 (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
1591 (sit-for 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1592 (message "From: %s"
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1593 (buffer-substring (point) flash)))))
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1594
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1595 (defun bibtex-make-optional-field (e-t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1596 "Makes an optional field named E-T in current BibTeX entry."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1597 (if (consp e-t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1598 (bibtex-make-field (cons (concat "OPT" (car e-t)) (cdr e-t)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1599 (bibtex-make-field (concat "OPT" e-t))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1600
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1601 (defun bibtex-move-outside-of-entry ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1602 ;; Make sure we are outside of a BibTeX entry.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1603 (let ((orig-point (point)))
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
1604 (bibtex-end-of-entry)
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1605 (if (< (point) orig-point)
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1606 ;; We moved backward, so we weren't inside an entry to begin with.
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1607 ;; Leave point at the beginning of a line, and preferably
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1608 ;; at the beginning of a paragraph.
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1609 (progn
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1610 (goto-char orig-point)
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1611 (beginning-of-line 1)
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1612 (if (not (= ?\n (char-before (1- (point)))))
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1613 (progn
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1614 (re-search-forward "^[ \t]*[@\n]" nil 'move)
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1615 (backward-char 1)))))
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1616 (skip-chars-forward " \t\n")))
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1617
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1618 (defun bibtex-beginning-of-first-entry ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1619 ;; Go to the beginning of the first BibTeX entry in buffer. Return
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1620 ;; point.
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
1621 (goto-char (point-min))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1622 (if (re-search-forward "^[ \t]*@" nil 'move)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1623 (beginning-of-line))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1624 (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1625
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1626 (defun bibtex-beginning-of-last-entry ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1627 ;; Go to the beginning of the last BibTeX entry in buffer.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1628 (goto-char (point-max))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1629 (if (re-search-backward "^[ \t]*@" nil 'move)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1630 (beginning-of-line))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1631 (point))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1632
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1633 (defun bibtex-inside-field ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1634 ;; 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
1635 (end-of-line)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1636 (skip-chars-backward " \t")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1637 (cond ((= (preceding-char) ?,)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1638 (forward-char -2)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1639 (cond ((or
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1640 (= (preceding-char) ?})
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1641 (= (preceding-char) ?\"))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1642 (forward-char -1))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1643
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1644 (defun bibtex-enclosing-field (&optional noerr)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1645 ;; Search for BibTeX field enclosing point. Point moves to end of
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1646 ;; field. Use match-beginning and match-end to parse the field. If
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1647 ;; NOERR is non-nil, no error is signalled. In this case, t is
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1648 ;; returned on success, nil otherwise.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1649 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1650 (old-point (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1651 (boe (bibtex-beginning-of-entry)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1652 (goto-char old-point)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1653 (let ((bounds (bibtex-search-backward-field bibtex-field-name boe)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1654 (if (and bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1655 (<= (bibtex-start-of-field bounds) old-point)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1656 (>= (bibtex-end-of-field bounds) old-point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1657 bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1658 (if noerr
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1659 nil
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1660 (error "Can't find enclosing BibTeX field"))))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1661
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1662 (defun bibtex-enclosing-entry-maybe-empty-head ()
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1663 ;; Search for BibTeX entry enclosing point. Point moves to
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1664 ;; end of entry. Beginning (but not end) of entry is given
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1665 ;; by (match-beginning 0).
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1666 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1667 (old-point (point)))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1668 (if (not
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1669 (re-search-backward
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1670 bibtex-entry-maybe-empty-head nil t))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1671 (progn
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1672 (error "Can't find enclosing BibTeX entry")
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1673 (goto-char old-point)))
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
1674 (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
1675 (if (not
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1676 (bibtex-search-entry t nil t))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1677 (progn
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1678 (error "Can't find enclosing BibTeX entry")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1679 (goto-char old-point)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1680
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1681 (defun bibtex-insert-current-kill (n)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1682 (if (not bibtex-last-kill-command)
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1683 (error "BibTeX kill ring is empty")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1684 (let* ((kr (if (equal bibtex-last-kill-command 'field)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1685 'bibtex-field-kill-ring
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1686 'bibtex-entry-kill-ring))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1687 (kryp (if (equal bibtex-last-kill-command 'field)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1688 'bibtex-field-kill-ring-yank-pointer
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1689 'bibtex-entry-kill-ring-yank-pointer))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1690 (ARGth-kill-element
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1691 (nthcdr
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1692 (mod (- n (length (eval kryp))) (length (eval kr)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1693 (eval kr)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1694 (current (car (set kryp ARGth-kill-element))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1695 (cond
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1696 ((equal bibtex-last-kill-command 'field)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1697 (let (bibtex-help-message)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1698 (bibtex-find-text nil t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1699 (if (looking-at "[}\"]")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1700 (forward-char)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1701 (set-mark (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1702 (message "Mark set")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1703 (bibtex-make-field (list (elt current 1) nil (elt current 2)) t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1704 ((equal bibtex-last-kill-command 'entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1705 (if (not (eobp))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1706 (bibtex-beginning-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1707 (set-mark (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1708 (message "Mark set")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1709 (insert (elt current 1)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1710 (t
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1711 (error
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1712 "Unknown tag field: %s. Please submit a bug report"
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1713 bibtex-last-kill-command))))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1714
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1715 (defun bibtex-format-field-delimiters (start stop)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1716 "*Replaces delimiters for field strings between START and STOP.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1717 If the current delimiters equal the new delimiters, the buffer is not
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1718 changed."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1719 (goto-char start)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1720 (let ((boundaries (bibtex-search-forward-field-string stop)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1721 (while boundaries
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1722 (goto-char (car boundaries))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1723 (if (not (looking-at (bibtex-field-left-delimiter)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1724 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1725 (delete-char 1)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1726 (insert (bibtex-field-left-delimiter))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1727 (goto-char (- (cdr boundaries) 1))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1728 (if (not (looking-at (bibtex-field-right-delimiter)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1729 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1730 (delete-char 1)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1731 (insert (bibtex-field-right-delimiter))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1732 (setq boundaries (bibtex-search-forward-field-string stop)))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1733
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1734 (defun bibtex-format-entry ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1735 ;; Helper function for bibtex-clean-entry. Formats current entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1736 ;; according to variable bibtex-entry-format.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1737 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1738 (beg (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1739 (start (bibtex-beginning-of-entry))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1740 crossref-there
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1741 alternatives-there
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1742 non-empty-alternative)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1743 (let ((end (copy-marker (bibtex-end-of-entry))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1744 (if (equal start (marker-position end))
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1745 (error "Not on a known BibTeX entry")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1746 (goto-char start)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1747 (let ((bounds (bibtex-search-forward-field bibtex-field-name end)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1748 (while bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1749 ;; determine if entry has crossref field and if at least
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1750 ;; one alternative is non-empty
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1751 (let ((begin-name (bibtex-start-of-name-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1752 (end-name (bibtex-end-of-name-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1753 (begin-text (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1754 (end-text (bibtex-end-of-text-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1755 (goto-char begin-name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1756 (if (looking-at "ALT")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1757 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1758 (setq alternatives-there t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1759 (goto-char begin-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1760 (if (not (looking-at "\\(\"\"\\)\\|\\({}\\)"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1761 (setq non-empty-alternative t))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1762 (if (string-match
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1763 "\\(OPT\\)?crossref"
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1764 (buffer-substring-no-properties begin-name end-name))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1765 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1766 (setq
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1767 crossref-there
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1768 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1769 (1+ begin-text) (1- end-text)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1770 (if (equal crossref-there "")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1771 (setq crossref-there nil)))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1772 (goto-char (bibtex-end-of-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1773 (setq bounds (bibtex-search-forward-field bibtex-field-name end))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1774 (if (and alternatives-there
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1775 (not non-empty-alternative))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1776 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1777 (goto-char beg)
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1778 (error "All alternatives are empty")))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1779 (goto-char start)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1780 (re-search-forward bibtex-entry-type end)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1781 (let* ((begin-type (1+ (match-beginning 0)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1782 (end-type (match-end 0))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1783 (entry-type
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1784 (downcase
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1785 (buffer-substring-no-properties begin-type end-type)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1786 (entry-list
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1787 (assoc-ignore-case entry-type bibtex-entry-field-alist))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1788 (req (elt (elt entry-list 1) 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1789 (creq (elt (elt entry-list 2) 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1790 (format (if (equal bibtex-entry-format t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1791 '(realign opts-or-alts numerical-fields
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1792 last-comma page-dashes delimiters
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1793 unify-case inherit-booktitle)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1794 bibtex-entry-format))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1795 field-done)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1796 (if (memq 'unify-case format)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1797 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1798 (delete-region begin-type end-type)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1799 (insert (car entry-list))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1800 (if (memq 'delimiters format)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1801 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1802 (goto-char end-type)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1803 (skip-chars-forward " \t\n")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1804 (delete-char 1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1805 (insert (bibtex-entry-left-delimiter))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1806 (goto-char start)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1807 (let ((bounds (bibtex-search-forward-field bibtex-field-name end)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1808 (while bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1809 (let* ((begin-field (copy-marker (bibtex-start-of-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1810 (end-field (copy-marker (bibtex-end-of-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1811 (begin-name (copy-marker (bibtex-start-of-name-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1812 (end-name (copy-marker (bibtex-end-of-name-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1813 (begin-text (copy-marker (bibtex-start-of-text-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1814 (end-text (copy-marker (bibtex-end-of-text-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1815 (field-name
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1816 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1817 (if (string-match
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1818 "^\\(OPT\\)\\|\\(ALT\\)$"
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1819 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1820 begin-name (+ begin-name 3)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1821 (+ begin-name 3)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1822 begin-name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1823 end-name)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1824 (cond
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1825 ((and
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1826 (memq 'opts-or-alts format)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1827 (progn (goto-char begin-name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1828 (looking-at "OPT\\|ALT")))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1829 (goto-char begin-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1830 (if (looking-at "\\(\"\"\\)\\|\\({}\\)")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1831 ;; empty: delete whole field if really optional
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1832 ;; (missing crossref handled) or complain
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1833 (if (and
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1834 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1835 (goto-char begin-name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1836 (looking-at "OPT"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1837 (not crossref-there)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1838 (assoc-ignore-case field-name req))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1839 ;; field is not really optional
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1840 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1841 (goto-char begin-name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1842 (bibtex-remove-OPT-or-ALT)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1843 (error
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1844 "Mandatory field ``%s'' is empty" field-name))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1845 ;; field is optional
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1846 (delete-region begin-field end-field))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1847 ;; otherwise: not empty, delete "OPT"
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1848 (goto-char begin-name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1849 (bibtex-remove-OPT-or-ALT)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1850 ((and
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1851 (memq 'numerical-fields format)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1852 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1853 (goto-char begin-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1854 (looking-at "\\(\"[0-9]+\"\\)\\|\\({[0-9]+}\\)")))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1855 (goto-char end-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1856 (delete-char -1)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1857 (goto-char begin-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1858 (delete-char 1))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1859 (t
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1860 (if (memq 'delimiters format)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1861 (bibtex-format-field-delimiters begin-text end-text))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1862 (if (and
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1863 (memq 'page-dashes format)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1864 (string-match "^\\(OPT\\)?pages$" (downcase field-name))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1865 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1866 (goto-char begin-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1867 (looking-at
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1868 "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)")))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1869 (replace-match "\\1-\\2"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1870 (if (and
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1871 (memq 'inherit-booktitle format)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1872 (equal (downcase field-name) "booktitle")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1873 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1874 (goto-char begin-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1875 (looking-at "\\(\"\"\\)\\|\\({}\\)"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1876 crossref-there
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1877 (not (bibtex-find-entry-location crossref-there t)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1878 ;; booktitle field empty and crossref entry found
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1879 ;; --> insert title field of crossreferenced entry if there
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1880 (let ((stop (bibtex-end-of-entry)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1881 (bibtex-beginning-of-entry)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1882 (let ((bounds (bibtex-search-forward-field "title" stop)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1883 (if bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1884 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1885 (goto-char begin-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1886 (forward-char)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1887 (insert
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1888 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1889 (1+ (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1890 (1- (bibtex-end-of-text-in-field bounds)))))))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1891 (if (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1892 (goto-char begin-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1893 (looking-at "\\(\"\"\\)\\|\\({}\\)"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1894 ;; if empty field, complain
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1895 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1896 (forward-char)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1897 (if (or (and
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1898 crossref-there
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1899 (assoc-ignore-case
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1900 field-name creq))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1901 (and
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1902 (not crossref-there)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1903 (assoc-ignore-case
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1904 field-name req)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1905 (error
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1906 "Mandatory field ``%s'' is empty" field-name))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1907 (if (memq 'unify-case format)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1908 (let* ((fl
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1909 (car (cdr (assoc-ignore-case
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1910 entry-type
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1911 bibtex-entry-field-alist))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1912 (field-list
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1913 (append
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1914 (elt fl 0)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1915 (elt fl 1)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1916 bibtex-user-optional-fields))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1917 (new-field-name
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1918 (car
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1919 (assoc-ignore-case field-name field-list))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1920 (goto-char begin-name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1921 (if new-field-name
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1922 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1923 (delete-region begin-name end-name)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1924 (insert new-field-name))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1925 (downcase-region begin-name end-name))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1926 (setq field-done t)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1927 (if (not field-done)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1928 (goto-char begin-field)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1929 (setq field-done nil)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1930 (goto-char end-field)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1931 (setq bounds (bibtex-search-forward-field bibtex-field-name end))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1932 (if (looking-at (bibtex-field-right-delimiter))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1933 (forward-char))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1934 (if (memq 'last-comma format)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1935 (cond ((and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1936 bibtex-comma-after-last-field
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1937 (not (looking-at ",")))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1938 (insert ","))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1939 ((and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1940 (not bibtex-comma-after-last-field)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1941 (looking-at ","))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1942 (delete-char 1))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1943 (if (looking-at ",")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1944 (forward-char))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1945 (if (memq 'delimiters format)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1946 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1947 (skip-chars-forward " \t\n")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1948 (delete-char 1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1949 (insert (bibtex-entry-right-delimiter))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1950 (if (memq 'realign format)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1951 (bibtex-fill-entry)))))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1952
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1953 (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
1954 ;; 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
1955 ;; 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
1956 ;; new-string) pair.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1957 (let* (case-fold-search
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1958 (return-string string)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1959 (index 0)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1960 (len (length change-list))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1961 change-item)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1962 (while (< index len)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1963 (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
1964 (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
1965 (setq
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1966 return-string
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1967 (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
1968 (elt change-item 1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1969 (substring return-string (match-end 0)))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1970 (setq index (1+ index)))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1971 return-string))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1972
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1973 (defun bibtex-autokey-abbrev (string len)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
1974 ;; Returns an abbreviation of string with at least len
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1975 ;; characters. String is aborted only after a consonant or at the
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
1976 ;; word end. If len is not a number, string is returned unchanged.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1977 (cond ((or
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1978 (not (numberp len))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1979 (<= (length string) len))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1980 string)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1981 ((equal len 0)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1982 "")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1983 (t
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1984 (let* ((case-fold-search t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1985 (abort-char
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1986 (string-match "[^aeiou]" string (1- len))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1987 (if abort-char
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1988 (substring string 0 (1+ abort-char))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1989 string)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1990
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1991 (defun bibtex-autokey-get-namefield (min max)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1992 ;; returns the contents of the name field of the current entry
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
1993 ;; does some modifications based on `bibtex-autokey-name-change-strings'
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
1994 ;; and removes newlines unconditionally
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
1995 (goto-char min)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1996 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1997 (author-or-editor "\\(author\\)\\|\\(editor\\)")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1998 (bounds (bibtex-search-forward-field author-or-editor max)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
1999 (if bounds
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2000 (bibtex-autokey-change
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2001 (buffer-substring-no-properties
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2002 (1+ (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2003 (1- (bibtex-end-of-text-in-field bounds)))
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2004 (append bibtex-autokey-name-change-strings '(("\n" " "))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2005 "")))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2006
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2007 (defun bibtex-autokey-get-names (namefield)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2008 ;; gathers all names in namefield into a list
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2009 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2010 names)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2011 (while (not (equal namefield ""))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2012 (let (name)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2013 (if (string-match "[ \t\n]and[ \t\n]" namefield)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2014 (setq name (substring namefield 0 (match-beginning 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2015 namefield (substring namefield (match-end 0)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2016 (setq name namefield
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2017 namefield ""))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2018 (setq names (append names (list name)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2019 names))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2020
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2021 (defun bibtex-autokey-demangle-name (fullname)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2022 ;; gets the `last' part from a well-formed name
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2023 (let* (case-fold-search
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2024 (lastname
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2025 (if (string-match "," fullname)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2026 ;; name is of the form "von Last, First" or
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2027 ;; "von Last, Jr, First"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2028 ;; --> take only the part before the comma
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2029 (let ((von-last
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2030 (substring fullname 0 (match-beginning 0))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2031 (if (string-match "^[a-z]" von-last)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2032 ;; von-last has a "von" part --> take the "last" part
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2033 (if (string-match "[ \t][A-Z]" von-last)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2034 (substring von-last (1+ (match-beginning 0)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2035 (error
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2036 "Name %s is incorrectly formed" fullname))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2037 ;; von-last has no "von" part --> take all
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2038 von-last))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2039 ;; name is of the form "First von Last"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2040 (if (string-match "[ \t]" fullname)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2041 ;; more than one token
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2042 (if (string-match "[ \t][a-z]" fullname)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2043 ;; there is a "von" part
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2044 ;; --> take everything after that
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2045 (if (string-match
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2046 "[ \t][A-Z]" fullname (match-end 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2047 (substring fullname (1+ (match-beginning 0)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2048 (error
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2049 "Name %s is incorrectly formed" fullname))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2050 ;; there is no "von" part --> take only the last token
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2051 (if (string-match " [^ ]*$" fullname)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2052 (substring fullname (1+ (match-beginning 0)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2053 (error "Name %s is incorrectly formed" fullname)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2054 ;; only one token --> take it
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2055 fullname)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2056 (usename
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2057 (if (string-match "[ \t]+" lastname)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2058 ;; lastname consists of two or more tokens
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2059 ;; --> take only the first one
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2060 (substring lastname 0 (match-beginning 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2061 lastname)))
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2062 (funcall bibtex-autokey-name-case-convert usename)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2063
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2064 (defun bibtex-autokey-get-namelist (namefield)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2065 ;; gets namefield, performs abbreviations on the last parts, and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2066 ;; return results as a list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2067 (mapcar
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2068 (lambda (fullname)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2069 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2070 fullname (substring fullname (string-match "[^ \t]" fullname)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2071 (bibtex-autokey-abbrev
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2072 (bibtex-autokey-demangle-name fullname)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2073 bibtex-autokey-name-length))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2074 (bibtex-autokey-get-names namefield)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2075
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2076 (defun bibtex-autokey-get-yearfield-digits (max)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2077 ;; get digit substring from year field.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2078 (let ((bounds (bibtex-search-forward-field "year" max)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2079 (if bounds
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2080 (let ((year (buffer-substring-no-properties
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2081 (bibtex-start-of-text-in-field bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2082 (bibtex-end-of-text-in-field bounds))))
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2083 (string-match "[^0-9]*\\([0-9]+\\)" year)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2084 (substring year (match-beginning 1) (match-end 1)))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2085 "")))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2086
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2087 (defun bibtex-autokey-get-yearfield (min max)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2088 ;; get year field from current or maybe crossreferenced entry
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2089 (goto-char min)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2090 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2091 (year (bibtex-autokey-get-yearfield-digits max)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2092 (if (and (string= year "") bibtex-autokey-year-use-crossref-entry)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2093 (let* ((bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2094 (bibtex-search-forward-field "\\(OPT\\)?crossref" max))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2095 (crossref-field
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2096 (if bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2097 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2098 (1+ (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2099 (1- (bibtex-end-of-text-in-field bounds))))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2100 (if (not (bibtex-find-entry-location crossref-field t))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2101 (let ((stop (bibtex-end-of-entry)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2102 (bibtex-beginning-of-entry)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2103 (bibtex-autokey-get-yearfield-digits stop))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2104 ""))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2105 year)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2106
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2107 (defun bibtex-autokey-get-titlestring (min max)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2108 ;; get title field contents up to a terminator
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2109 (goto-char min)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2110 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2111 (bounds (bibtex-search-forward-field "title" max))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2112 (titlefield
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2113 (if bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2114 (bibtex-autokey-change
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2115 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2116 (1+ (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2117 (1- (bibtex-end-of-text-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2118 bibtex-autokey-titleword-change-strings)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2119 ""))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2120 (title-terminators bibtex-autokey-title-terminators))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2121 (while (not (null title-terminators))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2122 (if (string-match (car title-terminators) titlefield)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2123 (setq titlefield (substring titlefield 0 (match-beginning 0))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2124 (setq title-terminators (cdr title-terminators)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2125 titlefield))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2126
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2127 (defun bibtex-autokey-get-titles (titlestring)
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2128 ;; gathers words from titlestring into a list. Ignores
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2129 ;; specific words and uses only a specific amount of words.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2130 (let* (case-fold-search
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2131 titlewords
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2132 titlewords-extra
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2133 (counter 0))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2134 (while (and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2135 (not (equal titlestring ""))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2136 (or
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2137 (not (numberp bibtex-autokey-titlewords))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2138 (< counter
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2139 (+ bibtex-autokey-titlewords
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2140 bibtex-autokey-titlewords-stretch))))
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2141 (if (string-match "\\b\\w+" titlestring)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2142 (let* ((end-match (match-end 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2143 (titleword
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2144 (substring titlestring (match-beginning 0) end-match)))
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2145 (if (bibtex-member-of-regexp
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2146 titleword
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2147 bibtex-autokey-titleword-ignore)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2148 (setq counter (1- counter))
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
2149 (setq
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2150 titleword
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2151 (funcall bibtex-autokey-titleword-case-convert titleword))
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2152 (if (or (not (numberp bibtex-autokey-titlewords))
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2153 (< counter bibtex-autokey-titlewords))
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2154 (setq titlewords (append titlewords (list titleword)))
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2155 (setq titlewords-extra
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2156 (append titlewords-extra (list titleword)))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2157 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2158 titlestring (substring titlestring end-match)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2159 (setq titlestring ""))
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2160 (setq counter (1+ counter)))
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2161 (if (string-match "\\b\\w+" titlestring)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2162 titlewords
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2163 (append titlewords titlewords-extra))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2164
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2165 (defun bibtex-autokey-get-titlelist (titlestring)
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2166 ;; returns all words in titlestring as a list
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2167 ;; does some abbreviation on the found words
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2168 (mapcar
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2169 (lambda (titleword)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2170 (let ((abbrev
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
2171 (bibtex-assoc-of-regexp
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2172 titleword bibtex-autokey-titleword-abbrevs)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2173 (if abbrev
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2174 (elt abbrev 1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2175 (bibtex-autokey-abbrev
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2176 titleword
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2177 bibtex-autokey-titleword-length))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2178 (bibtex-autokey-get-titles titlestring)))
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-generate-autokey ()
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2181 "Generates automatically a key from the author/editor and the title field.
20446
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2182 This will only work for entries where each field begins on a separate line.
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2183 The generation algorithm works as follows:
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2184 1. Use the value of `bibtex-autokey-prefix-string' as a prefix.
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2185 2. If there is a non-empty author (preferred) or editor field,
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2186 use it as the name part of the key.
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2187 3. Change any substring found in
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2188 `bibtex-autokey-name-change-strings' to the corresponding new
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2189 one (see documentation of this variable for further detail).
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2190 4. For every of at least first `bibtex-autokey-names' names in
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2191 the name field, determine the last name. If there are maximal
20446
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2192 `bibtex-autokey-names' + `bibtex-autokey-names-stretch'
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2193 names, all names are used.
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2194 5. From every last name, take at least
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2195 `bibtex-autokey-name-length' characters (abort only after a
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2196 consonant or at a word end).
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2197 6. Convert all last names according to the conversion function
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2198 `bibtex-autokey-name-case-convert'.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2199 7. Build the name part of the key by concatenating all
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2200 abbreviated last names with the string
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2201 `bibtex-autokey-name-separator' between any two. If there are
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2202 more names than are used in the name part, prepend the string
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2203 contained in `bibtex-autokey-additional-names'.
20446
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2204 8. Build the year part of the key by truncating the contents of
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2205 the year field to the rightmost `bibtex-autokey-year-length'
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2206 digits (useful values are 2 and 4). If the year field is
20446
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2207 absent, but the entry has a valid crossref field and the
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2208 variable `bibtex-autokey-year-use-crossref-entry' is non-nil,
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2209 use the year field of the crossreferenced entry instead.
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2210 9. For the title part of the key change the contents of the
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2211 title field of the entry according to
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2212 `bibtex-autokey-titleword-change-strings' to the
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2213 corresponding new one (see documentation of this variable for
20446
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2214 further detail).
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2215 10. Abbreviate the result to the string up to (but not including)
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2216 the first occurrence of a regexp matched by the items of
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2217 `bibtex-autokey-title-terminators' and delete those words which
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2218 appear in `bibtex-autokey-titleword-ignore'.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2219 Build the title part of the key by using at least the first
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2220 `bibtex-autokey-titlewords' words from this
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2221 abbreviated title. If the abbreviated title ends after
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2222 maximal `bibtex-autokey-titlewords' +
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2223 `bibtex-autokey-titlewords-stretch' words, all
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2224 words from the abbreviated title are used.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2225 11. Convert all used titlewords according to the conversion function
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2226 `bibtex-autokey-titleword-case-convert'.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2227 12. For every used title word that appears in
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2228 `bibtex-autokey-titleword-abbrevs' use the corresponding
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2229 abbreviation (see documentation of this variable for further
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2230 detail).
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2231 13. From every title word not generated by an abbreviation, take
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2232 at least `bibtex-autokey-titleword-length' characters (abort
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2233 only after a consonant or at a word end).
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2234 14. Build the title part of the key by concatenating all
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2235 abbreviated title words with the string
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2236 `bibtex-autokey-titleword-separator' between any two.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2237 15. At least, to get the key, concatenate
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2238 `bibtex-autokey-prefix-string', the name part, the year part
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2239 and the title part with `bibtex-autokey-name-year-separator'
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2240 between the name part and the year part if both are non-empty
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2241 and `bibtex-autokey-year-title-separator' between the year
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2242 part and the title part if both are non-empty. If the year
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2243 part is empty, but not the other two parts,
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2244 `bibtex-autokey-year-title-separator' is used as well.
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2245 16. If the value of `bibtex-autokey-before-presentation-function'
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2246 is non-nil, it must be a function taking one argument. This
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2247 function is then called with the generated key as the
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2248 argument. The return value of this function (a string) is
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2249 used as the key.
20446
4bcd559e2cb4 (bibtex-generate-autokey): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20359
diff changeset
2250 17. If the value of `bibtex-autokey-edit-before-use' is non-nil,
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2251 the key is then presented in the minibuffer to the user,
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2252 where it can be edited. The key given by the user is then
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2253 used."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2254 (let* ((pnt (point))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2255 (min (bibtex-beginning-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2256 (max (bibtex-end-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2257 (namefield (bibtex-autokey-get-namefield min max))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2258 (name-etal "")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2259 (namelist
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2260 (let ((nl (bibtex-autokey-get-namelist namefield)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2261 (if (or (not (numberp bibtex-autokey-names))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2262 (<= (length nl)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2263 (+ bibtex-autokey-names
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2264 bibtex-autokey-names-stretch)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2265 nl
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2266 (setq name-etal bibtex-autokey-additional-names)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2267 (let (nnl)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2268 (while (< (length nnl) bibtex-autokey-names)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2269 (setq nnl (append nnl (list (car nl)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2270 nl (cdr nl)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2271 nnl))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2272 (namepart
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2273 (concat
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2274 (mapconcat (lambda (name) name)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2275 namelist
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2276 bibtex-autokey-name-separator)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2277 name-etal))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2278 (yearfield (bibtex-autokey-get-yearfield min max))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2279 (yearpart
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2280 (if (equal yearfield "")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2281 ""
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2282 (substring
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2283 yearfield
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2284 (- (length yearfield) bibtex-autokey-year-length))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2285 (titlestring (bibtex-autokey-get-titlestring min max))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2286 (titlelist (bibtex-autokey-get-titlelist titlestring))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2287 (titlepart
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2288 (mapconcat
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2289 (lambda (name) name)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2290 titlelist
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2291 bibtex-autokey-titleword-separator))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2292 (autokey
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2293 (concat
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2294 bibtex-autokey-prefix-string
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2295 namepart
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2296 (if (not
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2297 (or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2298 (equal namepart "")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2299 (equal yearpart "")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2300 bibtex-autokey-name-year-separator)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2301 yearpart
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2302 (if (not
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2303 (or
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2304 (and
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2305 (equal namepart "")
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2306 (equal yearpart ""))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2307 (equal titlepart "")))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2308 bibtex-autokey-year-title-separator)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2309 titlepart)))
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2310 (if bibtex-autokey-before-presentation-function
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2311 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2312 autokey
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2313 (funcall bibtex-autokey-before-presentation-function autokey)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2314 (goto-char pnt)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2315 autokey))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2316
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2317 (defun bibtex-parse-keys (add verbose &optional abortable)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2318 ;; Sets bibtex-reference-keys to the keys used in the whole (possibly
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2319 ;; restricted) buffer (either as entry keys or as crossref entries).
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2320 ;; If ADD is non-nil adds the new keys to bibtex-reference-keys instead of
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2321 ;; simply resetting it. If VERBOSE is non-nil gives messages about
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2322 ;; progress. If ABORTABLE is non-nil abort on user input.
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2323 (if bibtex-maintain-sorted-entries
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2324 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2325 (reference-keys (if add bibtex-reference-keys)))
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2326 (save-excursion
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
2327 (goto-char (point-min))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2328 (if verbose
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2329 (bibtex-progress-message
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2330 (concat (buffer-name) ": parsing reference keys")))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2331 (if (catch 'userkey
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
2332 (bibtex-skip-to-valid-entry)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2333 (while (not (eobp))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2334 (if (and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2335 abortable
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2336 (input-pending-p))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2337 (throw 'userkey t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2338 (if verbose
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2339 (bibtex-progress-message))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2340 (let (reference-key
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2341 xrefd-reference-key)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2342 (cond
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2343 ((looking-at bibtex-entry-head)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2344 (setq
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2345 reference-key
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2346 (buffer-substring-no-properties
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2347 (match-beginning bibtex-key-in-head)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2348 (match-end bibtex-key-in-head)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2349 (let ((p (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2350 (m (bibtex-end-of-entry)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2351 (goto-char p)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2352 (let ((bounds (bibtex-search-forward-field "crossref" m)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2353 (if bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2354 (setq
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2355 xrefd-reference-key
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2356 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2357 (1+ (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2358 (1- (bibtex-end-of-text-in-field bounds))))))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2359 ((bibtex-parse-string)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2360 (let ((bounds (bibtex-parse-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2361 (setq
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2362 reference-key
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2363 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2364 (bibtex-start-of-reference-key-in-string bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2365 (bibtex-end-of-reference-key-in-string bounds))))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2366 (forward-char)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
2367 (bibtex-skip-to-valid-entry)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2368 (if (not (assoc reference-key reference-keys))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2369 (setq reference-keys
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2370 (cons (list reference-key) reference-keys)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2371 (if (and xrefd-reference-key
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2372 (not (assoc xrefd-reference-key reference-keys)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2373 (setq reference-keys
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2374 (cons (list xrefd-reference-key) reference-keys))))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2375 ;; user has aborted by typing a key --> return nil
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2376 nil
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2377 ;; successful operation --> return t
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2378 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2379 bibtex-buffer-last-parsed-tick (buffer-modified-tick)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2380 bibtex-reference-keys reference-keys)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2381 (if verbose
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2382 (bibtex-progress-message 'done))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2383 t)))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2384
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2385 (defun bibtex-parse-buffers-stealthily ()
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2386 ;; Called by bibtex-run-with-idle-timer. Whenever emacs has been idle
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2387 ;; for bibtex-parse-keys-timeout seconds, all BibTeX buffers (starting
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2388 ;; with the current) are parsed.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2389 (let ((buffers (buffer-list)))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2390 (save-excursion
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2391 (while (and buffers (not (input-pending-p)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2392 (set-buffer (car buffers))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2393 (save-restriction
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2394 (widen)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
2395 (if (and
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2396 (eq major-mode 'bibtex-mode)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2397 bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2398 (not
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2399 (eq (buffer-modified-tick)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2400 bibtex-buffer-last-parsed-tick)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2401 (if (bibtex-parse-keys nil t t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2402 ;; successful operation --> remove buffer from list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2403 (setq buffers (cdr buffers)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2404 ;; buffer is no BibTeX buffer or needs no parsing
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2405 (setq buffers (cdr buffers))))))))
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
2406
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2407 (defun bibtex-complete (string-list &optional complete-strings)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2408 ;; Complete word fragment before point to longest prefix of one
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2409 ;; string defined in STRING-LIST. If point is not after the part of
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2410 ;; a word, all strings are listed. If COMPLETE-STRINGS is non-nil,
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2411 ;; add the strings defined in this buffer before cursor to
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2412 ;; STRING-LIST and remove surrounding delimiters if complete string
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2413 ;; could be expanded.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2414 (let* ((case-fold-search t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2415 (end (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2416 (beg (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2417 (re-search-backward "[ \t{\"]")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2418 (forward-char)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2419 (point)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2420 (part-of-word (buffer-substring-no-properties beg end))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2421 (completions (copy-sequence string-list))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2422 (completion (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2423 (if complete-strings
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2424 (while (bibtex-search-backward-string)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2425 (let ((bounds (bibtex-search-backward-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2426 (setq completions
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2427 (cons
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2428 (list
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2429 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2430 (bibtex-start-of-reference-key-in-string bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2431 (bibtex-end-of-reference-key-in-string bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2432 completions)))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2433 (setq completions
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2434 (sort completions
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2435 (lambda(x y)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2436 (string-lessp
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2437 (car x)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2438 (car y)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2439 (try-completion part-of-word completions))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2440 (cond ((eq completion t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2441 (if complete-strings
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2442 ;; remove double-quotes or braces if field is no concatenation
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2443 (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2444 (bibtex-inside-field)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2445 (let* ((bounds (bibtex-enclosing-field)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2446 (goto-char (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2447 (let ((boundaries (bibtex-parse-field-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2448 (if (and boundaries (equal (cdr boundaries) (bibtex-end-of-text-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2449 (bibtex-remove-delimiters)))))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2450 ((not completion)
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2451 (error "Can't find completion for \"%s\"" part-of-word))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2452 ((not (string= part-of-word completion))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2453 (delete-region beg end)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2454 (insert completion)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2455 (if (and (assoc completion completions)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2456 complete-strings)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2457 ;; remove double-quotes or braces if field is no concatenation
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2458 (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2459 (bibtex-inside-field)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2460 (let* ((bounds (bibtex-enclosing-field)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2461 (goto-char (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2462 (let ((boundaries (bibtex-parse-field-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2463 (if (and boundaries (equal (cdr boundaries) (bibtex-end-of-text-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2464 (bibtex-remove-delimiters)))))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2465 (t
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2466 (message "Making completion list...")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2467 (let ((list (all-completions part-of-word completions)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2468 (with-output-to-temp-buffer "*Completions*"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2469 (display-completion-list list)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2470 (message "Making completion list...done")))))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2471
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2472 (defun bibtex-do-auto-fill ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2473 (let ((fill-prefix
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2474 (make-string
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2475 (+ bibtex-entry-offset bibtex-contline-indentation) ? )))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2476 (do-auto-fill)))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2477
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2478 (defun bibtex-pop (arg direction)
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2479 ;; generic function to be used by bibtex-pop-previous and bibtex-pop-next
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2480 (let (bibtex-help-message)
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2481 (bibtex-find-text nil))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2482 (save-excursion
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2483 ;; parse current field
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2484 (bibtex-inside-field)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2485 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2486 (bounds (bibtex-enclosing-field))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2487 (start-old-text (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2488 (stop-old-text (bibtex-end-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2489 (start-name (bibtex-start-of-name-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2490 (stop-name (bibtex-end-of-name-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2491 (new-text))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2492 (goto-char start-name)
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2493 ;; construct regexp for field with same name as this one,
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2494 ;; ignoring possible OPT's or ALT's
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2495 (let* ((field-name
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2496 (buffer-substring-no-properties
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2497 (if (looking-at "\\(OPT\\)\\|\\(ALT\\)")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2498 (match-end 0)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2499 (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2500 stop-name)))
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2501 ;; if executed several times in a row, start each search where
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2502 ;; the last one was finished
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2503 (cond ((eq last-command 'bibtex-pop) t)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2504 (t
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2505 (bibtex-enclosing-entry-maybe-empty-head)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2506 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2507 bibtex-pop-previous-search-point (match-beginning 0)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2508 bibtex-pop-next-search-point (point))))
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2509 (if (eq direction 'previous)
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2510 (goto-char bibtex-pop-previous-search-point)
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2511 (goto-char bibtex-pop-next-search-point))
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2512 ;; Now search for arg'th previous/next similar field
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2513 (let ((bounds nil)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2514 (failure nil))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2515 (while (and (not failure) (> arg 0))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2516 (cond ((eq direction 'previous)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2517 (setq bounds (bibtex-search-backward-field field-name (point-min)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2518 (if bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2519 (goto-char (bibtex-start-of-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2520 (setq failure t)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2521 ((eq direction 'next)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2522 (setq bounds (bibtex-search-forward-field field-name (point-max)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2523 (if bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2524 (goto-char (bibtex-end-of-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2525 (setq failure t))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2526 (setq arg (- arg 1)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2527 (if failure
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2528 (error (if (eq direction 'previous)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2529 "No previous matching BibTeX field."
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2530 "No next matching BibTeX field."))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2531 ;; Found a matching field. Remember boundaries.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2532 (setq bibtex-pop-previous-search-point (bibtex-start-of-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2533 (setq bibtex-pop-next-search-point (bibtex-end-of-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2534 (setq new-text
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2535 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2536 (bibtex-start-of-text-in-field bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2537 (bibtex-end-of-text-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2538 (bibtex-flash-head)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2539 ;; Go back to where we started, delete old text, and pop new.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2540 (goto-char stop-old-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2541 (delete-region start-old-text stop-old-text)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2542 (insert new-text))))))
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2543 (let (bibtex-help-message)
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2544 (bibtex-find-text nil))
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2545 (setq this-command 'bibtex-pop))
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
2546
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2547
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2548 ;; Interactive Functions:
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2549
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2550 ;;;###autoload
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2551 (defun bibtex-mode ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2552 "Major mode for editing BibTeX files.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2553
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2554 To submit a problem report, enter \\[bibtex-submit-bug-report] from a
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
2555 BibTeX mode buffer. This automatically sets up a mail buffer with
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2556 version information already added. You just need to add a description
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2557 of the problem, including a reproducable test case and send the
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2558 message.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2559
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2560
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2561 General information on working with BibTeX mode:
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2562
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2563 You should use commands as \\[bibtex-Book] to get a template for a
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2564 specific entry. You should then fill in all desired fields using
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2565 \\[bibtex-next-field] to jump from field to field. After having filled
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2566 in all desired fields in the entry, you should clean the new entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2567 with command \\[bibtex-clean-entry].
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2568
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2569 Some features of BibTeX mode are available only by setting variable
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2570 bibtex-maintain-sorted-entries to t. However, then BibTeX mode will
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2571 work with buffer containing only valid (syntactical correct) entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2572 and with entries being sorted. This is usually the case, if you have
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2573 created a buffer completely with BibTeX mode and finished every new
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2574 entry with \\[bibtex-clean-entry].
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2575
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2576 For third party BibTeX buffers, please call the function
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2577 `bibtex-convert-alien' to fully take advantage of all features of
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2578 BibTeX mode.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2579
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2580
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2581 Special information:
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2582
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2583 A command such as \\[bibtex-Book] will outline the fields for a BibTeX book entry.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2584
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2585 The optional fields start with the string OPT, and are thus ignored by BibTeX.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2586 Alternatives from which only one is required start with the string ALT.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2587 The OPT or ALT string may be removed from a field with \\[bibtex-remove-OPT-or-ALT].
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2588 \\[bibtex-make-field] inserts a new field after the current one.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2589 \\[bibtex-kill-field] kills the current field entirely.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2590 \\[bibtex-yank] will yank the last recently killed field after the
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2591 current field.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2592 \\[bibtex-remove-delimiters] removes the double-quotes or braces around the text of the current field.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2593 \\[bibtex-empty-field] replaces the text of the current field with the default \"\" or {}.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2594
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2595 The command \\[bibtex-clean-entry] cleans the current entry, i.e. it removes OPT/ALT
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2596 from all non-empty optional or alternative fields, checks that no required
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2597 fields are empty, and does some formatting dependent on the value of
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2598 bibtex-entry-format.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2599 Note: some functions in BibTeX mode depend on entries being in a special
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2600 format (all fields beginning on separate lines), so it is usually a bad
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2601 idea to remove `realign' from bibtex-entry-format.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2602
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2603 Use \\[bibtex-find-text] to position the cursor at the end of the current field.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2604 Use \\[bibtex-next-field] to move to end of the next field.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2605
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2606 The following may be of interest as well:
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2607
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2608 Functions:
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2609 bibtex-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2610 bibtex-kill-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2611 bibtex-yank-pop
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2612 bibtex-pop-previous
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2613 bibtex-pop-next
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2614 bibtex-complete-string
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2615 bibtex-complete-key
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2616 bibtex-print-help-message
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2617 bibtex-generate-autokey
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2618 bibtex-beginning-of-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2619 bibtex-end-of-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2620 bibtex-reposition-window
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2621 bibtex-mark-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2622 bibtex-ispell-abstract
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2623 bibtex-ispell-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2624 bibtex-narrow-to-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2625 bibtex-sort-buffer
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2626 bibtex-validate
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2627 bibtex-count
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2628 bibtex-fill-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2629 bibtex-reformat
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2630 bibtex-convert-alien
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2631
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2632 Variables:
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2633 bibtex-field-delimiters
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2634 bibtex-include-OPTcrossref
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2635 bibtex-include-OPTkey
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2636 bibtex-user-optional-fields
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2637 bibtex-entry-format
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2638 bibtex-sort-ignore-string-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2639 bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2640 bibtex-entry-field-alist
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2641 bibtex-predefined-strings
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2642 bibtex-string-files
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2643
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2644 ---------------------------------------------------------
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
2645 Entry to BibTeX mode calls the value of `bibtex-mode-hook' if that value is
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2646 non-nil.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2647
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2648 \\{bibtex-mode-map}"
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2649 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2650 (kill-all-local-variables)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2651 (use-local-map bibtex-mode-map)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2652 (setq major-mode 'bibtex-mode)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2653 (setq mode-name "BibTeX")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2654 (set-syntax-table bibtex-mode-syntax-table)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2655 (setq bibtex-strings bibtex-predefined-strings)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2656 (mapcar
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2657 (lambda (filename)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2658 ;; collect pathnames
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2659 (let* ((path (if bibtex-string-file-path
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2660 bibtex-string-file-path
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2661 "."))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2662 (dirs (split-string path ":+"))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2663 (filename (if (string-match "\.bib$" filename)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2664 filename
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2665 (concat filename ".bib")))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2666 fullfilename
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2667 (item 0)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2668 (size (length dirs)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2669 ;; test filenames
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2670 (while (and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2671 (< item size)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2672 (not (file-readable-p
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2673 (setq fullfilename
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2674 (concat (elt dirs item) "/" filename)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2675 (setq item (1+ item)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2676 (if (< item size)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2677 ;; file was found
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2678 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2679 (compl nil))
25444
37b1636d73d5 (bibtex-mode): Use with-temp-buffer rather than make-temp-name, use
Richard M. Stallman <rms@gnu.org>
parents: 24897
diff changeset
2680 (with-temp-buffer
37b1636d73d5 (bibtex-mode): Use with-temp-buffer rather than make-temp-name, use
Richard M. Stallman <rms@gnu.org>
parents: 24897
diff changeset
2681 (insert-file-contents fullfilename)
37b1636d73d5 (bibtex-mode): Use with-temp-buffer rather than make-temp-name, use
Richard M. Stallman <rms@gnu.org>
parents: 24897
diff changeset
2682 (goto-char (point-min))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2683 (let ((bounds (bibtex-search-forward-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2684 (while bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2685 (setq compl
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2686 (cons (list (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2687 (bibtex-start-of-reference-key-in-string bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2688 (bibtex-end-of-reference-key-in-string bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2689 compl))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2690 (goto-char (bibtex-end-of-string bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2691 (setq bounds (bibtex-search-forward-string)))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2692 (setq bibtex-strings (append bibtex-strings (nreverse compl))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2693 (error
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2694 "File %s not in paths defined by bibtex-string-file-path variable"
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2695 filename))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2696 bibtex-string-files)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2697 (if bibtex-maintain-sorted-entries
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2698 (bibtex-run-with-idle-timer
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2699 1 nil
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2700 (lambda ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2701 (bibtex-parse-keys nil t t))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2702 ;; to get buffer parsed once if everything else (including things
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2703 ;; installed in bibtex-mode-hook) has done its work
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2704 (if (not bibtex-parse-idle-timer)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2705 (setq bibtex-parse-idle-timer
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2706 (bibtex-run-with-idle-timer
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2707 bibtex-parse-keys-timeout t
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2708 'bibtex-parse-buffers-stealthily)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2709 ;; Install stealthy parse function if not already installed
24897
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2710 (make-local-variable 'paragraph-start)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2711 (setq paragraph-start "[ \f\n\t]*$")
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2712 (make-local-variable 'comment-start)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2713 (setq comment-start bibtex-comment-start)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2714 (make-local-variable 'comment-start-skip)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2715 (setq comment-start-skip bibtex-comment-start)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2716 (make-local-variable 'comment-column)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2717 (setq comment-column 0)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2718 (make-local-variable 'defun-prompt-regexp)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2719 (setq defun-prompt-regexp "^@[a-zA-Z0-9]+")
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2720 (make-local-variable 'outline-regexp)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2721 (setq outline-regexp "@")
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2722 (make-local-variable 'normal-auto-fill-function)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2723 (setq normal-auto-fill-function 'bibtex-do-auto-fill)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2724 (make-local-variable 'font-lock-defaults)
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2725 (setq font-lock-defaults
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2726 '(bibtex-font-lock-keywords
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2727 nil t ((?$ . "\"")
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2728 ;; Mathematical expressions should be fontified as strings
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2729 (?\" . ".")
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2730 ;; Quotes are field delimiters and quote-delimited
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2731 ;; entries should be fontified in the same way as
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2732 ;; brace-delimited ones
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2733 )))
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2734 (make-local-variable 'font-lock-mark-block-function)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2735 (setq font-lock-mark-block-function
24897
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2736 (lambda ()
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2737 (set-mark (bibtex-end-of-entry))
8de3e729a7b3 (bibtex-mode): `font-lock-mark-block-function'
Karl Heuer <kwzh@gnu.org>
parents: 24620
diff changeset
2738 (bibtex-beginning-of-entry)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2739 (setq imenu-generic-expression
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2740 (list (list nil bibtex-entry-head bibtex-key-in-head)))
20459
90f306f86f5d Use imenu-case-fold-search.
Dave Love <fx@gnu.org>
parents: 20447
diff changeset
2741 (setq imenu-case-fold-search t)
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2742 ;; XEmacs needs easy-menu-add, Emacs does not care
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2743 (easy-menu-add bibtex-edit-menu)
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2744 (easy-menu-add bibtex-entry-menu)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2745 (run-hooks 'bibtex-mode-hook))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2746
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2747 (defun bibtex-submit-bug-report ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2748 "Submit via mail a bug report on bibtex.el."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2749 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2750 (if (y-or-n-p "Do you want to submit a bug report on BibTeX mode? ")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2751 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2752 (require 'reporter)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2753 (let ((reporter-prompt-for-summary-p t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2754 (reporter-submit-bug-report
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2755 bibtex-maintainer-address
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2756 "bibtex.el"
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2757 (list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2758 'system-configuration
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2759 'system-configuration-options
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2760 'bibtex-mode-hook
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2761 'bibtex-parse-keys-timeout
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2762 ;; possible general errors
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2763 'bibtex-sort-ignore-string-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2764 'bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2765 'bibtex-entry-delimiters
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2766 'bibtex-field-delimiters
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2767 'bibtex-comma-after-last-field
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2768 'bibtex-entry-offset
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2769 'bibtex-field-indentation
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2770 'bibtex-text-indentation
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2771 'bibtex-contline-indentation
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2772 'bibtex-align-at-equal-sign
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2773 ;; possible sorting and parsing bugs
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2774 'bibtex-entry-format
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2775 'bibtex-add-entry-hook
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2776 'bibtex-clean-entry-hook
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2777 ;; possible cleaning error
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2778 'bibtex-user-optional-fields
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2779 ;; possible format error
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2780 'bibtex-predefined-month-strings
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2781 'bibtex-predefined-strings
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2782 'bibtex-string-files
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2783 'bibtex-string-file-path
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2784 ;; possible format error
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2785 'bibtex-font-lock-keywords
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2786 ;; possible bugs regarding fontlocking
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2787 'bibtex-autokey-prefix-string
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2788 'bibtex-autokey-names
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2789 'bibtex-autokey-names-stretch
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2790 'bibtex-autokey-additional-names
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2791 'bibtex-autokey-transcriptions
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2792 'bibtex-autokey-name-change-strings
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2793 'bibtex-autokey-name-case-convert
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2794 'bibtex-autokey-name-length
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2795 'bibtex-autokey-name-separator
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2796 'bibtex-autokey-year-length
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2797 'bibtex-autokey-year-use-crossref-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2798 'bibtex-autokey-titlewords
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2799 'bibtex-autokey-title-terminators
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2800 'bibtex-autokey-titlewords-stretch
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2801 'bibtex-autokey-titleword-ignore
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2802 'bibtex-autokey-titleword-case-convert
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2803 'bibtex-autokey-titleword-abbrevs
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2804 'bibtex-autokey-titleword-change-strings
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2805 'bibtex-autokey-titleword-length
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2806 'bibtex-autokey-titleword-separator
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2807 'bibtex-autokey-name-year-separator
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2808 'bibtex-autokey-year-title-separator
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2809 'bibtex-autokey-edit-before-use
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
2810 'bibtex-autokey-before-presentation-function
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2811 ;; possible bugs regarding automatic reference keys
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2812 'bibtex-entry-field-alist
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2813 ;; possible format error
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2814 'bibtex-help-message
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2815 'bibtex-include-OPTcrossref
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2816 'bibtex-include-OPTkey
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2817 'bibtex-field-kill-ring-max
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2818 'bibtex-entry-kill-ring-max
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2819 ;; user variables which shouldn't cause any errors
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2820 )
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2821 nil nil
26711
eac840d283b6 (bibtex-hs-forward-sexp): Added to support
Gerd Moellmann <gerd@gnu.org>
parents: 25444
diff changeset
2822 (concat bibtex-maintainer-salutation "
20359
7fca0e4ce5e8 (bibtex-maintainer-address, bibtex-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 19638
diff changeset
2823
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2824 I want to report a bug on Emacs BibTeX mode.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2825
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2826 I've read the `Bugs' section in the `Emacs' info page, so I know how
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2827 to make a clear and unambiguous report. I have started a fresh Emacs
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2828 via `"invocation-name " --no-init-file --no-site-file', thereafter (in
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2829 case I'm reporting on a version of `bibtex.el' which is not part of
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2830 the standard emacs distribution) I loaded the questionable version
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2831 of `bibtex.el' with `M-x load-file', and then, to produce the buggy
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2832 behaviour, I did the following:")))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2833 (message nil))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2834
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2835 (defun bibtex-entry (entry-type)
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2836 "Insert a new BibTeX entry.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
2837 After insertion it calls the functions in `bibtex-add-entry-hook'."
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2838 (interactive (let* ((completion-ignore-case t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2839 (e-t (completing-read
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2840 "Entry Type: "
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2841 bibtex-entry-field-alist
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2842 nil t nil 'bibtex-entry-type-history)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2843 (list e-t)))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2844 (if (not bibtex-reference-keys)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2845 (bibtex-parse-keys nil t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2846 (let* (required
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2847 optional
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2848 (key
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2849 (if bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2850 (completing-read
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2851 (format "%s key: " entry-type)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2852 bibtex-reference-keys nil nil nil 'bibtex-key-history)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2853 (e (assoc-ignore-case entry-type bibtex-entry-field-alist))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2854 (r-n-o (elt e 1))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2855 (c-ref (elt e 2)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2856 (if (not e)
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2857 (error "Bibtex entry type %s not defined" entry-type))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2858 (if (and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2859 (member entry-type bibtex-include-OPTcrossref)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2860 c-ref)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2861 (setq required (elt c-ref 0)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2862 optional (elt c-ref 1))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2863 (setq required (elt r-n-o 0)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2864 optional (elt r-n-o 1)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2865 (if bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2866 (bibtex-find-entry-location key)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2867 (bibtex-move-outside-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2868 (indent-to-column bibtex-entry-offset)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2869 (insert "@" entry-type (bibtex-entry-left-delimiter))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2870 (if key
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2871 (insert key))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2872 (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2873 (mapcar 'bibtex-make-field required)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2874 (if (member entry-type bibtex-include-OPTcrossref)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2875 (bibtex-make-optional-field '("crossref")))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2876 (if bibtex-include-OPTkey
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2877 (if (or
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2878 (stringp bibtex-include-OPTkey)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2879 (fboundp bibtex-include-OPTkey))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2880 (bibtex-make-optional-field
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2881 (list "key" nil bibtex-include-OPTkey))
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2882 (bibtex-make-optional-field '("key"))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2883 (mapcar 'bibtex-make-optional-field optional)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2884 (mapcar 'bibtex-make-optional-field bibtex-user-optional-fields)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2885 (if bibtex-comma-after-last-field
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2886 (insert ","))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2887 (insert "\n")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2888 (indent-to-column bibtex-entry-offset)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2889 (insert (bibtex-entry-right-delimiter) "\n\n"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2890 (bibtex-next-field t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2891 (run-hooks 'bibtex-add-entry-hook)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2892
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2893 (defun bibtex-print-help-message ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2894 "Prints helpful information about current field in current BibTeX entry."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2895 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2896 (let* ((case-fold-search t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2897 (pnt (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2898 (field-name
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2899 (let* ((bounds (bibtex-enclosing-field))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2900 (mb (bibtex-start-of-name-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2901 (me (bibtex-end-of-name-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2902 (goto-char mb)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2903 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2904 (if (looking-at "OPT\\|ALT")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2905 (+ 3 mb)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2906 mb)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2907 me)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2908 (entry-type
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2909 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2910 (re-search-backward
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2911 bibtex-entry-maybe-empty-head nil t)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2912 (buffer-substring-no-properties
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2913 (1+ (match-beginning bibtex-type-in-head))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2914 (match-end bibtex-type-in-head))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2915 (entry-list
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2916 (assoc-ignore-case entry-type
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2917 bibtex-entry-field-alist))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2918 (c-r-list (elt entry-list 2))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2919 (req-opt-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2920 (if (and
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2921 (member entry-type bibtex-include-OPTcrossref)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2922 c-r-list)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2923 c-r-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2924 (elt entry-list 1)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2925 (list-of-entries (append
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2926 (elt req-opt-list 0)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2927 (elt req-opt-list 1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2928 bibtex-user-optional-fields
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2929 (if (member
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2930 entry-type
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2931 bibtex-include-OPTcrossref)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2932 '(("crossref"
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2933 "Reference key of the crossreferenced entry")))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2934 (if bibtex-include-OPTkey
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2935 '(("key"
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2936 "Used for reference key creation if author and editor fields are missing"))))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2937 (goto-char pnt)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2938 (let ((comment (assoc-ignore-case field-name list-of-entries)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2939 (if comment
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2940 (message (elt comment 1))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2941 (message "NO COMMENT AVAILABLE")))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2942
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2943 (defun bibtex-make-field (e-t &optional called-by-yank)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2944 "Makes a field named E-T in current BibTeX entry.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
2945 This function is for interactive and non-interactive purposes. To call
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2946 it interactively, just give it no arguments and enter the field name
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2947 using the minibuffer."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2948 (interactive "*P")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2949 (if (not e-t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2950 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2951 e-t
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2952 (let* ((entry-type
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2953 (save-excursion
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2954 (bibtex-enclosing-entry-maybe-empty-head)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2955 (buffer-substring-no-properties
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2956 (1+ (match-beginning bibtex-type-in-head))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2957 (match-end bibtex-type-in-head))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2958 (fl
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2959 (car (cdr (assoc-ignore-case
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
2960 entry-type bibtex-entry-field-alist))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2961 (field-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2962 (append
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2963 (elt fl 0) (elt fl 1) bibtex-user-optional-fields
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2964 (if bibtex-include-OPTcrossref '(("crossref" nil)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2965 (if bibtex-include-OPTkey '(("key" nil)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2966 (completion-ignore-case t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2967 (completing-read
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2968 "BibTeX field name: " field-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2969 nil nil nil bibtex-field-history))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2970 (if (not (consp e-t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2971 (setq e-t (list e-t)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2972 (if (equal (length e-t) 1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2973 (setq e-t (append e-t (list ""))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2974 (if (equal (length e-t) 2)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2975 (setq e-t (append e-t (list ""))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2976 (let ((name (if (elt e-t 3)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2977 (concat "ALT" (car e-t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2978 (car e-t))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2979 (if (or (interactive-p) called-by-yank)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2980 (let (bibtex-help-message)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2981 (bibtex-find-text nil t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2982 (if (looking-at "[}\"]")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2983 (forward-char))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2984 (insert ",\n")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2985 (indent-to-column
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2986 (+ bibtex-entry-offset bibtex-field-indentation))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2987 (insert name " ")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2988 (if bibtex-align-at-equal-sign
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2989 (indent-to-column
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2990 (+ bibtex-entry-offset (- bibtex-text-indentation 2))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2991 (insert "= ")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2992 (if (not bibtex-align-at-equal-sign)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2993 (indent-to-column
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2994 (+ bibtex-entry-offset bibtex-text-indentation)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2995 (insert (if called-by-yank
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2996 ""
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2997 (bibtex-field-left-delimiter))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2998 (let ((init (elt e-t 2)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
2999 (cond
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3000 ((stringp init)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3001 init)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3002 ((fboundp init)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3003 (funcall init))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3004 (t
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3005 (error "%s is neither a string nor a function" init))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3006 (if called-by-yank
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3007 ""
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3008 (bibtex-field-right-delimiter)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3009 (if (interactive-p)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3010 (forward-char -1))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3011
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3012 (defun bibtex-beginning-of-entry ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3013 "Move to beginning of BibTeX entry.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3014 If inside an entry, move to the beginning of it, otherwise move to the
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3015 beginning of the previous entry.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3016 If called from a program, this function returns the new location of point."
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3017 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3018 (skip-chars-forward " \t")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3019 (if (looking-at "@")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3020 (forward-char))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3021 (re-search-backward "^[ \t]*@" nil 'move))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3022
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3023 (defun bibtex-end-of-entry ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3024 "Move to end of BibTeX entry.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3025 If inside an entry, move to the end of it, otherwise move to the end
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3026 of the previous entry.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3027 If called from a program, this function returns the new location of point."
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3028 (interactive)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3029 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3030 (valid-entry-head
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3031 (concat "[ \t]*@[ \t]*\\("
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3032 (mapconcat
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3033 (lambda (type)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3034 (concat "\\(" (car type) "\\)"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3035 bibtex-entry-field-alist
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3036 "\\|")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3037 "\\)"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3038 (org (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3039 (pnt (bibtex-beginning-of-entry))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3040 err)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3041 (cond
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3042 ((bibtex-parse-string)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3043 (let ((bounds (bibtex-parse-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3044 (goto-char (bibtex-end-of-string bounds))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3045 ((looking-at "[ \t]*@[ \t]*preamble[ \t\n]*")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3046 (goto-char (match-end 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3047 (cond
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3048 ((looking-at "(")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3049 (if (not (re-search-forward ")[ \t]*\n\n" nil 'move))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3050 (setq err t)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3051 ((looking-at "{")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3052 (if (not (re-search-forward "}[ \t]*\n\n" nil 'move))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3053 (setq err t)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3054 (t
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3055 (setq err t)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3056 (if (not err)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3057 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3058 (goto-char (match-beginning 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3059 (forward-char))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3060 ((looking-at valid-entry-head)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3061 (bibtex-search-entry t nil t)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3062 (if (not (equal (match-beginning 0) pnt))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3063 (setq err t)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3064 (t
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3065 (if (interactive-p)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3066 (message "Not on a known BibTeX entry."))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3067 (goto-char org)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3068 (if err
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3069 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3070 (goto-char pnt)
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3071 (error "Syntactical incorrect entry starts here"))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3072 (point))
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3073
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3074 (defun bibtex-reposition-window (arg)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3075 "Make the current BibTeX entry visible."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3076 (interactive "P")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3077 (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3078 (goto-char
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3079 (/ (+ (bibtex-beginning-of-entry) (bibtex-end-of-entry)) 2))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3080 (recenter arg)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3081
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3082 (defun bibtex-mark-entry ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3083 "Put mark at beginning, point at end of current BibTeX entry."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3084 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3085 (set-mark (bibtex-beginning-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3086 (bibtex-end-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3087
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3088 (defun bibtex-count-entries (&optional count-string-entries)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3089 "Count number of entries in current buffer or region.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3090 With prefix argument COUNT-STRING-ENTRIES it counts all entries,
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3091 otherwise it counts all except Strings.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3092 If mark is active it counts entries in region, if not in whole buffer."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3093 (interactive "P")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3094 (let ((pnt (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3095 (start-point
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
3096 (if (bibtex-mark-active)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3097 (region-beginning)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3098 (bibtex-beginning-of-first-entry)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3099 (end-point
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
3100 (if (bibtex-mark-active)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3101 (region-end)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3102 (point-max)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3103 (number 0)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3104 (bibtex-sort-ignore-string-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3105 (not count-string-entries)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3106 (save-restriction
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3107 (narrow-to-region start-point end-point)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3108 (goto-char start-point)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3109 (bibtex-map-entries
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3110 (lambda (current)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3111 (setq number (1+ number)))))
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
3112 (message (concat (if (bibtex-mark-active) "Region" "Buffer")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3113 " contains %d entries.") number)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3114 (goto-char pnt)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3115
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3116 (defun bibtex-ispell-entry ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3117 "Spell whole BibTeX entry."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3118 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3119 (ispell-region (bibtex-beginning-of-entry) (bibtex-end-of-entry)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3120
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3121 (defun bibtex-ispell-abstract ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3122 "Spell abstract of BibTeX entry."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3123 (interactive)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3124 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3125 (pnt (bibtex-end-of-entry)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3126 (bibtex-beginning-of-entry)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3127 (let ((bounds (bibtex-search-forward-field "abstract" pnt)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3128 (if bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3129 (ispell-region (bibtex-start-of-text-in-field bounds) (bibtex-end-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3130 (error "No abstract in entry")))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3131
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3132 (defun bibtex-narrow-to-entry ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3133 "Narrow buffer to current BibTeX entry."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3134 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3135 (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3136 (narrow-to-region
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3137 (bibtex-beginning-of-entry) (bibtex-end-of-entry))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3138
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3139 (defun bibtex-sort-buffer ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3140 "Sort BibTeX buffer alphabetically by key.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3141 Text outside of BibTeX entries is not affected. If
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3142 `bibtex-sort-ignore-string-entries' is non-nil, @String entries will be
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3143 ignored."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3144 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3145 (save-restriction
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3146 (narrow-to-region
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3147 (bibtex-beginning-of-first-entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3148 (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3149 (goto-char (point-max))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3150 (bibtex-end-of-entry)))
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3151 (bibtex-skip-to-valid-entry)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3152 (sort-subr
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3153 nil
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3154 ;; NEXTREC function
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3155 'bibtex-skip-to-valid-entry
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3156 ;; ENDREC function
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3157 'bibtex-end-of-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3158 ;; STARTKEY function
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3159 (lambda ()
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3160 (let* ((case-fold-search t))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3161 (re-search-forward bibtex-entry-head)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3162 (buffer-substring-no-properties
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3163 (match-beginning bibtex-key-in-head)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3164 (match-end bibtex-key-in-head)))))))
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3165
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3166 (defun bibtex-find-entry-location (entry-name &optional ignore-dups)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3167 "Looking for place to put the BibTeX entry named ENTRY-NAME.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3168 Performs a binary search (therefore, buffer is assumed to be in sorted
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3169 order, without duplicates (see \\[bibtex-validate]), if it is
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3170 not, `bibtex-find-entry-location' will fail). If entry-name is already
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3171 used as a reference key, an error is signaled. However, if optional
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3172 variable IGNORE-DUPS is non-nil, no error messages about duplicate
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3173 entries are signaled, but the error handling is assumed to be made in
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3174 the calling function.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3175 The value is nil if an duplicate entry error occurred,
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3176 and t in all other cases."
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3177 (let* ((case-fold-search t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3178 (left
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3179 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3180 (bibtex-beginning-of-first-entry)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3181 (bibtex-skip-to-valid-entry)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3182 (bibtex-end-of-entry)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3183 (right
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3184 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3185 (bibtex-beginning-of-last-entry)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3186 (bibtex-skip-to-valid-entry t)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3187 (point)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3188 actual-point
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3189 actual-key
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3190 (done (>= left right))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3191 new
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3192 dup)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3193 (while (not done)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3194 (setq actual-point (/ (+ left right) 2))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3195 (goto-char actual-point)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3196 (bibtex-skip-to-valid-entry t)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3197 (setq actual-key
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3198 (progn
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3199 (re-search-forward bibtex-entry-head)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3200 (buffer-substring-no-properties
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3201 (match-beginning bibtex-key-in-head)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3202 (match-end bibtex-key-in-head))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3203 (cond
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3204 ((string-lessp entry-name actual-key)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3205 (setq new (bibtex-beginning-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3206 (if (equal right new)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3207 (setq done t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3208 (setq right new)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3209 ((string-lessp actual-key entry-name)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3210 (setq new (bibtex-end-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3211 (if (equal left new)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3212 (setq done t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3213 (setq left new)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3214 ((string-equal actual-key entry-name)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3215 (setq dup t
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3216 done t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3217 (if (not ignore-dups)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3218 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3219 (bibtex-beginning-of-entry)
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3220 (error "Entry with key `%s' already exists" entry-name))))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3221 (if dup
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3222 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3223 (bibtex-beginning-of-entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3224 nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3225 (goto-char right)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3226 (setq actual-key
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3227 (if (looking-at bibtex-entry-head)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3228 (buffer-substring-no-properties
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3229 (match-beginning bibtex-key-in-entry)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3230 (match-end bibtex-key-in-entry))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3231 (if (or
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3232 (not actual-key)
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3233 (string-lessp actual-key entry-name))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3234 ;; buffer contains no valid entries or
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3235 ;; greater than last entry --> append
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3236 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3237 (bibtex-end-of-entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3238 (if (not (bobp))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3239 (newline (forward-line 2)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3240 (beginning-of-line))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3241 (goto-char right))
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3242 t)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3243
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3244 (defun bibtex-validate (&optional test-thoroughly)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3245 "Validate if buffer or region is syntactically correct.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3246 Only known entry types are checked, so you can put comments
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3247 outside of entries.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3248 With optional argument TEST-THOROUGHLY non-nil it checks for absence of
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3249 required fields and questionable month fields as well.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3250 If mark is active, it validates current region, if not whole buffer.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3251 Returns t if test was successful, nil otherwise."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3252 (interactive "P")
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3253 (let* (error-list
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3254 syntax-error
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3255 (case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3256 (valid-bibtex-entry
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3257 (concat
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3258 "@[ \t]*\\(\\(string\\)\\|"
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3259 (mapconcat
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3260 (lambda (type)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3261 (concat "\\(" (car type) "\\)"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3262 bibtex-entry-field-alist
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3263 "\\|")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3264 "\\)"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3265 (pnt (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3266 (start-point
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3267 (if (bibtex-mark-active)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3268 (region-beginning)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3269 (bibtex-beginning-of-first-entry)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3270 (end-point
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3271 (if (bibtex-mark-active)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3272 (region-end)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3273 (point-max))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3274 (save-restriction
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3275 (narrow-to-region start-point end-point)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3276 ;; looking if entries fit syntactical structure
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3277 (goto-char start-point)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3278 (bibtex-progress-message "Checking syntactical structure")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3279 (while (re-search-forward "^[ \t]*@" nil t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3280 (bibtex-progress-message)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3281 (forward-char -1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3282 (let ((p (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3283 (must-match
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3284 (looking-at valid-bibtex-entry)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3285 (if (not must-match)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3286 (forward-char)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3287 (let (bibtex-sort-ignore-string-entries)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3288 (bibtex-skip-to-valid-entry))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3289 (if (equal (point) p)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3290 (forward-char)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3291 (goto-char p)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3292 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3293 error-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3294 (cons (list
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3295 (bibtex-current-line)
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3296 "Syntax error (check esp. commas, braces, and quotes)")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3297 error-list))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3298 (forward-char)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3299 (bibtex-progress-message 'done)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3300 (if error-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3301 (setq syntax-error t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3302 ;; looking for correct sort order and duplicates (only if
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3303 ;; there were no syntax errors)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3304 (if bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3305 (let (previous)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3306 (goto-char start-point)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3307 (bibtex-progress-message "Checking correct sort order")
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3308 (bibtex-map-entries
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3309 (lambda (current)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3310 (bibtex-progress-message)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3311 (cond ((or (not previous)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3312 (string< previous current))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3313 (setq previous current))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3314 ((string-equal previous current)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3315 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3316 error-list
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3317 (cons (list (bibtex-current-line)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3318 "Duplicate key with previous")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3319 error-list)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3320 (t
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3321 (setq previous current
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3322 error-list
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3323 (cons (list (bibtex-current-line)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3324 "Entries out of order")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3325 error-list))))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3326 (bibtex-progress-message 'done)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3327 (if test-thoroughly
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3328 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3329 (goto-char start-point)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3330 (bibtex-progress-message
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3331 "Checking required fields and month fields")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3332 (let ((bibtex-sort-ignore-string-entries t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3333 (questionable-month
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3334 (concat
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3335 "[{\"]\\("
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3336 (mapconcat
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3337 (lambda (mon)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3338 (concat "\\(" (car mon) "\\)"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3339 bibtex-predefined-month-strings
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3340 "\\|")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3341 "\\)[}\"]")))
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3342 (bibtex-map-entries
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3343 (lambda (current)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3344 (bibtex-progress-message)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3345 (let* ((beg (bibtex-beginning-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3346 (end (bibtex-end-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3347 (entry-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3348 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3349 (goto-char beg)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3350 (bibtex-search-entry nil end)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3351 (assoc-ignore-case
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3352 (buffer-substring-no-properties
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3353 (1+ (match-beginning bibtex-type-in-head))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3354 (match-end bibtex-type-in-head))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3355 bibtex-entry-field-alist)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3356 (req (copy-sequence (elt (elt entry-list 1) 0)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3357 (creq (copy-sequence (elt (elt entry-list 2) 0)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3358 crossref-there)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3359 (goto-char beg)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3360 (let ((bounds (bibtex-search-forward-field bibtex-field-name end)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3361 (while bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3362 (let ((field-name
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3363 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3364 (bibtex-start-of-name-in-field bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3365 (bibtex-end-of-name-in-field bounds))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3366 (if (and (equal (downcase field-name) "month")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3367 (string-match
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3368 questionable-month
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3369 (buffer-substring-no-properties
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3370 (bibtex-start-of-text-in-field bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3371 (bibtex-end-of-text-in-field bounds))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3372 (setq
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3373 error-list
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3374 (cons
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3375 (list
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3376 (bibtex-current-line)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3377 "Questionable month field (delimited string)")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3378 error-list)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3379 (setq
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3380 req
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3381 (delete (assoc-ignore-case field-name req) req)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3382 creq
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3383 (delete (assoc-ignore-case field-name creq) creq))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3384 (if (equal (downcase field-name) "crossref")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3385 (setq crossref-there t)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3386 (goto-char (bibtex-end-of-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3387 (setq bounds (bibtex-search-forward-field bibtex-field-name end))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3388 (if crossref-there
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3389 (setq req creq))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3390 (if (or (> (length req) 1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3391 (and (= (length req) 1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3392 (not (elt (car req) 3))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3393 ;; two (or more) fields missed or one field
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3394 ;; missed and this isn't flagged alternative
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3395 ;; (notice that this fails if there are more
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3396 ;; than two alternatives in a BibTeX entry,
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3397 ;; which isn't the case momentarily)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3398 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3399 error-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3400 (cons
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3401 (list (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3402 (bibtex-beginning-of-entry)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3403 (bibtex-current-line))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3404 (concat
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3405 "Required field \""
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3406 (car (car req))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3407 "\" missing"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3408 error-list)))))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3409 (bibtex-progress-message 'done)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3410 (goto-char pnt)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3411 (if error-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3412 (let ((bufnam (buffer-name))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3413 (dir default-directory))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3414 (setq error-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3415 (sort error-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3416 (lambda (a b)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3417 (< (car a) (car b)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3418 (let ((pop-up-windows t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3419 (pop-to-buffer nil t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3420 (switch-to-buffer
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3421 (get-buffer-create "*BibTeX validation errors*") t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3422 ;; don't use switch-to-buffer-other-window, since this
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3423 ;; doesn't allow the second parameter NORECORD
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3424 (setq default-directory dir)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3425 (toggle-read-only -1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3426 (compilation-mode)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3427 (delete-region (point-min) (point-max))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3428 (goto-char (point-min))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3429 (insert
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3430 "BibTeX mode command `bibtex-validate'\n"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3431 (if syntax-error
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3432 "Maybe undetected errors due to syntax errors. Correct and validate again."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3433 "")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3434 "\n")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3435 (while error-list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3436 (insert
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3437 bufnam ":" (number-to-string (elt (car error-list) 0))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3438 ": " (elt (car error-list) 1) "\n")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3439 (setq error-list (cdr error-list)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3440 (compilation-parse-errors nil nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3441 (setq compilation-old-error-list compilation-error-list)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3442 ;; this is necessary to avoid reparsing of buffer if you
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3443 ;; switch to compilation buffer and enter
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3444 ;; `compile-goto-error'
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3445 (set-buffer-modified-p nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3446 (toggle-read-only 1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3447 (goto-char (point-min))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3448 (other-window -1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3449 ;; return nil
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3450 nil)
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
3451 (if (bibtex-mark-active)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3452 (message "Region is syntactically correct")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3453 (message "Buffer is syntactically correct"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3454 t)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3455
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3456 (defun bibtex-next-field (arg)
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3457 "Finds end of text of next BibTeX field; with ARG, to its beginning."
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3458 (interactive "P")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3459 (bibtex-inside-field)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3460 (let ((start (point)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3461 (condition-case ()
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3462 (let ((bounds (bibtex-enclosing-field)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3463 (goto-char (bibtex-end-of-field bounds))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3464 (forward-char 2))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3465 (error
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3466 (goto-char start)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3467 (end-of-line)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3468 (forward-char))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3469 (bibtex-find-text arg t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3470
18502
708870732e5d (bibtex-kill-field, bibtex-find-text): Killing a field moves to the next line.
Richard M. Stallman <rms@gnu.org>
parents: 18248
diff changeset
3471 (defun bibtex-find-text (arg &optional as-if-interactive silent)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3472 "Go to end of text of current field; with ARG, go to beginning."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3473 (interactive "P")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3474 (bibtex-inside-field)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3475 (let ((bounds (bibtex-enclosing-field (or (interactive-p) as-if-interactive))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3476 (if bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3477 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3478 (if arg
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3479 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3480 (goto-char (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3481 (if (looking-at "[{\"]")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3482 (forward-char)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3483 (goto-char (bibtex-end-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3484 (if (or
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3485 (= (preceding-char) ?})
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3486 (= (preceding-char) ?\"))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3487 (forward-char -1)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3488 (if bibtex-help-message
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3489 (bibtex-print-help-message)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3490 (beginning-of-line)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3491 (cond
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3492 ((bibtex-parse-string)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3493 (let ((bounds (bibtex-parse-string)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3494 (goto-char
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3495 (if arg
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3496 (bibtex-start-of-text-in-string bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3497 (bibtex-end-of-text-in-string bounds)))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3498 ((looking-at bibtex-entry-maybe-empty-head)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3499 (goto-char
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3500 (if arg
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3501 (match-beginning bibtex-key-in-head)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3502 (match-end 0))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3503 (t
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3504 (if (not silent)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3505 (error "Not on BibTeX field")))))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3506
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3507 (defun bibtex-remove-OPT-or-ALT ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3508 "Removes the string starting optional/alternative fields.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3509 Aligns text and goes thereafter to end of text."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3510 (interactive)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3511 (bibtex-inside-field)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3512 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3513 (bounds (bibtex-enclosing-field)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3514 (save-excursion
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3515 (goto-char (bibtex-start-of-name-in-field bounds))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3516 (if (looking-at "OPT\\|ALT")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3517 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3518 (delete-char (length "OPT"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3519 ;; make field non-OPT
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3520 (search-forward "=")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3521 (forward-char -1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3522 (delete-horizontal-space)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3523 (if bibtex-align-at-equal-sign
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3524 (indent-to-column (- bibtex-text-indentation 2))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3525 (insert " "))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3526 (search-forward "=")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3527 (delete-horizontal-space)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3528 (if bibtex-align-at-equal-sign
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3529 (insert " ")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3530 (indent-to-column bibtex-text-indentation)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3531 (bibtex-inside-field)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3532
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3533 (defun bibtex-remove-delimiters ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3534 "Removes \"\" or {} around string."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3535 (interactive)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3536 (save-excursion
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3537 (bibtex-inside-field)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3538 (let* ((case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3539 (bounds (bibtex-enclosing-field))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3540 (stop (copy-marker (bibtex-end-of-text-in-field bounds))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3541 (goto-char (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3542 (let* ((boundaries (bibtex-search-forward-field-string stop)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3543 (while boundaries
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3544 (let ((text-end (copy-marker (cdr boundaries))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3545 (goto-char (car boundaries))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3546 (delete-char 1)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3547 (goto-char text-end)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3548 (delete-backward-char 1)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3549 (setq boundaries (bibtex-search-forward-field-string stop))))))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3550
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3551 (defun bibtex-kill-field (&optional copy-only)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3552 "Kills the entire enclosing BibTeX field.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3553 With prefix arg COPY-ONLY, copy the current field to `bibtex-field-kill-ring,'
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3554 but do not actually kill it."
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3555 (interactive "P")
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3556 (let* ((pnt (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3557 (case-fold-search t))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3558 (bibtex-inside-field)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3559 (let* ((bounds (bibtex-enclosing-field))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3560 (the-end (bibtex-end-of-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3561 (the-beginning (bibtex-start-of-field bounds)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3562 (goto-char the-end)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3563 (skip-chars-forward " \t\n,")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3564 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3565 bibtex-field-kill-ring
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3566 (cons
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3567 (list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3568 'field
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3569 (buffer-substring-no-properties
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3570 (bibtex-start-of-name-in-field bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3571 (bibtex-end-of-name-in-field bounds))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3572 (buffer-substring-no-properties
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3573 (bibtex-start-of-text-in-field bounds)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3574 (bibtex-end-of-text-in-field bounds)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3575 bibtex-field-kill-ring))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3576 (if (> (length bibtex-field-kill-ring) bibtex-field-kill-ring-max)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3577 (setcdr
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3578 (nthcdr (1- bibtex-field-kill-ring-max) bibtex-field-kill-ring)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3579 nil))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3580 (setq bibtex-field-kill-ring-yank-pointer bibtex-field-kill-ring)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3581 (if copy-only
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3582 (goto-char pnt)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3583 (delete-region the-beginning the-end)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3584 (let (bibtex-help-message)
18502
708870732e5d (bibtex-kill-field, bibtex-find-text): Killing a field moves to the next line.
Richard M. Stallman <rms@gnu.org>
parents: 18248
diff changeset
3585 (bibtex-find-text nil t t)))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3586 (setq bibtex-last-kill-command 'field))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3587
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3588 (defun bibtex-copy-field-as-kill ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3589 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3590 (bibtex-kill-field t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3591
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3592 (defun bibtex-kill-entry (&optional copy-only)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3593 "Kill the entire enclosing BibTeX entry.
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3594 With prefix arg COPY-ONLY the current entry to
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3595 `bibtex-entry-kill-ring', but do not actually kill it."
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3596 (interactive "P")
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3597 (let* ((pnt (point))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3598 (case-fold-search t)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3599 (beg (bibtex-beginning-of-entry))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3600 (end
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3601 (progn
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3602 (bibtex-end-of-entry)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3603 (if (re-search-forward
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3604 bibtex-entry-maybe-empty-head nil 'move)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3605 (goto-char (match-beginning 0)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3606 (point))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3607 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3608 bibtex-entry-kill-ring
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3609 (cons
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3610 (list 'entry (buffer-substring-no-properties beg end))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3611 bibtex-entry-kill-ring))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3612 (if (> (length bibtex-entry-kill-ring) bibtex-entry-kill-ring-max)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3613 (setcdr
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3614 (nthcdr (1- bibtex-entry-kill-ring-max) bibtex-entry-kill-ring)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3615 nil))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3616 (setq bibtex-entry-kill-ring-yank-pointer bibtex-entry-kill-ring)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3617 (if copy-only
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3618 (goto-char pnt)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3619 (delete-region beg end)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3620 (setq bibtex-last-kill-command 'entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3621
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3622 (defun bibtex-copy-entry-as-kill ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3623 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3624 (bibtex-kill-entry t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3625
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3626 (defun bibtex-yank (&optional n)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3627 "Reinsert the last BibTeX item.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3628 More precisely, reinsert the field or entry killed or yanked most recently.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3629 With argument N, reinsert the Nth most recently killed BibTeX item.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3630 See also the command \\[bibtex-yank-pop]]."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3631 (interactive "*p")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3632 (bibtex-insert-current-kill (1- n))
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3633 (setq this-command 'bibtex-yank))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3634
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3635 (defun bibtex-yank-pop (n)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3636 "Replace just-yanked killed BibTeX item with a different.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3637 This command is allowed only immediately after a `bibtex-yank' or a
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3638 `bibtex-yank-pop'.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3639 At such a time, the region contains a reinserted previously killed
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3640 BibTeX item. `bibtex-yank-pop' deletes that item and inserts in its
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3641 place a different killed BibTeX item.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3642
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3643 With no argument, the previous kill is inserted.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3644 With argument N, insert the Nth previous kill.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3645 If N is negative, this is a more recent kill.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3646
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3647 The sequence of kills wraps around, so that after the oldest one
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3648 comes the newest one."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3649 (interactive "*p")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3650 (if (not (eq last-command 'bibtex-yank))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3651 (error "Previous command was not a BibTeX yank"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3652 (setq this-command 'bibtex-yank)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3653 (let ((inhibit-read-only t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3654 (delete-region (point) (mark t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3655 (bibtex-insert-current-kill n)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3656
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3657 (defun bibtex-empty-field ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3658 "Delete the text part of the current field, replace with empty text."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3659 (interactive)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3660 (bibtex-inside-field)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3661 (let ((bounds (bibtex-enclosing-field)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3662 (goto-char (bibtex-start-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3663 (delete-region (point) (bibtex-end-of-text-in-field bounds))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3664 (insert (concat (bibtex-field-left-delimiter)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3665 (bibtex-field-right-delimiter)) )
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3666 (bibtex-find-text t)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3667
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
3668 (defun bibtex-pop-previous (arg)
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3669 "Replace text of current field with the similar field in previous entry.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3670 With arg, goes up ARG entries. Repeated, goes up so many times. May be
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
3671 intermixed with \\[bibtex-pop-next] (bibtex-pop-next)."
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
3672 (interactive "p")
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
3673 (bibtex-pop arg 'previous))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3674
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3675 (defun bibtex-pop-next (arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3676 "Replace text of current field with the text of similar field in next entry.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3677 With arg, goes down ARG entries. Repeated, goes down so many times. May be
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3678 intermixed with \\[bibtex-pop-previous] (bibtex-pop-previous)."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3679 (interactive "p")
14789
d68b71228abd (bibtex-pop): New generic function which unifies the
Richard M. Stallman <rms@gnu.org>
parents: 14410
diff changeset
3680 (bibtex-pop arg 'next))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3681
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3682 (defun bibtex-clean-entry (&optional new-reference-key called-by-reformat)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3683 "Finish editing the current BibTeX entry and clean it up.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3684 Checks that no required fields are empty and formats entry dependent
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3685 on the value of bibtex-entry-format.
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3686 If the reference key of the entry is empty or a prefix argument is given,
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3687 calculate a new reference key (note: this only will work if fields in entry
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3688 begin on separate lines prior to calling bibtex-clean-entry or if 'realign is
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3689 contained in bibtex-entry-format).
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3690 Don't call this on `string' or `preamble' entries.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3691 At end of the cleaning process, the functions in
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3692 bibtex-clean-entry-hook are called with region narrowed to entry."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3693 (interactive "P")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3694 (bibtex-format-entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3695 (let* ((case-fold-search t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3696 (eob (bibtex-end-of-entry))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3697 (key (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3698 (bibtex-beginning-of-entry)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
3699 (if (re-search-forward
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3700 bibtex-entry-head eob t)
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
3701 (buffer-substring-no-properties
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3702 (match-beginning bibtex-key-in-head)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3703 (match-end bibtex-key-in-head))))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3704 (if (or
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3705 new-reference-key
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3706 (not key))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3707 (progn
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3708 (let ((autokey
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3709 (if bibtex-autokey-edit-before-use
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3710 (read-from-minibuffer
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3711 "Key to use: " (bibtex-generate-autokey) nil nil
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3712 'bibtex-key-history)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3713 (bibtex-generate-autokey))))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3714 (bibtex-beginning-of-entry)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3715 (re-search-forward bibtex-entry-maybe-empty-head)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
3716 (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
3717 (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
3718 (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
3719 (insert autokey)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3720 (let* ((start (bibtex-beginning-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3721 (end (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3722 (bibtex-end-of-entry)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3723 (if (re-search-forward
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3724 bibtex-entry-maybe-empty-head nil 'move)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3725 (goto-char (match-beginning 0)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3726 (point)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3727 (entry (buffer-substring start end)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3728 (delete-region start end)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
3729 (let ((success
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
3730 (or
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3731 called-by-reformat
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
3732 (not bibtex-maintain-sorted-entries)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
3733 (bibtex-find-entry-location autokey t))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3734 (insert entry)
13728
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
3735 (forward-char -1)
4b7903cfa7ee (bibtex-auto-fill-function): Adapted for use with
Karl Heuer <kwzh@gnu.org>
parents: 12770
diff changeset
3736 (bibtex-beginning-of-entry)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3737 (re-search-forward bibtex-entry-head)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3738 (if (not success)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3739 (error
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3740 "New inserted entry yields duplicate key"))))))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3741 (if (not called-by-reformat)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3742 (save-excursion
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3743 (save-restriction
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3744 (narrow-to-region
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3745 (bibtex-beginning-of-entry) (bibtex-end-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3746 (bibtex-parse-keys t nil)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3747 (run-hooks 'bibtex-clean-entry-hook)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3748
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3749 (defun bibtex-fill-entry ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3750 "Fill current entry.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3751 Realigns entry, so that every field starts on a separate line. Field
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3752 names appear in column `bibtex-field-indentation', field text starts in
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3753 column `bibtex-text-indentation' and continuation lines start here, too.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3754 If `bibtex-align-at-equal-sign' is non-nil, align equal signs also."
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3755 (interactive "*")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3756 (let ((pnt (copy-marker (point)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3757 (end (copy-marker (bibtex-end-of-entry))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3758 (bibtex-beginning-of-entry)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3759 (bibtex-delete-whitespace)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3760 (indent-to-column bibtex-entry-offset)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3761 (let ((bounds (bibtex-search-forward-field bibtex-field-name end)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3762 (while bounds
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3763 (let* ((begin-field (copy-marker (bibtex-start-of-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3764 (end-field (copy-marker (bibtex-end-of-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3765 (begin-name (copy-marker (bibtex-start-of-name-in-field bounds)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3766 (end-name (copy-marker (bibtex-end-of-name-in-field bounds))))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3767 (goto-char begin-field)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3768 (forward-char)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3769 (bibtex-delete-whitespace)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3770 (open-line 1)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3771 (forward-char)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3772 (indent-to-column
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3773 (+ bibtex-entry-offset bibtex-field-indentation))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3774 (re-search-forward "[ \t\n]*=" end)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3775 (replace-match "=")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3776 (forward-char -1)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3777 (if bibtex-align-at-equal-sign
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3778 (indent-to-column
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3779 (+ bibtex-entry-offset (- bibtex-text-indentation 2)))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3780 (insert " "))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3781 (forward-char)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3782 (bibtex-delete-whitespace)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3783 (if bibtex-align-at-equal-sign
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3784 (insert " ")
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3785 (indent-to-column bibtex-text-indentation))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3786 (while (re-search-forward "[ \t\n]+" end-field 'move)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3787 (replace-match " "))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3788 (bibtex-do-auto-fill)
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3789 (goto-char end-field))
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3790 (setq bounds (bibtex-search-forward-field bibtex-field-name end))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3791 (if (looking-at ",")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3792 (forward-char))
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3793 (bibtex-delete-whitespace)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3794 (open-line 1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3795 (forward-char)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3796 (indent-to-column bibtex-entry-offset)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3797 (goto-char pnt)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3798
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3799 (defun bibtex-reformat (&optional additional-options called-by-convert-alien)
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3800 "Reformat all BibTeX entries in buffer or region.
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3801 With prefix argument, read options for reformatting from minibuffer.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3802 With \\[universal-argument] \\[universal-argument] prefix argument, reuse previous answers (if any) again.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3803 If mark is active it reformats entries in region, if not in whole buffer."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3804 (interactive "*P")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3805 (let* ((pnt (point))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3806 (use-previous-options
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3807 (and (equal (prefix-numeric-value additional-options) 16)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3808 (or bibtex-reformat-previous-options
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3809 bibtex-reformat-previous-reference-keys)))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3810 (bibtex-entry-format
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3811 (if additional-options
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3812 (if use-previous-options
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3813 bibtex-reformat-previous-options
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3814 (setq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3815 bibtex-reformat-previous-options
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3816 (delq
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3817 nil
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3818 (list
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3819 (if (or
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3820 called-by-convert-alien
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3821 (y-or-n-p
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3822 "Realign entries (recommended for files not created by BibTeX mode)? "))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3823 'realign)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3824 (if (y-or-n-p
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3825 "Remove empty optional and alternative fields? ")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3826 'opts-or-alts)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3827 (if (y-or-n-p
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3828 "Remove delimiters around pure numerical fields? ")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3829 'numerical-fields)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3830 (if (y-or-n-p (concat
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3831 (if bibtex-comma-after-last-field
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3832 "Insert"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3833 "Remove")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3834 " comma at end of entry? "))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3835 'last-comma)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3836 (if (y-or-n-p
18502
708870732e5d (bibtex-kill-field, bibtex-find-text): Killing a field moves to the next line.
Richard M. Stallman <rms@gnu.org>
parents: 18248
diff changeset
3837 "Replace double page dashes by single ones? ")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3838 'page-dashes)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3839 (if (y-or-n-p
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3840 "Force delimiters? ")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3841 'delimiters)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3842 (if (y-or-n-p
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3843 "Unify case of entry types and field names? ")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3844 'unify-case)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3845 '(realign)))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3846 (reformat-reference-keys
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3847 (if additional-options
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3848 (if use-previous-options
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3849 bibtex-reformat-previous-reference-keys
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3850 (setq
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3851 bibtex-reformat-previous-reference-keys
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3852 (y-or-n-p "Generate new reference keys automatically? ")))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3853 bibtex-autokey-edit-before-use
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3854 (bibtex-sort-ignore-string-entries t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3855 (start-point
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
3856 (if (bibtex-mark-active)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3857 (region-beginning)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3858 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3859 (bibtex-beginning-of-first-entry)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3860 (bibtex-skip-to-valid-entry)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3861 (point))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3862 (end-point
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
3863 (if (bibtex-mark-active)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3864 (region-end)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3865 (point-max)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3866 (valid-bibtex-entry
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3867 (concat
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3868 "[ \t\n]+\\(@[ \t]*\\("
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3869 (mapconcat
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3870 (lambda (type)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3871 (concat "\\(" (car type) "\\)"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3872 bibtex-entry-field-alist
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3873 "\\|")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3874 "\\)\\)")))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3875 (save-restriction
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3876 (narrow-to-region start-point end-point)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3877 (if (memq 'realign bibtex-entry-format)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3878 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3879 (goto-char (point-min))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3880 (while (re-search-forward valid-bibtex-entry nil t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3881 (replace-match "\n\\1"))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3882 (goto-char start-point)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3883 (bibtex-progress-message "Formatting" 1)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3884 (bibtex-map-entries
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3885 (lambda (current)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3886 (bibtex-progress-message)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3887 (bibtex-clean-entry reformat-reference-keys reformat-reference-keys)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3888 (if (memq 'realign bibtex-entry-format)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3889 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3890 (bibtex-end-of-entry)
18247
ae094c1a4334 (bibtex-delete-whitespace, bibtex-current-line)
Richard M. Stallman <rms@gnu.org>
parents: 18212
diff changeset
3891 (bibtex-delete-whitespace)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3892 (open-line 2)))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3893 (bibtex-progress-message 'done))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3894 (if (and
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3895 reformat-reference-keys
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3896 bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3897 (not called-by-convert-alien))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3898 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3899 (bibtex-sort-buffer)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3900 (setq bibtex-reference-keys nil)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3901 (bibtex-parse-keys nil t t)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3902 (goto-char pnt)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3903
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3904 (defun bibtex-convert-alien (&optional do-additional-reformatting)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3905 "Converts an alien BibTeX buffer to be fully usable by BibTeX mode.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3906 If a file doesn't confirm with some standards used by BibTeX mode,
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3907 some of the high-level features of BibTeX mode won't be available.
19461
6b67f20dd710 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 19460
diff changeset
3908 This function tries to convert current buffer to confirm with these standards.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3909 With prefix argument DO-ADDITIONAL-REFORMATTING
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3910 non-nil, read options for reformatting entries from minibuffer."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3911 (interactive "*P")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3912 (message "Starting to validate buffer...")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3913 (sit-for 1 nil t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3914 (goto-char (point-min))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3915 (while (re-search-forward "[ \t\n]+@" nil t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3916 (replace-match "\n@"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3917 (message
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3918 "If errors occur, correct them and call `bibtex-convert-alien' again")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3919 (sit-for 5 nil t)
20907
9a55a557cb5a (bibtex-autokey-names): Change number tag to integer.
Richard M. Stallman <rms@gnu.org>
parents: 20866
diff changeset
3920 (if (let ((bibtex-mark-active)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3921 bibtex-maintain-sorted-entries)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3922 (bibtex-validate))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3923 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3924 (message "Starting to reformat entries...")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3925 (sit-for 2 nil t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3926 (bibtex-reformat do-additional-reformatting t)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3927 (if bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3928 (progn
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3929 (message "Starting to sort buffer...")
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3930 (bibtex-sort-buffer)))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3931 (goto-char (point-max))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3932 (message "Buffer is now parsable. Please save it."))))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3933
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3934 (defun bibtex-complete-string ()
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3935 "Complete word fragment before point to longest prefix of a defined string.
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3936 If point is not after the part of a word, all strings are listed.
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3937 Remove surrounding delimiters if complete string could be expanded."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3938 (interactive "*")
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3939 (bibtex-complete bibtex-strings t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3940
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3941 (defun bibtex-complete-key ()
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3942 "Complete word fragment before point to longest prefix of a defined key.
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3943 If point is not after the part of a word, all keys are listed. This
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3944 function is most useful in completing crossref entries."
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3945 (interactive "*")
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3946 (if (not bibtex-reference-keys)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
3947 (bibtex-parse-keys nil t))
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
3948 (bibtex-complete bibtex-reference-keys))
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3949
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3950 (defun bibtex-Article ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3951 "Insert a new BibTeX @Article entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3952 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3953 (bibtex-entry "Article"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3954
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3955 (defun bibtex-Book ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3956 "Insert a new BibTeX @Book entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3957 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3958 (bibtex-entry "Book"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3959
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3960 (defun bibtex-Booklet ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3961 "Insert a new BibTeX @Booklet entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3962 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3963 (bibtex-entry "Booklet"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3964
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3965 (defun bibtex-InBook ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3966 "Insert a new BibTeX @InBook entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3967 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3968 (bibtex-entry "InBook"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3969
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3970 (defun bibtex-InCollection ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3971 "Insert a new BibTeX @InCollection entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3972 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3973 (bibtex-entry "InCollection"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3974
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3975 (defun bibtex-InProceedings ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3976 "Insert a new BibTeX @InProceedings entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3977 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3978 (bibtex-entry "InProceedings"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3979
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3980 (defun bibtex-Manual ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3981 "Insert a new BibTeX @Manual entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3982 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3983 (bibtex-entry "Manual"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3984
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3985 (defun bibtex-MastersThesis ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3986 "Insert a new BibTeX @MastersThesis entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3987 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3988 (bibtex-entry "MastersThesis"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3989
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3990 (defun bibtex-Misc ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3991 "Insert a new BibTeX @Misc entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3992 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3993 (bibtex-entry "Misc"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3994
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3995 (defun bibtex-PhdThesis ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
3996 "Insert a new BibTeX @PhdThesis entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3997 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3998 (bibtex-entry "PhdThesis"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
3999
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4000 (defun bibtex-Proceedings ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
4001 "Insert a new BibTeX @Proceedings entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4002 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4003 (bibtex-entry "Proceedings"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4004
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4005 (defun bibtex-TechReport ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
4006 "Insert a new BibTeX @TechReport entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4007 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4008 (bibtex-entry "TechReport"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4009
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4010 (defun bibtex-Unpublished ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
4011 "Insert a new BibTeX @Unpublished entry; see also `bibtex-entry'."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4012 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4013 (bibtex-entry "Unpublished"))
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4014
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4015 (defun bibtex-String ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
4016 "Insert a new BibTeX @String entry."
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4017 (interactive)
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
4018 (if (not bibtex-reference-keys)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4019 (bibtex-parse-keys nil t))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4020 (let ((key
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4021 (if (and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4022 bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4023 (not bibtex-sort-ignore-string-entries))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4024 (completing-read
27701
5e135f0faf1d (bibtex-mode): Replaced manual splitting of path
Gerd Moellmann <gerd@gnu.org>
parents: 26711
diff changeset
4025 "String key: " bibtex-reference-keys nil nil nil 'bibtex-key-history))))
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4026 (if (and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4027 bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4028 (not bibtex-sort-ignore-string-entries))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4029 (bibtex-find-entry-location key)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4030 (bibtex-move-outside-of-entry))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4031 (indent-to-column bibtex-entry-offset)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4032 (insert
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4033 (concat
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4034 "@String"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4035 (bibtex-entry-left-delimiter)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4036 (if (and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4037 bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4038 (not bibtex-sort-ignore-string-entries))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4039 key)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4040 " = "
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4041 (bibtex-field-left-delimiter)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4042 (bibtex-field-right-delimiter)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4043 (bibtex-entry-right-delimiter)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4044 "\n"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4045 (forward-line -1)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4046 (forward-char
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4047 (if (and
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4048 bibtex-maintain-sorted-entries
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4049 (not bibtex-sort-ignore-string-entries))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4050 (+ (length "@String{") (length key) (length " = {"))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4051 (length "@String{")))))
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4052
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4053 (defun bibtex-Preamble ()
22563
2e2a71dfec63 Numerous documentation fixups.
Richard M. Stallman <rms@gnu.org>
parents: 21169
diff changeset
4054 "Insert a new BibTeX @Preamble entry."
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4055 (interactive)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4056 (bibtex-move-outside-of-entry)
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4057 (indent-to-column bibtex-entry-offset)
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4058 (insert
18212
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4059 "@Preamble"
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4060 (bibtex-entry-left-delimiter)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4061 (bibtex-entry-right-delimiter)
3864648e9b4f (bibtex-mode-map): Changed the binding of the C-TAB
Richard M. Stallman <rms@gnu.org>
parents: 17700
diff changeset
4062 "\n")
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4063 (forward-line -1)
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4064 (forward-char 10))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4065
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4066
12700
b3a8ee2da96a Add keywords and comments as per conventions.
Richard M. Stallman <rms@gnu.org>
parents: 12028
diff changeset
4067 ;; Make BibTeX a Feature
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4068
10219
d97313bb6f39 (bibtex-string, bibtex-preamble): Use forward-line.
Richard M. Stallman <rms@gnu.org>
parents: 10106
diff changeset
4069 (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
4070
2465861025cd Installed Aaron Larson's new bibtex.el. See the header comment for
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
4071 ;;; bibtex.el ends here