Mercurial > emacs
comparison lisp/textmodes/bibtex.el @ 14193:649ead749232
(bibtex-font-lock-keywords, bibtex-mode):
Use word-syntax in patterns.
(bibtex-font-lock-keywords): Allow a more relaxed format
of the buffer and use more appropriate faces.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 16 Jan 1996 16:37:54 +0000 |
parents | 83f275dcd93a |
children | 1ae071abac0f |
comparison
equal
deleted
inserted
replaced
14192:b1bc0f5d8cf3 | 14193:649ead749232 |
---|---|
409 (defvar bibtex-autokey-edit-before-use t | 409 (defvar bibtex-autokey-edit-before-use t |
410 "*If non-nil, user is allowed to edit the generated key before it is used.") | 410 "*If non-nil, user is allowed to edit the generated key before it is used.") |
411 | 411 |
412 (defvar bibtex-font-lock-keywords | 412 (defvar bibtex-font-lock-keywords |
413 (list | 413 (list |
414 "^@[A-Za-z]*[({]" | 414 '("\\(^@\\sw+\\)[ \t]*[({][ \t]*\\([^ \t\n,]*\\)" |
415 ;; reference type | 415 (1 font-lock-keyword-face) (2 font-lock-reference-face)) |
416 '("^\\([ \t]*OPT[A-Za-z_-][A-Za-z0-9_-]*\\)[ \t]*=" | 416 ;; reference type and reference label |
417 '("^[ \t]*\\(OPT\\sw+\\)[ \t]*=" | |
417 1 font-lock-comment-face) | 418 1 font-lock-comment-face) |
418 ;; optional field names | 419 ;; optional field names (treated as comments) |
419 '("^\\([ \t]*[A-Za-z_-][A-Za-z0-9_-]*\\)[ \t]*=" | 420 '("^[ \t]*\\(\\sw+\\)[ \t]*=" |
420 1 font-lock-function-name-face) | 421 1 font-lock-variable-name-face) |
421 ;; field names | 422 ;; field names |
422 '("^@[A-Za-z]*[({]\\([^\n,]*\\)," | |
423 1 font-lock-string-face) | |
424 ;; reference labels | |
425 ) | 423 ) |
426 "*Fonts to use in BibTeX mode") | 424 "*Default expressions to highlight in BibTeX mode.") |
427 | |
428 | 425 |
429 ;; Syntax Table, Keybindings and BibTeX Entry List | 426 ;; Syntax Table, Keybindings and BibTeX Entry List |
430 (defvar bibtex-mode-syntax-table | 427 (defvar bibtex-mode-syntax-table |
431 (let ((st (make-syntax-table))) | 428 (let ((st (make-syntax-table))) |
432 ;; [alarson:19920214.1004CST] make double quote a string quote | 429 ;; [alarson:19920214.1004CST] make double quote a string quote |
1383 (make-local-variable 'comment-start) | 1380 (make-local-variable 'comment-start) |
1384 (setq comment-start "%") | 1381 (setq comment-start "%") |
1385 (auto-fill-mode 1) | 1382 (auto-fill-mode 1) |
1386 (setq auto-fill-function 'bibtex-auto-fill-function) | 1383 (setq auto-fill-function 'bibtex-auto-fill-function) |
1387 (set (make-local-variable 'font-lock-defaults) | 1384 (set (make-local-variable 'font-lock-defaults) |
1388 '(bibtex-font-lock-keywords nil t ((?$ . "\"")))) | 1385 '(bibtex-font-lock-keywords |
1386 nil t ((?_ . "w") (?- . "w") (?$ . "\"")))) | |
1389 (run-hooks 'bibtex-mode-hook)) | 1387 (run-hooks 'bibtex-mode-hook)) |
1390 | 1388 |
1391 (defun bibtex-entry (entry-type &optional required optional) | 1389 (defun bibtex-entry (entry-type &optional required optional) |
1392 "Inserts a new BibTeX entry. | 1390 "Inserts a new BibTeX entry. |
1393 Calls the value of bibtex-add-entry-hook if that value is non-nil." | 1391 Calls the value of bibtex-add-entry-hook if that value is non-nil." |