changeset 39896:258ac90a4fed

Use define-derived-mode.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 13 Oct 2001 19:22:43 +0000
parents 9c794d6eeb76
children 3e6f2f2a0a62
files lisp/textmodes/bib-mode.el
diffstat 1 files changed, 27 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/bib-mode.el	Sat Oct 13 19:19:01 2001 +0000
+++ b/lisp/textmodes/bib-mode.el	Sat Oct 13 19:22:43 2001 +0000
@@ -51,8 +51,6 @@
 (define-key bib-mode-map "\C-c\C-u" 'unread-bib)
 (define-key bib-mode-map "\C-c\C-@" 'mark-bib)
 (define-key bib-mode-map "\e`" 'abbrev-mode)
-(defvar bib-mode-abbrev-table nil
-   "Abbrev table used in Bib mode")
 
 (defun addbib ()
    "Set up editor to add to troff bibliography file specified 
@@ -63,7 +61,7 @@
    (bib-mode)
    )
    
-(defun bib-mode ()
+(define-derived-mode bib-mode text-mode "Bib"
    "Mode for editing `lookbib' style bibliographies.  
 Hit RETURN to get next % field key.
 If you want to ignore this field, just hit RETURN again.
@@ -94,45 +92,33 @@
 Field keys given by variable `bib-assoc'.
 
 Commands:
-\\{bib-mode-map}
-"
-   (interactive)
-   (text-mode)
-   (use-local-map bib-mode-map)
-   (setq mode-name "Bib")
-   (setq major-mode 'bib-mode)
-   (define-abbrev-table 'bib-mode-abbrev-table ())
-   (setq local-abbrev-table bib-mode-abbrev-table)
-   (abbrev-mode 1)
-   (run-hooks 'bib-mode-hook)
-   )
+\\{bib-mode-map}"
+   (abbrev-mode 1))
 
-(defconst bib-assoc '(
-		   (" *$" . "%A ")
-		   ("%A ." . "%A ")
-		   ("%A $" . "%T ")
-		   ("%T " . "%D ")
-		   ("%D " . "%J ")
-		   ("%J ." . "%V ")
-		   ("%V " . "%N ")
-		   ("%N " . "%P ")
-		   ("%P " . "%K ")
-		   ("%K " . "%W ")
-		   ("%W " . "%X ")
-		   ("%X " . "")
-		   ("%J $" . "%B ")
-		   ("%B ." . "%E ")
-		   ("%E ." . "%E ")
-		   ("%E $" . "%I ")
-		   ("%I " . "%C ")
-		   ("%C " . "%P ")
-		   ("%B $" . "%R ")
-		   ("%R " . "%I ")
-		   )
-		   
-"Describes bibliographic database format.  A line beginning with
-the car of an entry is followed by one beginning with the cdr.
-")
+(defconst bib-assoc
+  '((" *$" . "%A ")
+    ("%A ." . "%A ")
+    ("%A $" . "%T ")
+    ("%T " . "%D ")
+    ("%D " . "%J ")
+    ("%J ." . "%V ")
+    ("%V " . "%N ")
+    ("%N " . "%P ")
+    ("%P " . "%K ")
+    ("%K " . "%W ")
+    ("%W " . "%X ")
+    ("%X " . "")
+    ("%J $" . "%B ")
+    ("%B ." . "%E ")
+    ("%E ." . "%E ")
+    ("%E $" . "%I ")
+    ("%I " . "%C ")
+    ("%C " . "%P ")
+    ("%B $" . "%R ")
+    ("%R " . "%I "))
+  "Describes bibliographic database format.
+A line beginning with the car of an entry is followed by one beginning
+with the cdr.")
 
 (defun bib-find-key (slots)
    (cond