aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1996-07-11 23:13:33 +0000
committerKarl Heuer1996-07-11 23:13:33 +0000
commitaf6fb89dbb44db059c1e911cd64369ad5a5ba887 (patch)
treec53a0ea045069e67e02190bc3376ecb78caaeec3
parentd6f8129433c7ac46f369a7a9738cae90d6e317a6 (diff)
downloademacs-af6fb89dbb44db059c1e911cd64369ad5a5ba887.tar.gz
emacs-af6fb89dbb44db059c1e911cd64369ad5a5ba887.zip
(bibtex-reference-head): Allow spaces and tabs between
opening brace or paren and key. Simplify regexp. (bibtex-type-in-head, bibtex-key-in-head): Decrement. (bibtex-mode): Use new function run-with-idle-timer instead of auto-save-hook for periodically parsing keys. (bibtex-mode-syntax-table, bibtex-autokey-name-change-strings, bibtex-autokey-titleword-change-strings): Support non-escaped double-quoted characters (as with german styles). (bibtex-field-string-quoted): Disallow lines like author = "Stefan Sch"of" until BibTeX supports them.
-rw-r--r--lisp/textmodes/bibtex.el32
1 files changed, 23 insertions, 9 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index ae9b0c42d76..0217825736c 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -95,6 +95,13 @@ duplicates) from bibtex-mode. See also bibtex-sort-ignore-string-entries.
95This variable is buffer local.") 95This variable is buffer local.")
96(make-variable-buffer-local 'bibtex-maintain-sorted-entries) 96(make-variable-buffer-local 'bibtex-maintain-sorted-entries)
97 97
98(defvar bibtex-parse-keys-timeout auto-save-timeout
99 "*Specifies interval for parsing buffer for keys.
100The buffer is checked every bibtex-parse-keys-timeout seconds if it is
101modified since last parsing and is parsed if necessary. This is needed
102only if buffer is maintained sorted (bibtex-maintain-sorted-entries
103non-nil).")
104
98(defvar bibtex-entry-field-alist 105(defvar bibtex-entry-field-alist
99 '( 106 '(
100 ("Article" . (((("author" "Author1 [and Author2 ...] [and others]") 107 ("Article" . (((("author" "Author1 [and Author2 ...] [and others]")
@@ -326,6 +333,8 @@ See the documentation of function bibtex-generate-autokey for further detail.")
326 '(("\\\\\\\"a" "ae") ("\\\\\\\"o" "oe") ("\\\\\\\"u" "ue") 333 '(("\\\\\\\"a" "ae") ("\\\\\\\"o" "oe") ("\\\\\\\"u" "ue")
327 ("\\\\\\\"s" "ss") 334 ("\\\\\\\"s" "ss")
328 ("\\\\\\\"A" "Ae") ("\\\\\\\"O" "Oe") ("\\\\\\\"U" "Ue") 335 ("\\\\\\\"A" "Ae") ("\\\\\\\"O" "Oe") ("\\\\\\\"U" "Ue")
336 ("\\\"a" "ae") ("\\\"o" "oe") ("\\\"u" "ue") ("\\\"s" "ss")
337 ("\\\"A" "Ae") ("\\\"O" "Oe") ("\\\"U" "Ue")
329 ("{" "") ("}" "")) 338 ("{" "") ("}" ""))
330 "Alist of (old-regexp new-string) pairs. 339 "Alist of (old-regexp new-string) pairs.
331Any part of name matching a old-regexp is replaced by new-string. 340Any part of name matching a old-regexp is replaced by new-string.
@@ -379,6 +388,8 @@ See the documentation of function bibtex-generate-autokey for further detail.")
379 '(("\\\\\\\"a" "ae") ("\\\\\\\"o" "oe") ("\\\\\\\"u" "ue") 388 '(("\\\\\\\"a" "ae") ("\\\\\\\"o" "oe") ("\\\\\\\"u" "ue")
380 ("\\\\\\\"s" "ss") 389 ("\\\\\\\"s" "ss")
381 ("\\\\\\\"A" "Ae") ("\\\\\\\"O" "Oe") ("\\\\\\\"U" "Ue") 390 ("\\\\\\\"A" "Ae") ("\\\\\\\"O" "Oe") ("\\\\\\\"U" "Ue")
391 ("\\\"a" "ae") ("\\\"o" "oe") ("\\\"u" "ue") ("\\\"s" "ss")
392 ("\\\"A" "Ae") ("\\\"O" "Oe") ("\\\"U" "Ue")
382 ("{" "") ("}" "")) 393 ("{" "") ("}" ""))
383 "Alist of (old-regexp new-string) pairs. 394 "Alist of (old-regexp new-string) pairs.
384Any part of title word matching a old-regexp is replaced by new-string. 395Any part of title word matching a old-regexp is replaced by new-string.
@@ -413,8 +424,8 @@ See the documentation of function bibtex-generate-autokey for further detail.")
413;; Syntax Table, Keybindings and BibTeX Entry List 424;; Syntax Table, Keybindings and BibTeX Entry List
414(defvar bibtex-mode-syntax-table 425(defvar bibtex-mode-syntax-table
415 (let ((st (make-syntax-table))) 426 (let ((st (make-syntax-table)))
416 ;; [alarson:19920214.1004CST] make double quote a string quote 427 (modify-syntax-entry ?\" "w" st)
417 (modify-syntax-entry ?\" "\"" st) 428 ;; this was formerly "\"". Does this cause any problems?
418 (modify-syntax-entry ?$ "$$ " st) 429 (modify-syntax-entry ?$ "$$ " st)
419 (modify-syntax-entry ?% "< " st) 430 (modify-syntax-entry ?% "< " st)
420 (modify-syntax-entry ?' "w " st) 431 (modify-syntax-entry ?' "w " st)
@@ -649,8 +660,11 @@ See the documentation of function bibtex-generate-autokey for further detail.")
649 "\\(" 660 "\\("
650 "\\(" "[^\"\\]" "\\)" ;; every character except quote or backslash 661 "\\(" "[^\"\\]" "\\)" ;; every character except quote or backslash
651 "\\|" 662 "\\|"
652 "\\(" "\"[A-Za-z-]" "\\)" ;; a quote followed by a letter or dash 663;; "\\(" "\"[A-Za-z-]" "\\)" ;; a quote followed by a letter or dash
653 "\\|" 664;; "\\|"
665;; last two lines commented out until lines like
666;; author = "Stefan Sch"of"
667;; are supported by BibTeX
654 "\\(" "\\\\.\\|\n" "\\)" ;; a backslash followed by any character 668 "\\(" "\\\\.\\|\n" "\\)" ;; a backslash followed by any character
655 "\\)*" 669 "\\)*"
656 "\"")) 670 "\""))
@@ -693,7 +707,7 @@ See the documentation of function bibtex-generate-autokey for further detail.")
693;; bibtex-field-const (see above)) 707;; bibtex-field-const (see above))
694 708
695(defconst bibtex-reference-head 709(defconst bibtex-reference-head
696 (concat "^\\( \\|\t\\)*\\(" 710 (concat "^[ \t]*\\("
697 bibtex-reference-type 711 bibtex-reference-type
698 "\\)[ \t]*[({][ \t]*\\(" 712 "\\)[ \t]*[({][ \t]*\\("
699 bibtex-reference-key 713 bibtex-reference-key
@@ -706,11 +720,11 @@ See the documentation of function bibtex-generate-autokey for further detail.")
706;; Regexp defining format of the header line of a maybe empty 720;; Regexp defining format of the header line of a maybe empty
707;; BibTeX reference entry (without reference key). 721;; BibTeX reference entry (without reference key).
708 722
709(defconst bibtex-type-in-head 2) 723(defconst bibtex-type-in-head 1)
710;; The regexp subexpression number of the type part in 724;; The regexp subexpression number of the type part in
711;; bibtex-reference-head. 725;; bibtex-reference-head.
712 726
713(defconst bibtex-key-in-head 3) 727(defconst bibtex-key-in-head 2)
714;; The regexp subexpression number of the key part in 728;; The regexp subexpression number of the key part in
715;; bibtex-reference-head. 729;; bibtex-reference-head.
716 730
@@ -1457,8 +1471,8 @@ non-nil."
1457 (setq bibtex-completion-candidates compl)) 1471 (setq bibtex-completion-candidates compl))
1458 (error "File %s not in $BIBINPUTS paths" filename))))) 1472 (error "File %s not in $BIBINPUTS paths" filename)))))
1459 bibtex-string-files) 1473 bibtex-string-files)
1460 (add-hook 1474 (run-with-idle-timer
1461 'auto-save-hook 1475 bibtex-parse-keys-timeout bibtex-parse-keys-timeout
1462 (function 1476 (function
1463 (lambda () 1477 (lambda ()
1464 (if (and 1478 (if (and