(fortran-mode-syntax-table): Change `;' to punctuation now it's not
authorGlenn Morris <rgm@gnu.org>
Sat, 26 Apr 2008 02:33:47 +0000 (02:33 +0000)
committerGlenn Morris <rgm@gnu.org>
Sat, 26 Apr 2008 02:33:47 +0000 (02:33 +0000)
needed for abbrevs.
(fortran-mode-abbrev-table): Remove defvar, make use of new
define-abbrev-table :regexp feature.

lisp/progmodes/fortran.el

index fdd8ff7..1eda125 100644 (file)
@@ -560,9 +560,9 @@ Used in the Fortran entry in `hs-special-modes-alist'.")
 \f
 (defvar fortran-mode-syntax-table
   (let ((table (make-syntax-table)))
-    ;; We might like `;' to be punctuation (g77 multi-statement
-    ;; lines), but that screws abbrevs.
-    (modify-syntax-entry ?\; "w"  table)
+    ;; Was a word-constituent (for abbrevs), now punctuation (g77
+    ;; multi-statement lines).
+    (modify-syntax-entry ?\; "."  table)
     (modify-syntax-entry ?\r " "  table)
     (modify-syntax-entry ?+  "."  table)
     (modify-syntax-entry ?-  "."  table)
@@ -670,78 +670,69 @@ Used in the Fortran entry in `hs-special-modes-alist'.")
   "Keymap used in Fortran mode.")
 
 \f
-(defvar fortran-mode-abbrev-table
-  (progn
-    (define-abbrev-table 'fortran-mode-abbrev-table nil)
-    fortran-mode-abbrev-table)
-  "Abbrev table for Fortran mode.")
-
-;; Not in defvar because user abbrevs may be restored before this file loads.
-(mapc
- (lambda (e)
-   (condition-case nil
-       (define-abbrev fortran-mode-abbrev-table (car e) (cdr e) nil :count 0
-         :system t)
-     (wrong-number-of-arguments         ; Emacs 22
-      (define-abbrev fortran-mode-abbrev-table (car e) (cdr e) nil 0 t))))
-   '((";au"   . "automatic"         )
-     (";b"    . "byte"              )
-     (";bd"   . "block data"        )
-     (";ch"   . "character"         )
-     (";cl"   . "close"             )
-     (";c"    . "continue"          )
-     (";cm"   . "common"            )
-     (";cx"   . "complex"           )
-     (";df"   . "define"            )
-     (";di"   . "dimension"         )
-     (";do"   . "double"            )
-     (";dc"   . "double complex"    )
-     (";dp"   . "double precision"  )
-     (";dw"   . "do while"          )
-     (";e"    . "else"              )
-     (";ed"   . "enddo"             )
-     (";el"   . "elseif"            )
-     (";en"   . "endif"             )
-     (";eq"   . "equivalence"       )
-     (";ew"   . "endwhere"          )
-     (";ex"   . "external"          )
-     (";ey"   . "entry"             )
-     (";f"    . "format"            )
-     (";fa"   . ".false."           )
-     (";fu"   . "function"          )
-     (";g"    . "goto"              )
-     (";im"   . "implicit"          )
-     (";ib"   . "implicit byte"     )
-     (";ic"   . "implicit complex"  )
-     (";ich"  . "implicit character")
-     (";ii"   . "implicit integer"  )
-     (";il"   . "implicit logical"  )
-     (";ir"   . "implicit real"     )
-     (";inc"  . "include"           )
-     (";in"   . "integer"           )
-     (";intr" . "intrinsic"         )
-     (";l"    . "logical"           )
-     (";n"    . "namelist"          )
-     (";o"    . "open"              )     ; was ;op
-     (";pa"   . "parameter"         )
-     (";pr"   . "program"           )
-     (";ps"   . "pause"             )
-     (";p"    . "print"             )
-     (";rc"   . "record"            )
-     (";re"   . "real"              )
-     (";r"    . "read"              )
-     (";rt"   . "return"            )
-     (";rw"   . "rewind"            )
-     (";s"    . "stop"              )
-     (";sa"   . "save"              )
-     (";st"   . "structure"         )
-     (";sc"   . "static"            )
-     (";su"   . "subroutine"        )
-     (";tr"   . ".true."            )
-     (";ty"   . "type"              )
-     (";vo"   . "volatile"          )
-     (";w"    . "write"             )
-     (";wh"   . "where"             )))
+(define-abbrev-table 'fortran-mode-abbrev-table
+  (mapcar (lambda (e) (list (car e) (cdr e) nil :system t))
+          '((";au"   . "automatic"         )
+            (";b"    . "byte"              )
+            (";bd"   . "block data"        )
+            (";ch"   . "character"         )
+            (";cl"   . "close"             )
+            (";c"    . "continue"          )
+            (";cm"   . "common"            )
+            (";cx"   . "complex"           )
+            (";df"   . "define"            )
+            (";di"   . "dimension"         )
+            (";do"   . "double"            )
+            (";dc"   . "double complex"    )
+            (";dp"   . "double precision"  )
+            (";dw"   . "do while"          )
+            (";e"    . "else"              )
+            (";ed"   . "enddo"             )
+            (";el"   . "elseif"            )
+            (";en"   . "endif"             )
+            (";eq"   . "equivalence"       )
+            (";ew"   . "endwhere"          )
+            (";ex"   . "external"          )
+            (";ey"   . "entry"             )
+            (";f"    . "format"            )
+            (";fa"   . ".false."           )
+            (";fu"   . "function"          )
+            (";g"    . "goto"              )
+            (";im"   . "implicit"          )
+            (";ib"   . "implicit byte"     )
+            (";ic"   . "implicit complex"  )
+            (";ich"  . "implicit character")
+            (";ii"   . "implicit integer"  )
+            (";il"   . "implicit logical"  )
+            (";ir"   . "implicit real"     )
+            (";inc"  . "include"           )
+            (";in"   . "integer"           )
+            (";intr" . "intrinsic"         )
+            (";l"    . "logical"           )
+            (";n"    . "namelist"          )
+            (";o"    . "open"              ) ; was ;op
+            (";pa"   . "parameter"         )
+            (";pr"   . "program"           )
+            (";ps"   . "pause"             )
+            (";p"    . "print"             )
+            (";rc"   . "record"            )
+            (";re"   . "real"              )
+            (";r"    . "read"              )
+            (";rt"   . "return"            )
+            (";rw"   . "rewind"            )
+            (";s"    . "stop"              )
+            (";sa"   . "save"              )
+            (";st"   . "structure"         )
+            (";sc"   . "static"            )
+            (";su"   . "subroutine"        )
+            (";tr"   . ".true."            )
+            (";ty"   . "type"              )
+            (";vo"   . "volatile"          )
+            (";w"    . "write"             )
+            (";wh"   . "where"             )))
+  "Abbrev table for Fortran mode."
+  ;; Accept ; as the first char of an abbrev.  Also allow _ in abbrevs.
+  :regexp "\\(?:[^[:word:]_;]\\|^\\)\\(;?[[:word:]_]+\\)[^[:word:]_]*")
 
 \f
 ;;;###autoload