changeset 94357:5f0e2d26daed

(fortran-mode-syntax-table): Change `;' to punctuation now it's not needed for abbrevs. (fortran-mode-abbrev-table): Remove defvar, make use of new define-abbrev-table :regexp feature.
author Glenn Morris <rgm@gnu.org>
date Sat, 26 Apr 2008 02:33:47 +0000
parents 4b4c0c613ce9
children f1e8d30ecf61
files lisp/progmodes/fortran.el
diffstat 1 files changed, 66 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/fortran.el	Sat Apr 26 02:33:08 2008 +0000
+++ b/lisp/progmodes/fortran.el	Sat Apr 26 02:33:47 2008 +0000
@@ -560,9 +560,9 @@
 
 (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 @@
   "Keymap used in Fortran mode.")
 
 
-(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:]_]*")
 
 
 ;;;###autoload