aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-10-22 07:49:16 +0000
committerGlenn Morris2007-10-22 07:49:16 +0000
commit640f9e264aaa0046d89bb495f22d6bdce29f74f9 (patch)
treec530dcc9e74facfe2b6fdc29ecf24d7b54cb5de6
parentd4654cff7416cc4c134bcc17bd55d0e7908948d0 (diff)
downloademacs-640f9e264aaa0046d89bb495f22d6bdce29f74f9.tar.gz
emacs-640f9e264aaa0046d89bb495f22d6bdce29f74f9.zip
Untabify.
-rw-r--r--lisp/progmodes/f90.el388
1 files changed, 194 insertions, 194 deletions
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index c9edb24f192..ec64d936317 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -105,7 +105,7 @@
105;; (f90-add-imenu-menu) ; extra menu with functions etc. 105;; (f90-add-imenu-menu) ; extra menu with functions etc.
106;; (if f90-auto-keyword-case ; change case of all keywords on startup 106;; (if f90-auto-keyword-case ; change case of all keywords on startup
107;; (f90-change-keywords f90-auto-keyword-case)) 107;; (f90-change-keywords f90-auto-keyword-case))
108;; )) 108;; ))
109;; 109;;
110;; in your .emacs file. You can also customize the lists 110;; in your .emacs file. You can also customize the lists
111;; f90-font-lock-keywords, etc. 111;; f90-font-lock-keywords, etc.
@@ -263,20 +263,20 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
263 263
264(defconst f90-keywords-re 264(defconst f90-keywords-re
265 (regexp-opt '("allocatable" "allocate" "assign" "assignment" "backspace" 265 (regexp-opt '("allocatable" "allocate" "assign" "assignment" "backspace"
266 "block" "call" "case" "character" "close" "common" "complex" 266 "block" "call" "case" "character" "close" "common" "complex"
267 "contains" "continue" "cycle" "data" "deallocate" 267 "contains" "continue" "cycle" "data" "deallocate"
268 "dimension" "do" "double" "else" "elseif" "elsewhere" "end" 268 "dimension" "do" "double" "else" "elseif" "elsewhere" "end"
269 "enddo" "endfile" "endif" "entry" "equivalence" "exit" 269 "enddo" "endfile" "endif" "entry" "equivalence" "exit"
270 "external" "forall" "format" "function" "goto" "if" 270 "external" "forall" "format" "function" "goto" "if"
271 "implicit" "include" "inquire" "integer" "intent" 271 "implicit" "include" "inquire" "integer" "intent"
272 "interface" "intrinsic" "logical" "module" "namelist" "none" 272 "interface" "intrinsic" "logical" "module" "namelist" "none"
273 "nullify" "only" "open" "operator" "optional" "parameter" 273 "nullify" "only" "open" "operator" "optional" "parameter"
274 "pause" "pointer" "precision" "print" "private" "procedure" 274 "pause" "pointer" "precision" "print" "private" "procedure"
275 "program" "public" "read" "real" "recursive" "result" "return" 275 "program" "public" "read" "real" "recursive" "result" "return"
276 "rewind" "save" "select" "sequence" "stop" "subroutine" 276 "rewind" "save" "select" "sequence" "stop" "subroutine"
277 "target" "then" "type" "use" "where" "while" "write" 277 "target" "then" "type" "use" "where" "while" "write"
278 ;; F95 keywords. 278 ;; F95 keywords.
279 "elemental" "pure") 'words) 279 "elemental" "pure") 'words)
280 "Regexp used by the function `f90-change-keywords'.") 280 "Regexp used by the function `f90-change-keywords'.")
281 281
282(defconst f90-keywords-level-3-re 282(defconst f90-keywords-level-3-re
@@ -405,7 +405,7 @@ do\\([ \t]*while\\)?\\|select[ \t]*case\\|where\\|forall\\)\\)\\>"
405 f90-keywords-level-3-re 405 f90-keywords-level-3-re
406 f90-operators-re 406 f90-operators-re
407 (list f90-procedures-re '(1 font-lock-keyword-face keep)) 407 (list f90-procedures-re '(1 font-lock-keyword-face keep))
408 "\\<real\\>" ; avoid overwriting real defs 408 "\\<real\\>" ; avoid overwriting real defs
409 )) 409 ))
410 "Highlights all F90 keywords and intrinsic procedures.") 410 "Highlights all F90 keywords and intrinsic procedures.")
411 411
@@ -639,7 +639,7 @@ Used in the F90 entry in `hs-special-modes-alist'.")
639;; Imenu support. 639;; Imenu support.
640(defvar f90-imenu-generic-expression 640(defvar f90-imenu-generic-expression
641 (let ((good-char "[^!\"\&\n \t]") (not-e "[^e!\n\"\& \t]") 641 (let ((good-char "[^!\"\&\n \t]") (not-e "[^e!\n\"\& \t]")
642 (not-n "[^n!\n\"\& \t]") (not-d "[^d!\n\"\& \t]")) 642 (not-n "[^n!\n\"\& \t]") (not-d "[^d!\n\"\& \t]"))
643 (list 643 (list
644 '(nil "^[ \t0-9]*program[ \t]+\\(\\sw+\\)" 1) 644 '(nil "^[ \t0-9]*program[ \t]+\\(\\sw+\\)" 1)
645 '("Modules" "^[ \t0-9]*module[ \t]+\\(\\sw+\\)[ \t]*\\(!\\|$\\)" 1) 645 '("Modules" "^[ \t0-9]*module[ \t]+\\(\\sw+\\)[ \t]*\\(!\\|$\\)" 1)
@@ -843,9 +843,9 @@ with no args, if that value is non-nil."
843Checks from `point-min', or `f90-cache-position', if that is non-nil 843Checks from `point-min', or `f90-cache-position', if that is non-nil
844and lies before point." 844and lies before point."
845 (let ((beg-pnt 845 (let ((beg-pnt
846 (if (and f90-cache-position (> (point) f90-cache-position)) 846 (if (and f90-cache-position (> (point) f90-cache-position))
847 f90-cache-position 847 f90-cache-position
848 (point-min)))) 848 (point-min))))
849 (nth 3 (parse-partial-sexp beg-pnt (point))))) 849 (nth 3 (parse-partial-sexp beg-pnt (point)))))
850 850
851(defsubst f90-in-comment () 851(defsubst f90-in-comment ()
@@ -853,9 +853,9 @@ and lies before point."
853Checks from `point-min', or `f90-cache-position', if that is non-nil 853Checks from `point-min', or `f90-cache-position', if that is non-nil
854and lies before point." 854and lies before point."
855 (let ((beg-pnt 855 (let ((beg-pnt
856 (if (and f90-cache-position (> (point) f90-cache-position)) 856 (if (and f90-cache-position (> (point) f90-cache-position))
857 f90-cache-position 857 f90-cache-position
858 (point-min)))) 858 (point-min))))
859 (nth 4 (parse-partial-sexp beg-pnt (point))))) 859 (nth 4 (parse-partial-sexp beg-pnt (point)))))
860 860
861(defsubst f90-line-continued () 861(defsubst f90-line-continued ()
@@ -973,10 +973,10 @@ NAME is non-nil only for type."
973 ((looking-at "\\(program\\)[ \t]+\\(\\sw+\\)\\>") 973 ((looking-at "\\(program\\)[ \t]+\\(\\sw+\\)\\>")
974 (list (match-string 1) (match-string 2))) 974 (list (match-string 1) (match-string 2)))
975 ((and (not (looking-at "module[ \t]*procedure\\>")) 975 ((and (not (looking-at "module[ \t]*procedure\\>"))
976 (looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>")) 976 (looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>"))
977 (list (match-string 1) (match-string 2))) 977 (list (match-string 1) (match-string 2)))
978 ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)")) 978 ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)"))
979 (looking-at "[^!'\"\&\n]*\\(function\\|subroutine\\)[ \t]+\ 979 (looking-at "[^!'\"\&\n]*\\(function\\|subroutine\\)[ \t]+\
980\\(\\sw+\\)")) 980\\(\\sw+\\)"))
981 (list (match-string 1) (match-string 2))))) 981 (list (match-string 1) (match-string 2)))))
982;; Following will match an un-named main program block; however 982;; Following will match an un-named main program block; however
@@ -990,7 +990,7 @@ NAME is non-nil only for type."
990(defsubst f90-looking-at-program-block-end () 990(defsubst f90-looking-at-program-block-end ()
991 "Return (KIND NAME) if a block with name NAME ends after point." 991 "Return (KIND NAME) if a block with name NAME ends after point."
992 (if (looking-at (concat "end[ \t]*" f90-blocks-re 992 (if (looking-at (concat "end[ \t]*" f90-blocks-re
993 "?\\([ \t]+\\(\\sw+\\)\\)?\\>")) 993 "?\\([ \t]+\\(\\sw+\\)\\)?\\>"))
994 (list (match-string 1) (match-string 3)))) 994 (list (match-string 1) (match-string 3))))
995 995
996(defsubst f90-comment-indent () 996(defsubst f90-comment-indent ()
@@ -1000,16 +1000,16 @@ Used for `comment-indent-function' by F90 mode.
1000`f90-indented-comment-re' (if not trailing code) calls `f90-calculate-indent'. 1000`f90-indented-comment-re' (if not trailing code) calls `f90-calculate-indent'.
1001All others return `comment-column', leaving at least one space after code." 1001All others return `comment-column', leaving at least one space after code."
1002 (cond ((looking-at "!!!") 0) 1002 (cond ((looking-at "!!!") 0)
1003 ((and f90-directive-comment-re 1003 ((and f90-directive-comment-re
1004 (looking-at f90-directive-comment-re)) 0) 1004 (looking-at f90-directive-comment-re)) 0)
1005 ((looking-at (regexp-quote f90-comment-region)) 0) 1005 ((looking-at (regexp-quote f90-comment-region)) 0)
1006 ((and (looking-at f90-indented-comment-re) 1006 ((and (looking-at f90-indented-comment-re)
1007 ;; Don't attempt to indent trailing comment as code. 1007 ;; Don't attempt to indent trailing comment as code.
1008 (save-excursion 1008 (save-excursion
1009 (skip-chars-backward " \t") 1009 (skip-chars-backward " \t")
1010 (bolp))) 1010 (bolp)))
1011 (f90-calculate-indent)) 1011 (f90-calculate-indent))
1012 (t (save-excursion 1012 (t (save-excursion
1013 (skip-chars-backward " \t") 1013 (skip-chars-backward " \t")
1014 (max (if (bolp) 0 (1+ (current-column))) comment-column))))) 1014 (max (if (bolp) 0 (1+ (current-column))) comment-column)))))
1015 1015
@@ -1026,10 +1026,10 @@ Comment lines embedded amongst continued lines return 'middle."
1026 (setq pcont (if (f90-previous-statement) (f90-line-continued)))) 1026 (setq pcont (if (f90-previous-statement) (f90-line-continued))))
1027 (setq cont (f90-line-continued)) 1027 (setq cont (f90-line-continued))
1028 (cond ((and (not pcont) (not cont)) 'single) 1028 (cond ((and (not pcont) (not cont)) 'single)
1029 ((and (not pcont) cont) 'begin) 1029 ((and (not pcont) cont) 'begin)
1030 ((and pcont (not cont)) 'end) 1030 ((and pcont (not cont)) 'end)
1031 ((and pcont cont) 'middle) 1031 ((and pcont cont) 'middle)
1032 (t (error "The impossible occurred"))))) 1032 (t (error "The impossible occurred")))))
1033 1033
1034(defsubst f90-indent-line-no () 1034(defsubst f90-indent-line-no ()
1035 "If `f90-leave-line-no' is nil, left-justify a line number. 1035 "If `f90-leave-line-no' is nil, left-justify a line number.
@@ -1074,10 +1074,10 @@ Does not check type and subprogram indentation."
1074 (let ((epnt (line-end-position)) icol cont) 1074 (let ((epnt (line-end-position)) icol cont)
1075 (save-excursion 1075 (save-excursion
1076 (while (and (f90-previous-statement) 1076 (while (and (f90-previous-statement)
1077 (or (progn 1077 (or (progn
1078 (setq cont (f90-present-statement-cont)) 1078 (setq cont (f90-present-statement-cont))
1079 (or (eq cont 'end) (eq cont 'middle))) 1079 (or (eq cont 'end) (eq cont 'middle)))
1080 (looking-at "[ \t]*[0-9]")))) 1080 (looking-at "[ \t]*[0-9]"))))
1081 (setq icol (current-indentation)) 1081 (setq icol (current-indentation))
1082 (beginning-of-line) 1082 (beginning-of-line)
1083 (when (re-search-forward "\\(if\\|do\\|select\\|where\\|forall\\)" 1083 (when (re-search-forward "\\(if\\|do\\|select\\|where\\|forall\\)"
@@ -1092,10 +1092,10 @@ Does not check type and subprogram indentation."
1092 (setq icol (+ icol f90-if-indent)))) 1092 (setq icol (+ icol f90-if-indent))))
1093 (end-of-line)) 1093 (end-of-line))
1094 (while (re-search-forward 1094 (while (re-search-forward
1095 "\\(if\\|do\\|select\\|where\\|forall\\)" epnt t) 1095 "\\(if\\|do\\|select\\|where\\|forall\\)" epnt t)
1096 (beginning-of-line) 1096 (beginning-of-line)
1097 (skip-chars-forward " \t0-9") 1097 (skip-chars-forward " \t0-9")
1098 (cond ((f90-looking-at-do) 1098 (cond ((f90-looking-at-do)
1099 (setq icol (+ icol f90-do-indent))) 1099 (setq icol (+ icol f90-do-indent)))
1100 ((or (f90-looking-at-if-then) 1100 ((or (f90-looking-at-if-then)
1101 (f90-looking-at-where-or-forall) 1101 (f90-looking-at-where-or-forall)
@@ -1105,7 +1105,7 @@ Does not check type and subprogram indentation."
1105 (setq icol (- icol f90-if-indent))) 1105 (setq icol (- icol f90-if-indent)))
1106 ((looking-at "end[ \t]*do\\>") 1106 ((looking-at "end[ \t]*do\\>")
1107 (setq icol (- icol f90-do-indent)))) 1107 (setq icol (- icol f90-do-indent))))
1108 (end-of-line)) 1108 (end-of-line))
1109 icol))) 1109 icol)))
1110 1110
1111(defun f90-calculate-indent () 1111(defun f90-calculate-indent ()
@@ -1116,7 +1116,7 @@ Does not check type and subprogram indentation."
1116 (if (not (f90-previous-statement)) 1116 (if (not (f90-previous-statement))
1117 ;; If f90-previous-statement returns nil, we must have been 1117 ;; If f90-previous-statement returns nil, we must have been
1118 ;; called from on or before the first line of the first statement. 1118 ;; called from on or before the first line of the first statement.
1119 (setq icol (if (save-excursion 1119 (setq icol (if (save-excursion
1120 ;; f90-previous-statement has moved us over 1120 ;; f90-previous-statement has moved us over
1121 ;; comment/blank lines, so we need to get 1121 ;; comment/blank lines, so we need to get
1122 ;; back to the first code statement. 1122 ;; back to the first code statement.
@@ -1127,48 +1127,48 @@ Does not check type and subprogram indentation."
1127 0 1127 0
1128 ;; No explicit PROGRAM start statement. 1128 ;; No explicit PROGRAM start statement.
1129 f90-program-indent)) 1129 f90-program-indent))
1130 (setq cont (f90-present-statement-cont)) 1130 (setq cont (f90-present-statement-cont))
1131 (if (eq cont 'end) 1131 (if (eq cont 'end)
1132 (while (not (eq 'begin (f90-present-statement-cont))) 1132 (while (not (eq 'begin (f90-present-statement-cont)))
1133 (f90-previous-statement))) 1133 (f90-previous-statement)))
1134 (cond ((eq cont 'begin) 1134 (cond ((eq cont 'begin)
1135 (setq icol (+ (f90-current-indentation) 1135 (setq icol (+ (f90-current-indentation)
1136 f90-continuation-indent))) 1136 f90-continuation-indent)))
1137 ((eq cont 'middle) (setq icol (current-indentation))) 1137 ((eq cont 'middle) (setq icol (current-indentation)))
1138 (t (setq icol (f90-current-indentation)) 1138 (t (setq icol (f90-current-indentation))
1139 (skip-chars-forward " \t") 1139 (skip-chars-forward " \t")
1140 (if (looking-at "[0-9]") 1140 (if (looking-at "[0-9]")
1141 (setq icol (f90-get-correct-indent)) 1141 (setq icol (f90-get-correct-indent))
1142 (cond ((or (f90-looking-at-if-then) 1142 (cond ((or (f90-looking-at-if-then)
1143 (f90-looking-at-where-or-forall) 1143 (f90-looking-at-where-or-forall)
1144 (f90-looking-at-select-case) 1144 (f90-looking-at-select-case)
1145 (looking-at f90-else-like-re)) 1145 (looking-at f90-else-like-re))
1146 (setq icol (+ icol f90-if-indent))) 1146 (setq icol (+ icol f90-if-indent)))
1147 ((f90-looking-at-do) 1147 ((f90-looking-at-do)
1148 (setq icol (+ icol f90-do-indent))) 1148 (setq icol (+ icol f90-do-indent)))
1149 ((f90-looking-at-type-like) 1149 ((f90-looking-at-type-like)
1150 (setq icol (+ icol f90-type-indent))) 1150 (setq icol (+ icol f90-type-indent)))
1151 ((or (f90-looking-at-program-block-start) 1151 ((or (f90-looking-at-program-block-start)
1152 (looking-at "contains[ \t]*\\($\\|!\\)")) 1152 (looking-at "contains[ \t]*\\($\\|!\\)"))
1153 (setq icol (+ icol f90-program-indent))))) 1153 (setq icol (+ icol f90-program-indent)))))
1154 (goto-char pnt) 1154 (goto-char pnt)
1155 (beginning-of-line) 1155 (beginning-of-line)
1156 (cond ((looking-at "[ \t]*$")) 1156 (cond ((looking-at "[ \t]*$"))
1157 ((looking-at "[ \t]*#") ; check for cpp directive 1157 ((looking-at "[ \t]*#") ; check for cpp directive
1158 (setq icol 0)) 1158 (setq icol 0))
1159 (t 1159 (t
1160 (skip-chars-forward " \t0-9") 1160 (skip-chars-forward " \t0-9")
1161 (cond ((or (looking-at f90-else-like-re) 1161 (cond ((or (looking-at f90-else-like-re)
1162 (looking-at f90-end-if-re)) 1162 (looking-at f90-end-if-re))
1163 (setq icol (- icol f90-if-indent))) 1163 (setq icol (- icol f90-if-indent)))
1164 ((looking-at "end[ \t]*do\\>") 1164 ((looking-at "end[ \t]*do\\>")
1165 (setq icol (- icol f90-do-indent))) 1165 (setq icol (- icol f90-do-indent)))
1166 ((looking-at f90-end-type-re) 1166 ((looking-at f90-end-type-re)
1167 (setq icol (- icol f90-type-indent))) 1167 (setq icol (- icol f90-type-indent)))
1168 ((or (looking-at "contains[ \t]*\\(!\\|$\\)") 1168 ((or (looking-at "contains[ \t]*\\(!\\|$\\)")
1169 (f90-looking-at-program-block-end)) 1169 (f90-looking-at-program-block-end))
1170 (setq icol (- icol f90-program-indent)))))) 1170 (setq icol (- icol f90-program-indent))))))
1171 )))) 1171 ))))
1172 icol)) 1172 icol))
1173 1173
1174(defun f90-previous-statement () 1174(defun f90-previous-statement ()
@@ -1181,7 +1181,7 @@ comment."
1181 (let (not-first-statement) 1181 (let (not-first-statement)
1182 (beginning-of-line) 1182 (beginning-of-line)
1183 (while (and (setq not-first-statement (zerop (forward-line -1))) 1183 (while (and (setq not-first-statement (zerop (forward-line -1)))
1184 (looking-at "[ \t0-9]*\\(!\\|$\\|#\\)"))) 1184 (looking-at "[ \t0-9]*\\(!\\|$\\|#\\)")))
1185 not-first-statement)) 1185 not-first-statement))
1186 1186
1187(defun f90-next-statement () 1187(defun f90-next-statement ()
@@ -1191,9 +1191,9 @@ Return nil if no later statement is found."
1191 (let (not-last-statement) 1191 (let (not-last-statement)
1192 (beginning-of-line) 1192 (beginning-of-line)
1193 (while (and (setq not-last-statement 1193 (while (and (setq not-last-statement
1194 (and (zerop (forward-line 1)) 1194 (and (zerop (forward-line 1))
1195 (not (eobp)))) 1195 (not (eobp))))
1196 (looking-at "[ \t0-9]*\\(!\\|$\\)"))) 1196 (looking-at "[ \t0-9]*\\(!\\|$\\)")))
1197 not-last-statement)) 1197 not-last-statement))
1198 1198
1199(defun f90-beginning-of-subprogram () 1199(defun f90-beginning-of-subprogram ()
@@ -1203,7 +1203,7 @@ Return (TYPE NAME), or nil if not found."
1203 (let ((count 1) (case-fold-search t) matching-beg) 1203 (let ((count 1) (case-fold-search t) matching-beg)
1204 (beginning-of-line) 1204 (beginning-of-line)
1205 (while (and (> count 0) 1205 (while (and (> count 0)
1206 (re-search-backward f90-program-block-re nil 'move)) 1206 (re-search-backward f90-program-block-re nil 'move))
1207 (beginning-of-line) 1207 (beginning-of-line)
1208 (skip-chars-forward " \t0-9") 1208 (skip-chars-forward " \t0-9")
1209 (cond ((setq matching-beg (f90-looking-at-program-block-start)) 1209 (cond ((setq matching-beg (f90-looking-at-program-block-start))
@@ -1212,7 +1212,7 @@ Return (TYPE NAME), or nil if not found."
1212 (setq count (1+ count))))) 1212 (setq count (1+ count)))))
1213 (beginning-of-line) 1213 (beginning-of-line)
1214 (if (zerop count) 1214 (if (zerop count)
1215 matching-beg 1215 matching-beg
1216 ;; Note this includes the case of an un-named main program, 1216 ;; Note this includes the case of an un-named main program,
1217 ;; in which case we go to (point-min). 1217 ;; in which case we go to (point-min).
1218 (message "No beginning found.") 1218 (message "No beginning found.")
@@ -1227,19 +1227,19 @@ Return (TYPE NAME), or nil if not found."
1227 matching-end) 1227 matching-end)
1228 (end-of-line) 1228 (end-of-line)
1229 (while (and (> count 0) 1229 (while (and (> count 0)
1230 (re-search-forward f90-program-block-re nil 'move)) 1230 (re-search-forward f90-program-block-re nil 'move))
1231 (beginning-of-line) 1231 (beginning-of-line)
1232 (skip-chars-forward " \t0-9") 1232 (skip-chars-forward " \t0-9")
1233 (cond ((f90-looking-at-program-block-start) 1233 (cond ((f90-looking-at-program-block-start)
1234 (setq count (1+ count))) 1234 (setq count (1+ count)))
1235 ((setq matching-end (f90-looking-at-program-block-end)) 1235 ((setq matching-end (f90-looking-at-program-block-end))
1236 (setq count (1- count)))) 1236 (setq count (1- count))))
1237 (end-of-line)) 1237 (end-of-line))
1238 ;; This means f90-end-of-subprogram followed by f90-start-of-subprogram 1238 ;; This means f90-end-of-subprogram followed by f90-start-of-subprogram
1239 ;; has a net non-zero effect, which seems odd. 1239 ;; has a net non-zero effect, which seems odd.
1240;;; (forward-line 1) 1240;;; (forward-line 1)
1241 (if (zerop count) 1241 (if (zerop count)
1242 matching-end 1242 matching-end
1243 (message "No end found.") 1243 (message "No end found.")
1244 nil))) 1244 nil)))
1245 1245
@@ -1408,13 +1408,13 @@ in the region, or, if already present, remove it."
1408 (goto-char beg-region) 1408 (goto-char beg-region)
1409 (beginning-of-line) 1409 (beginning-of-line)
1410 (if (looking-at (regexp-quote f90-comment-region)) 1410 (if (looking-at (regexp-quote f90-comment-region))
1411 (delete-region (point) (match-end 0)) 1411 (delete-region (point) (match-end 0))
1412 (insert f90-comment-region)) 1412 (insert f90-comment-region))
1413 (while (and (zerop (forward-line 1)) 1413 (while (and (zerop (forward-line 1))
1414 (< (point) end)) 1414 (< (point) end))
1415 (if (looking-at (regexp-quote f90-comment-region)) 1415 (if (looking-at (regexp-quote f90-comment-region))
1416 (delete-region (point) (match-end 0)) 1416 (delete-region (point) (match-end 0))
1417 (insert f90-comment-region))) 1417 (insert f90-comment-region)))
1418 (set-marker end nil))) 1418 (set-marker end nil)))
1419 1419
1420(defun f90-indent-line (&optional no-update) 1420(defun f90-indent-line (&optional no-update)
@@ -1432,7 +1432,7 @@ after indenting."
1432 (setq no-line-number t) 1432 (setq no-line-number t)
1433 (skip-chars-forward " \t")) 1433 (skip-chars-forward " \t"))
1434 (if (looking-at "!") 1434 (if (looking-at "!")
1435 (setq indent (f90-comment-indent)) 1435 (setq indent (f90-comment-indent))
1436 (and f90-smart-end (looking-at "end") 1436 (and f90-smart-end (looking-at "end")
1437 (f90-match-end)) 1437 (f90-match-end))
1438 (setq indent (f90-calculate-indent))) 1438 (setq indent (f90-calculate-indent)))
@@ -1457,7 +1457,7 @@ If run in the middle of a line, the line is not broken."
1457 (beginning-of-line) ; reindent where likely to be needed 1457 (beginning-of-line) ; reindent where likely to be needed
1458 (f90-indent-line) ; calls indent-line-no, update-line 1458 (f90-indent-line) ; calls indent-line-no, update-line
1459 (end-of-line) 1459 (end-of-line)
1460 (delete-horizontal-space) ; destroy trailing whitespace 1460 (delete-horizontal-space) ; destroy trailing whitespace
1461 (let ((string (f90-in-string)) 1461 (let ((string (f90-in-string))
1462 (cont (f90-line-continued))) 1462 (cont (f90-line-continued)))
1463 (and string (not cont) (insert "&")) 1463 (and string (not cont) (insert "&"))
@@ -1474,17 +1474,17 @@ If run in the middle of a line, the line is not broken."
1474 (let ((end-region-mark (copy-marker end-region)) 1474 (let ((end-region-mark (copy-marker end-region))
1475 (save-point (point-marker)) 1475 (save-point (point-marker))
1476 (case-fold-search t) 1476 (case-fold-search t)
1477 block-list ind-lev ind-curr ind-b cont struct beg-struct end-struct) 1477 block-list ind-lev ind-curr ind-b cont struct beg-struct end-struct)
1478 (goto-char beg-region) 1478 (goto-char beg-region)
1479 ;; First find a line which is not a continuation line or comment. 1479 ;; First find a line which is not a continuation line or comment.
1480 (beginning-of-line) 1480 (beginning-of-line)
1481 (while (and (looking-at "[ \t]*[0-9]*\\(!\\|#\\|[ \t]*$\\)") 1481 (while (and (looking-at "[ \t]*[0-9]*\\(!\\|#\\|[ \t]*$\\)")
1482 (progn (f90-indent-line 'no-update) 1482 (progn (f90-indent-line 'no-update)
1483 (zerop (forward-line 1))) 1483 (zerop (forward-line 1)))
1484 (< (point) end-region-mark))) 1484 (< (point) end-region-mark)))
1485 (setq cont (f90-present-statement-cont)) 1485 (setq cont (f90-present-statement-cont))
1486 (while (and (or (eq cont 'middle) (eq cont 'end)) 1486 (while (and (or (eq cont 'middle) (eq cont 'end))
1487 (f90-previous-statement)) 1487 (f90-previous-statement))
1488 (setq cont (f90-present-statement-cont))) 1488 (setq cont (f90-present-statement-cont)))
1489 ;; Process present line for beginning of block. 1489 ;; Process present line for beginning of block.
1490 (setq f90-cache-position (point)) 1490 (setq f90-cache-position (point))
@@ -1495,20 +1495,20 @@ If run in the middle of a line, the line is not broken."
1495 (skip-chars-forward " \t0-9") 1495 (skip-chars-forward " \t0-9")
1496 (setq struct nil 1496 (setq struct nil
1497 ind-b (cond ((setq struct (f90-looking-at-do)) f90-do-indent) 1497 ind-b (cond ((setq struct (f90-looking-at-do)) f90-do-indent)
1498 ((or (setq struct (f90-looking-at-if-then)) 1498 ((or (setq struct (f90-looking-at-if-then))
1499 (setq struct (f90-looking-at-select-case)) 1499 (setq struct (f90-looking-at-select-case))
1500 (setq struct (f90-looking-at-where-or-forall)) 1500 (setq struct (f90-looking-at-where-or-forall))
1501 (looking-at f90-else-like-re)) 1501 (looking-at f90-else-like-re))
1502 f90-if-indent) 1502 f90-if-indent)
1503 ((setq struct (f90-looking-at-type-like)) 1503 ((setq struct (f90-looking-at-type-like))
1504 f90-type-indent) 1504 f90-type-indent)
1505 ((or (setq struct (f90-looking-at-program-block-start)) 1505 ((or (setq struct (f90-looking-at-program-block-start))
1506 (looking-at "contains[ \t]*\\($\\|!\\)")) 1506 (looking-at "contains[ \t]*\\($\\|!\\)"))
1507 f90-program-indent))) 1507 f90-program-indent)))
1508 (if ind-b (setq ind-lev (+ ind-lev ind-b))) 1508 (if ind-b (setq ind-lev (+ ind-lev ind-b)))
1509 (if struct (setq block-list (cons struct block-list))) 1509 (if struct (setq block-list (cons struct block-list)))
1510 (while (and (f90-line-continued) (zerop (forward-line 1)) 1510 (while (and (f90-line-continued) (zerop (forward-line 1))
1511 (< (point) end-region-mark)) 1511 (< (point) end-region-mark))
1512 (if (looking-at "[ \t]*!") 1512 (if (looking-at "[ \t]*!")
1513 (f90-indent-to (f90-comment-indent)) 1513 (f90-indent-to (f90-comment-indent))
1514 (or (= (current-indentation) 1514 (or (= (current-indentation)
@@ -1520,47 +1520,47 @@ If run in the middle of a line, the line is not broken."
1520 (f90-indent-line-no) 1520 (f90-indent-line-no)
1521 (setq f90-cache-position (point)) 1521 (setq f90-cache-position (point))
1522 (cond ((looking-at "[ \t]*$") (setq ind-curr 0)) 1522 (cond ((looking-at "[ \t]*$") (setq ind-curr 0))
1523 ((looking-at "[ \t]*#") (setq ind-curr 0)) 1523 ((looking-at "[ \t]*#") (setq ind-curr 0))
1524 ((looking-at "!") (setq ind-curr (f90-comment-indent))) 1524 ((looking-at "!") (setq ind-curr (f90-comment-indent)))
1525 ((f90-no-block-limit) (setq ind-curr ind-lev)) 1525 ((f90-no-block-limit) (setq ind-curr ind-lev))
1526 ((looking-at f90-else-like-re) (setq ind-curr 1526 ((looking-at f90-else-like-re) (setq ind-curr
1527 (- ind-lev f90-if-indent))) 1527 (- ind-lev f90-if-indent)))
1528 ((looking-at "contains[ \t]*\\($\\|!\\)") 1528 ((looking-at "contains[ \t]*\\($\\|!\\)")
1529 (setq ind-curr (- ind-lev f90-program-indent))) 1529 (setq ind-curr (- ind-lev f90-program-indent)))
1530 ((setq ind-b 1530 ((setq ind-b
1531 (cond ((setq struct (f90-looking-at-do)) f90-do-indent) 1531 (cond ((setq struct (f90-looking-at-do)) f90-do-indent)
1532 ((or (setq struct (f90-looking-at-if-then)) 1532 ((or (setq struct (f90-looking-at-if-then))
1533 (setq struct (f90-looking-at-select-case)) 1533 (setq struct (f90-looking-at-select-case))
1534 (setq struct (f90-looking-at-where-or-forall))) 1534 (setq struct (f90-looking-at-where-or-forall)))
1535 f90-if-indent) 1535 f90-if-indent)
1536 ((setq struct (f90-looking-at-type-like)) 1536 ((setq struct (f90-looking-at-type-like))
1537 f90-type-indent) 1537 f90-type-indent)
1538 ((setq struct (f90-looking-at-program-block-start)) 1538 ((setq struct (f90-looking-at-program-block-start))
1539 f90-program-indent))) 1539 f90-program-indent)))
1540 (setq ind-curr ind-lev) 1540 (setq ind-curr ind-lev)
1541 (if ind-b (setq ind-lev (+ ind-lev ind-b))) 1541 (if ind-b (setq ind-lev (+ ind-lev ind-b)))
1542 (setq block-list (cons struct block-list))) 1542 (setq block-list (cons struct block-list)))
1543 ((setq end-struct (f90-looking-at-program-block-end)) 1543 ((setq end-struct (f90-looking-at-program-block-end))
1544 (setq beg-struct (car block-list) 1544 (setq beg-struct (car block-list)
1545 block-list (cdr block-list)) 1545 block-list (cdr block-list))
1546 (if f90-smart-end 1546 (if f90-smart-end
1547 (save-excursion 1547 (save-excursion
1548 (f90-block-match (car beg-struct) (car (cdr beg-struct)) 1548 (f90-block-match (car beg-struct) (car (cdr beg-struct))
1549 (car end-struct) (car (cdr end-struct))))) 1549 (car end-struct) (car (cdr end-struct)))))
1550 (setq ind-b 1550 (setq ind-b
1551 (cond ((looking-at f90-end-if-re) f90-if-indent) 1551 (cond ((looking-at f90-end-if-re) f90-if-indent)
1552 ((looking-at "end[ \t]*do\\>") f90-do-indent) 1552 ((looking-at "end[ \t]*do\\>") f90-do-indent)
1553 ((looking-at f90-end-type-re) f90-type-indent) 1553 ((looking-at f90-end-type-re) f90-type-indent)
1554 ((f90-looking-at-program-block-end) 1554 ((f90-looking-at-program-block-end)
1555 f90-program-indent))) 1555 f90-program-indent)))
1556 (if ind-b (setq ind-lev (- ind-lev ind-b))) 1556 (if ind-b (setq ind-lev (- ind-lev ind-b)))
1557 (setq ind-curr ind-lev)) 1557 (setq ind-curr ind-lev))
1558 (t (setq ind-curr ind-lev))) 1558 (t (setq ind-curr ind-lev)))
1559 ;; Do the indentation if necessary. 1559 ;; Do the indentation if necessary.
1560 (or (= ind-curr (current-column)) 1560 (or (= ind-curr (current-column))
1561 (f90-indent-to ind-curr)) 1561 (f90-indent-to ind-curr))
1562 (while (and (f90-line-continued) (zerop (forward-line 1)) 1562 (while (and (f90-line-continued) (zerop (forward-line 1))
1563 (< (point) end-region-mark)) 1563 (< (point) end-region-mark))
1564 (if (looking-at "[ \t]*!") 1564 (if (looking-at "[ \t]*!")
1565 (f90-indent-to (f90-comment-indent)) 1565 (f90-indent-to (f90-comment-indent))
1566 (or (= (current-indentation) 1566 (or (= (current-indentation)
@@ -1573,7 +1573,7 @@ If run in the middle of a line, the line is not broken."
1573 (set-marker end-region-mark nil) 1573 (set-marker end-region-mark nil)
1574 (set-marker save-point nil) 1574 (set-marker save-point nil)
1575 (if (fboundp 'zmacs-deactivate-region) 1575 (if (fboundp 'zmacs-deactivate-region)
1576 (zmacs-deactivate-region) 1576 (zmacs-deactivate-region)
1577 (deactivate-mark)))) 1577 (deactivate-mark))))
1578 1578
1579(defun f90-indent-subprogram () 1579(defun f90-indent-subprogram ()
@@ -1582,15 +1582,15 @@ If run in the middle of a line, the line is not broken."
1582 (save-excursion 1582 (save-excursion
1583 (let ((program (f90-mark-subprogram))) 1583 (let ((program (f90-mark-subprogram)))
1584 (if program 1584 (if program
1585 (progn 1585 (progn
1586 (message "Indenting %s %s..." 1586 (message "Indenting %s %s..."
1587 (car program) (car (cdr program))) 1587 (car program) (car (cdr program)))
1588 (indent-region (point) (mark) nil) 1588 (indent-region (point) (mark) nil)
1589 (message "Indenting %s %s...done" 1589 (message "Indenting %s %s...done"
1590 (car program) (car (cdr program)))) 1590 (car program) (car (cdr program))))
1591 (message "Indenting the whole file...") 1591 (message "Indenting the whole file...")
1592 (indent-region (point) (mark) nil) 1592 (indent-region (point) (mark) nil)
1593 (message "Indenting the whole file...done"))))) 1593 (message "Indenting the whole file...done")))))
1594 1594
1595(defun f90-break-line (&optional no-update) 1595(defun f90-break-line (&optional no-update)
1596 "Break line at point, insert continuation marker(s) and indent. 1596 "Break line at point, insert continuation marker(s) and indent.
@@ -1662,7 +1662,7 @@ Like `join-line', but handles F90 syntax."
1662 (interactive "*r") 1662 (interactive "*r")
1663 (let ((end-region-mark (copy-marker end-region)) 1663 (let ((end-region-mark (copy-marker end-region))
1664 (go-on t) 1664 (go-on t)
1665 f90-smart-end f90-auto-keyword-case auto-fill-function) 1665 f90-smart-end f90-auto-keyword-case auto-fill-function)
1666 (goto-char beg-region) 1666 (goto-char beg-region)
1667 (while go-on 1667 (while go-on
1668 ;; Join as much as possible. 1668 ;; Join as much as possible.
@@ -1673,17 +1673,17 @@ Like `join-line', but handles F90 syntax."
1673 (f90-join-lines 'forward)) 1673 (f90-join-lines 'forward))
1674 ;; Chop the line if necessary. 1674 ;; Chop the line if necessary.
1675 (while (> (save-excursion (end-of-line) (current-column)) 1675 (while (> (save-excursion (end-of-line) (current-column))
1676 fill-column) 1676 fill-column)
1677 (move-to-column fill-column) 1677 (move-to-column fill-column)
1678 (f90-find-breakpoint) 1678 (f90-find-breakpoint)
1679 (f90-break-line 'no-update)) 1679 (f90-break-line 'no-update))
1680 (setq go-on (and (< (point) end-region-mark) 1680 (setq go-on (and (< (point) end-region-mark)
1681 (zerop (forward-line 1))) 1681 (zerop (forward-line 1)))
1682 f90-cache-position (point))) 1682 f90-cache-position (point)))
1683 (setq f90-cache-position nil) 1683 (setq f90-cache-position nil)
1684 (set-marker end-region-mark nil) 1684 (set-marker end-region-mark nil)
1685 (if (fboundp 'zmacs-deactivate-region) 1685 (if (fboundp 'zmacs-deactivate-region)
1686 (zmacs-deactivate-region) 1686 (zmacs-deactivate-region)
1687 (deactivate-mark)))) 1687 (deactivate-mark))))
1688 1688
1689(defun f90-block-match (beg-block beg-name end-block end-name) 1689(defun f90-block-match (beg-block beg-name end-block end-name)
@@ -1728,9 +1728,9 @@ Leave point at the end of line."
1728 (interactive) 1728 (interactive)
1729 (let ((count 1) 1729 (let ((count 1)
1730 (top-of-window (window-start)) 1730 (top-of-window (window-start))
1731 (end-point (point)) 1731 (end-point (point))
1732 (case-fold-search t) 1732 (case-fold-search t)
1733 matching-beg beg-name end-name beg-block end-block end-struct) 1733 matching-beg beg-name end-name beg-block end-block end-struct)
1734 (when (save-excursion (beginning-of-line) (skip-chars-forward " \t0-9") 1734 (when (save-excursion (beginning-of-line) (skip-chars-forward " \t0-9")
1735 (setq end-struct (f90-looking-at-program-block-end))) 1735 (setq end-struct (f90-looking-at-program-block-end)))
1736 (setq end-block (car end-struct) 1736 (setq end-block (car end-struct)
@@ -1797,12 +1797,12 @@ Any other key combination is executed normally."
1797 (if (fboundp 'next-command-event) ; XEmacs 1797 (if (fboundp 'next-command-event) ; XEmacs
1798 (setq event (next-command-event) 1798 (setq event (next-command-event)
1799 char (and (fboundp 'event-to-character) 1799 char (and (fboundp 'event-to-character)
1800 (event-to-character event))) 1800 (event-to-character event)))
1801 (setq event (read-event) 1801 (setq event (read-event)
1802 char event)) 1802 char event))
1803 ;; Insert char if not equal to `?', or if abbrev-mode is off. 1803 ;; Insert char if not equal to `?', or if abbrev-mode is off.
1804 (if (and abbrev-mode (or (eq char ??) (eq char help-char))) 1804 (if (and abbrev-mode (or (eq char ??) (eq char help-char)))
1805 (f90-abbrev-help) 1805 (f90-abbrev-help)
1806 (setq unread-command-events (list event))))) 1806 (setq unread-command-events (list event)))))
1807 1807
1808(defun f90-abbrev-help () 1808(defun f90-abbrev-help ()
@@ -1861,16 +1861,16 @@ CHANGE-WORD should be one of 'upcase-word, 'downcase-word, 'capitalize-word."
1861 (setq beg (or beg (point-min)) 1861 (setq beg (or beg (point-min))
1862 end (or end (point-max))) 1862 end (or end (point-max)))
1863 (let ((keyword-re 1863 (let ((keyword-re
1864 (concat "\\(" 1864 (concat "\\("
1865 f90-keywords-re "\\|" f90-procedures-re "\\|" 1865 f90-keywords-re "\\|" f90-procedures-re "\\|"
1866 f90-hpf-keywords-re "\\|" f90-operators-re "\\)")) 1866 f90-hpf-keywords-re "\\|" f90-operators-re "\\)"))
1867 (ref-point (point-min)) 1867 (ref-point (point-min))
1868 (modified (buffer-modified-p)) 1868 (modified (buffer-modified-p))
1869 state saveword back-point) 1869 state saveword back-point)
1870 (goto-char beg) 1870 (goto-char beg)
1871 (unwind-protect 1871 (unwind-protect
1872 (while (re-search-forward keyword-re end t) 1872 (while (re-search-forward keyword-re end t)
1873 (unless (progn 1873 (unless (progn
1874 (setq state (parse-partial-sexp ref-point (point))) 1874 (setq state (parse-partial-sexp ref-point (point)))
1875 (or (nth 3 state) (nth 4 state) 1875 (or (nth 3 state) (nth 4 state)
1876 ;; GM f90-directive-comment-re? 1876 ;; GM f90-directive-comment-re?
@@ -1878,13 +1878,13 @@ CHANGE-WORD should be one of 'upcase-word, 'downcase-word, 'capitalize-word."
1878 (beginning-of-line) 1878 (beginning-of-line)
1879 (skip-chars-forward " \t0-9") 1879 (skip-chars-forward " \t0-9")
1880 (looking-at "#")))) 1880 (looking-at "#"))))
1881 (setq ref-point (point) 1881 (setq ref-point (point)
1882 back-point (save-excursion (backward-word 1) (point)) 1882 back-point (save-excursion (backward-word 1) (point))
1883 saveword (buffer-substring back-point ref-point)) 1883 saveword (buffer-substring back-point ref-point))
1884 (funcall change-word -1) 1884 (funcall change-word -1)
1885 (or (string= saveword (buffer-substring back-point ref-point)) 1885 (or (string= saveword (buffer-substring back-point ref-point))
1886 (setq modified t)))) 1886 (setq modified t))))
1887 (or modified (set-buffer-modified-p nil)))))) 1887 (or modified (set-buffer-modified-p nil))))))
1888 1888
1889 1889
1890(defun f90-current-defun () 1890(defun f90-current-defun ()