diff options
| author | Glenn Morris | 2007-10-23 07:02:42 +0000 |
|---|---|---|
| committer | Glenn Morris | 2007-10-23 07:02:42 +0000 |
| commit | 9d23c92525fc5d945650f0790a6becbbf84f4cfe (patch) | |
| tree | 0700fd05ac63b78fc54bd6a7c7938a1313908f6a | |
| parent | b2752d937bd1ab6469df53618d657b8974581e37 (diff) | |
| download | emacs-9d23c92525fc5d945650f0790a6becbbf84f4cfe.tar.gz emacs-9d23c92525fc5d945650f0790a6becbbf84f4cfe.zip | |
Untabify.
| -rw-r--r-- | lisp/progmodes/fortran.el | 948 |
1 files changed, 474 insertions, 474 deletions
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index fe3f39c7e18..5ec6e5d92fe 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el | |||
| @@ -553,7 +553,7 @@ tries to strike a compromise between complexity and flexibility. | |||
| 553 | Used in the Fortran entry in `hs-special-modes-alist'.") | 553 | Used in the Fortran entry in `hs-special-modes-alist'.") |
| 554 | 554 | ||
| 555 | (add-to-list 'hs-special-modes-alist | 555 | (add-to-list 'hs-special-modes-alist |
| 556 | `(fortran-mode ,fortran-start-block-re ,fortran-end-block-re | 556 | `(fortran-mode ,fortran-start-block-re ,fortran-end-block-re |
| 557 | "^[cC*!]" fortran-end-of-block nil)) | 557 | "^[cC*!]" fortran-end-of-block nil)) |
| 558 | 558 | ||
| 559 | 559 | ||
| @@ -783,7 +783,7 @@ Variables controlling indentation style and extra features: | |||
| 783 | `fortran-minimum-statement-indent-tab' (TAB format), | 783 | `fortran-minimum-statement-indent-tab' (TAB format), |
| 784 | depending on the continuation format in use. | 784 | depending on the continuation format in use. |
| 785 | relative indent to `fortran-comment-line-extra-indent' beyond the | 785 | relative indent to `fortran-comment-line-extra-indent' beyond the |
| 786 | indentation for a line of code. | 786 | indentation for a line of code. |
| 787 | (default 'fixed) | 787 | (default 'fixed) |
| 788 | `fortran-comment-indent-char' | 788 | `fortran-comment-indent-char' |
| 789 | Single-character string to be inserted instead of space for | 789 | Single-character string to be inserted instead of space for |
| @@ -926,33 +926,33 @@ or on a new line inserted before this line if this line is not blank." | |||
| 926 | (beginning-of-line) | 926 | (beginning-of-line) |
| 927 | ;; Recognize existing comments of either kind. | 927 | ;; Recognize existing comments of either kind. |
| 928 | (cond ((fortran-find-comment-start-skip 'all) | 928 | (cond ((fortran-find-comment-start-skip 'all) |
| 929 | (goto-char (match-beginning 0)) | 929 | (goto-char (match-beginning 0)) |
| 930 | (if (bolp) | 930 | (if (bolp) |
| 931 | (fortran-indent-line) | 931 | (fortran-indent-line) |
| 932 | (unless (= (current-column) (fortran-comment-indent)) | 932 | (unless (= (current-column) (fortran-comment-indent)) |
| 933 | (delete-horizontal-space) | 933 | (delete-horizontal-space) |
| 934 | (indent-to (fortran-comment-indent))))) | 934 | (indent-to (fortran-comment-indent))))) |
| 935 | ;; No existing comment. | 935 | ;; No existing comment. |
| 936 | ;; If side-by-side comments are defined, insert one, | 936 | ;; If side-by-side comments are defined, insert one, |
| 937 | ;; unless line is now blank. | 937 | ;; unless line is now blank. |
| 938 | ((and comment-start (not (looking-at "[ \t]*$")) | 938 | ((and comment-start (not (looking-at "[ \t]*$")) |
| 939 | (string-match comment-start-skip (concat " " comment-start))) | 939 | (string-match comment-start-skip (concat " " comment-start))) |
| 940 | (end-of-line) | 940 | (end-of-line) |
| 941 | (delete-horizontal-space) | 941 | (delete-horizontal-space) |
| 942 | (indent-to (fortran-comment-indent)) | 942 | (indent-to (fortran-comment-indent)) |
| 943 | (insert comment-start)) | 943 | (insert comment-start)) |
| 944 | ;; Else insert separate-line comment, making a new line if nec. | 944 | ;; Else insert separate-line comment, making a new line if nec. |
| 945 | (t | 945 | (t |
| 946 | (if (looking-at "^[ \t]*$") | 946 | (if (looking-at "^[ \t]*$") |
| 947 | (delete-horizontal-space) | 947 | (delete-horizontal-space) |
| 948 | (beginning-of-line) | 948 | (beginning-of-line) |
| 949 | (insert ?\n) | 949 | (insert ?\n) |
| 950 | (forward-char -1)) | 950 | (forward-char -1)) |
| 951 | (insert fortran-comment-line-start) | 951 | (insert fortran-comment-line-start) |
| 952 | (insert-char (if (stringp fortran-comment-indent-char) | 952 | (insert-char (if (stringp fortran-comment-indent-char) |
| 953 | (aref fortran-comment-indent-char 0) | 953 | (aref fortran-comment-indent-char 0) |
| 954 | fortran-comment-indent-char) | 954 | fortran-comment-indent-char) |
| 955 | (- (fortran-calculate-indent) (current-column)))))) | 955 | (- (fortran-calculate-indent) (current-column)))))) |
| 956 | 956 | ||
| 957 | (defun fortran-comment-region (beg-region end-region arg) | 957 | (defun fortran-comment-region (beg-region end-region arg) |
| 958 | "Comment every line in the region. | 958 | "Comment every line in the region. |
| @@ -962,7 +962,7 @@ BEG-REGION and END-REGION specify the region boundaries. | |||
| 962 | With non-nil ARG, uncomments the region." | 962 | With non-nil ARG, uncomments the region." |
| 963 | (interactive "*r\nP") | 963 | (interactive "*r\nP") |
| 964 | (let ((end-region-mark (copy-marker end-region)) | 964 | (let ((end-region-mark (copy-marker end-region)) |
| 965 | (save-point (point-marker))) | 965 | (save-point (point-marker))) |
| 966 | (goto-char beg-region) | 966 | (goto-char beg-region) |
| 967 | (beginning-of-line) | 967 | (beginning-of-line) |
| 968 | (if arg | 968 | (if arg |
| @@ -995,7 +995,7 @@ Any other key combination is executed normally." | |||
| 995 | ;; Insert char if not equal to `?', or if abbrev-mode is off. | 995 | ;; Insert char if not equal to `?', or if abbrev-mode is off. |
| 996 | (if (and abbrev-mode (or (eq char ??) (eq char help-char) | 996 | (if (and abbrev-mode (or (eq char ??) (eq char help-char) |
| 997 | (memq event help-event-list))) | 997 | (memq event help-event-list))) |
| 998 | (fortran-abbrev-help) | 998 | (fortran-abbrev-help) |
| 999 | (push event unread-command-events)))) | 999 | (push event unread-command-events)))) |
| 1000 | 1000 | ||
| 1001 | (defun fortran-abbrev-help () | 1001 | (defun fortran-abbrev-help () |
| @@ -1028,8 +1028,8 @@ The next key typed is executed unless it is SPC." | |||
| 1028 | (save-excursion | 1028 | (save-excursion |
| 1029 | (beginning-of-line) | 1029 | (beginning-of-line) |
| 1030 | (if (eq (window-start (selected-window)) | 1030 | (if (eq (window-start (selected-window)) |
| 1031 | (window-point (selected-window))) | 1031 | (window-point (selected-window))) |
| 1032 | (line-beginning-position 2) | 1032 | (line-beginning-position 2) |
| 1033 | (point))) | 1033 | (point))) |
| 1034 | nil "Type SPC or any command to erase ruler.")) | 1034 | nil "Type SPC or any command to erase ruler.")) |
| 1035 | 1035 | ||
| @@ -1039,12 +1039,12 @@ See also `fortran-window-create-momentarily'." | |||
| 1039 | (interactive) | 1039 | (interactive) |
| 1040 | (let ((window-min-width 2)) | 1040 | (let ((window-min-width 2)) |
| 1041 | (unless (window-full-width-p) | 1041 | (unless (window-full-width-p) |
| 1042 | (enlarge-window-horizontally (- (frame-width) | 1042 | (enlarge-window-horizontally (- (frame-width) |
| 1043 | (window-width) 1))) | 1043 | (window-width) 1))) |
| 1044 | (let* ((window-edges (window-edges)) | 1044 | (let* ((window-edges (window-edges)) |
| 1045 | (scroll-bar-width (- (nth 2 window-edges) | 1045 | (scroll-bar-width (- (nth 2 window-edges) |
| 1046 | (car window-edges) | 1046 | (car window-edges) |
| 1047 | (window-width)))) | 1047 | (window-width)))) |
| 1048 | (split-window-horizontally (+ fortran-line-length scroll-bar-width))) | 1048 | (split-window-horizontally (+ fortran-line-length scroll-bar-width))) |
| 1049 | (other-window 1) | 1049 | (other-window 1) |
| 1050 | (switch-to-buffer " fortran-window-extra" t) | 1050 | (switch-to-buffer " fortran-window-extra" t) |
| @@ -1056,16 +1056,16 @@ Optional ARG non-nil and non-unity disables the momentary feature. | |||
| 1056 | See also `fortran-window-create'." | 1056 | See also `fortran-window-create'." |
| 1057 | (interactive "p") | 1057 | (interactive "p") |
| 1058 | (if (or (not arg) | 1058 | (if (or (not arg) |
| 1059 | (= arg 1)) | 1059 | (= arg 1)) |
| 1060 | (save-window-excursion | 1060 | (save-window-excursion |
| 1061 | (progn | 1061 | (progn |
| 1062 | (condition-case nil | 1062 | (condition-case nil |
| 1063 | (fortran-window-create) | 1063 | (fortran-window-create) |
| 1064 | (error (error "No room for Fortran window"))) | 1064 | (error (error "No room for Fortran window"))) |
| 1065 | (message "Type SPC to continue editing.") | 1065 | (message "Type SPC to continue editing.") |
| 1066 | (let ((char (read-event))) | 1066 | (let ((char (read-event))) |
| 1067 | (or (equal char ?\s) | 1067 | (or (equal char ?\s) |
| 1068 | (setq unread-command-events (list char)))))) | 1068 | (setq unread-command-events (list char)))))) |
| 1069 | (fortran-window-create))) | 1069 | (fortran-window-create))) |
| 1070 | 1070 | ||
| 1071 | (defun fortran-split-line () | 1071 | (defun fortran-split-line () |
| @@ -1073,13 +1073,13 @@ See also `fortran-window-create'." | |||
| 1073 | (interactive "*") | 1073 | (interactive "*") |
| 1074 | (delete-horizontal-space) | 1074 | (delete-horizontal-space) |
| 1075 | (if (save-excursion | 1075 | (if (save-excursion |
| 1076 | (let ((pos (point))) | 1076 | (let ((pos (point))) |
| 1077 | (beginning-of-line) | 1077 | (beginning-of-line) |
| 1078 | (and (fortran-find-comment-start-skip 'all) | 1078 | (and (fortran-find-comment-start-skip 'all) |
| 1079 | (< (match-beginning 0) pos)))) | 1079 | (< (match-beginning 0) pos)))) |
| 1080 | (insert ?\n (match-string 0)) | 1080 | (insert ?\n (match-string 0)) |
| 1081 | (if indent-tabs-mode | 1081 | (if indent-tabs-mode |
| 1082 | (insert ?\n ?\t (fortran-numerical-continuation-char)) | 1082 | (insert ?\n ?\t (fortran-numerical-continuation-char)) |
| 1083 | (insert "\n " fortran-continuation-string))) ; space after \n important | 1083 | (insert "\n " fortran-continuation-string))) ; space after \n important |
| 1084 | (fortran-indent-line)) ; when cont string is C, c or * | 1084 | (fortran-indent-line)) ; when cont string is C, c or * |
| 1085 | 1085 | ||
| @@ -1115,7 +1115,7 @@ plus one, otherwise return 1. Zero not allowed." | |||
| 1115 | (save-excursion | 1115 | (save-excursion |
| 1116 | (forward-line -1) | 1116 | (forward-line -1) |
| 1117 | (if (looking-at "\t[1-9]") | 1117 | (if (looking-at "\t[1-9]") |
| 1118 | (+ ?1 (% (- (char-after (1+ (point))) ?0) 9)) | 1118 | (+ ?1 (% (- (char-after (1+ (point))) ?0) 9)) |
| 1119 | ?1))) | 1119 | ?1))) |
| 1120 | 1120 | ||
| 1121 | (put 'fortran-electric-line-number 'delete-selection t) | 1121 | (put 'fortran-electric-line-number 'delete-selection t) |
| @@ -1125,27 +1125,27 @@ Auto-indent does not happen if a numeric ARG is used." | |||
| 1125 | (interactive "*P") | 1125 | (interactive "*P") |
| 1126 | (if (or arg (not fortran-electric-line-number)) | 1126 | (if (or arg (not fortran-electric-line-number)) |
| 1127 | (if arg | 1127 | (if arg |
| 1128 | (self-insert-command (prefix-numeric-value arg)) | 1128 | (self-insert-command (prefix-numeric-value arg)) |
| 1129 | (self-insert-command 1)) | 1129 | (self-insert-command 1)) |
| 1130 | (if (or (and (= 5 (current-column)) | 1130 | (if (or (and (= 5 (current-column)) |
| 1131 | (save-excursion | 1131 | (save-excursion |
| 1132 | (beginning-of-line) | 1132 | (beginning-of-line) |
| 1133 | ;; In col 5 with only spaces to the left. | 1133 | ;; In col 5 with only spaces to the left. |
| 1134 | (looking-at " \\{5\\}"))) | 1134 | (looking-at " \\{5\\}"))) |
| 1135 | (and (= (if indent-tabs-mode | 1135 | (and (= (if indent-tabs-mode |
| 1136 | fortran-minimum-statement-indent-tab | 1136 | fortran-minimum-statement-indent-tab |
| 1137 | fortran-minimum-statement-indent-fixed) (current-column)) | 1137 | fortran-minimum-statement-indent-fixed) (current-column)) |
| 1138 | ;; In col 8 with a single tab to the left. | 1138 | ;; In col 8 with a single tab to the left. |
| 1139 | (eq ?\t (char-after (line-beginning-position))) | 1139 | (eq ?\t (char-after (line-beginning-position))) |
| 1140 | (not (or (eq last-command 'fortran-indent-line) | 1140 | (not (or (eq last-command 'fortran-indent-line) |
| 1141 | (eq last-command | 1141 | (eq last-command |
| 1142 | 'fortran-indent-new-line)))) | 1142 | 'fortran-indent-new-line)))) |
| 1143 | (save-excursion | 1143 | (save-excursion |
| 1144 | (re-search-backward "[^ \t0-9]" | 1144 | (re-search-backward "[^ \t0-9]" |
| 1145 | (line-beginning-position) | 1145 | (line-beginning-position) |
| 1146 | t)) ; not a line number | 1146 | t)) ; not a line number |
| 1147 | (looking-at "[0-9]")) ; within a line number | 1147 | (looking-at "[0-9]")) ; within a line number |
| 1148 | (self-insert-command (prefix-numeric-value arg)) | 1148 | (self-insert-command (prefix-numeric-value arg)) |
| 1149 | (skip-chars-backward " \t") | 1149 | (skip-chars-backward " \t") |
| 1150 | (insert last-command-char) | 1150 | (insert last-command-char) |
| 1151 | (fortran-indent-line)))) | 1151 | (fortran-indent-line)))) |
| @@ -1157,9 +1157,9 @@ Auto-indent does not happen if a numeric ARG is used." | |||
| 1157 | ;; match of whitespace, avoiding possible column 73+ stuff. | 1157 | ;; match of whitespace, avoiding possible column 73+ stuff. |
| 1158 | (save-match-data | 1158 | (save-match-data |
| 1159 | (string-match "^\\s-*\\(\\'\\|\\s<\\)" | 1159 | (string-match "^\\s-*\\(\\'\\|\\s<\\)" |
| 1160 | (buffer-substring (match-end 0) | 1160 | (buffer-substring (match-end 0) |
| 1161 | (min (line-end-position) | 1161 | (min (line-end-position) |
| 1162 | (+ fortran-line-length | 1162 | (+ fortran-line-length |
| 1163 | (line-beginning-position))))))) | 1163 | (line-beginning-position))))))) |
| 1164 | 1164 | ||
| 1165 | ;; Note that you can't just check backwards for `subroutine' &c in | 1165 | ;; Note that you can't just check backwards for `subroutine' &c in |
| @@ -1171,28 +1171,28 @@ Auto-indent does not happen if a numeric ARG is used." | |||
| 1171 | (let ((case-fold-search t)) | 1171 | (let ((case-fold-search t)) |
| 1172 | (beginning-of-line -1) | 1172 | (beginning-of-line -1) |
| 1173 | (if (catch 'ok | 1173 | (if (catch 'ok |
| 1174 | (while (re-search-backward fortran-end-prog-re nil 'move) | 1174 | (while (re-search-backward fortran-end-prog-re nil 'move) |
| 1175 | (if (fortran-check-end-prog-re) | 1175 | (if (fortran-check-end-prog-re) |
| 1176 | (throw 'ok t)))) | 1176 | (throw 'ok t)))) |
| 1177 | (forward-line))))) | 1177 | (forward-line))))) |
| 1178 | 1178 | ||
| 1179 | (defun fortran-end-of-subprogram () | 1179 | (defun fortran-end-of-subprogram () |
| 1180 | "Move point to the end of the current Fortran subprogram." | 1180 | "Move point to the end of the current Fortran subprogram." |
| 1181 | (interactive) | 1181 | (interactive) |
| 1182 | (save-match-data | 1182 | (save-match-data |
| 1183 | (let ((case-fold-search t)) | 1183 | (let ((case-fold-search t)) |
| 1184 | (if (save-excursion ; on END | 1184 | (if (save-excursion ; on END |
| 1185 | (beginning-of-line) | 1185 | (beginning-of-line) |
| 1186 | (and (looking-at fortran-end-prog-re) | 1186 | (and (looking-at fortran-end-prog-re) |
| 1187 | (fortran-check-end-prog-re))) | 1187 | (fortran-check-end-prog-re))) |
| 1188 | (forward-line) | 1188 | (forward-line) |
| 1189 | (beginning-of-line 2) | 1189 | (beginning-of-line 2) |
| 1190 | (catch 'ok | 1190 | (catch 'ok |
| 1191 | (while (re-search-forward fortran-end-prog-re nil 'move) | 1191 | (while (re-search-forward fortran-end-prog-re nil 'move) |
| 1192 | (if (fortran-check-end-prog-re) | 1192 | (if (fortran-check-end-prog-re) |
| 1193 | (throw 'ok t)))) | 1193 | (throw 'ok t)))) |
| 1194 | (goto-char (match-beginning 0)) | 1194 | (goto-char (match-beginning 0)) |
| 1195 | (forward-line))))) | 1195 | (forward-line))))) |
| 1196 | 1196 | ||
| 1197 | (defun fortran-previous-statement () | 1197 | (defun fortran-previous-statement () |
| 1198 | "Move point to beginning of the previous Fortran statement. | 1198 | "Move point to beginning of the previous Fortran statement. |
| @@ -1203,28 +1203,28 @@ Directive lines are treated as comments." | |||
| 1203 | (let (not-first-statement continue-test) | 1203 | (let (not-first-statement continue-test) |
| 1204 | (beginning-of-line) | 1204 | (beginning-of-line) |
| 1205 | (setq continue-test | 1205 | (setq continue-test |
| 1206 | (and | 1206 | (and |
| 1207 | (not (looking-at fortran-comment-line-start-skip)) | 1207 | (not (looking-at fortran-comment-line-start-skip)) |
| 1208 | (not (looking-at fortran-directive-re)) | 1208 | (not (looking-at fortran-directive-re)) |
| 1209 | (or (looking-at | 1209 | (or (looking-at |
| 1210 | (concat "[ \t]*" | 1210 | (concat "[ \t]*" |
| 1211 | (regexp-quote fortran-continuation-string))) | 1211 | (regexp-quote fortran-continuation-string))) |
| 1212 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")))) | 1212 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")))) |
| 1213 | (while (and (setq not-first-statement (zerop (forward-line -1))) | 1213 | (while (and (setq not-first-statement (zerop (forward-line -1))) |
| 1214 | (or (looking-at fortran-comment-line-start-skip) | 1214 | (or (looking-at fortran-comment-line-start-skip) |
| 1215 | (looking-at fortran-directive-re) | 1215 | (looking-at fortran-directive-re) |
| 1216 | (looking-at | 1216 | (looking-at |
| 1217 | (concat "[ \t]*" | 1217 | (concat "[ \t]*" |
| 1218 | (regexp-quote fortran-continuation-string))) | 1218 | (regexp-quote fortran-continuation-string))) |
| 1219 | (looking-at "[ \t]*$\\| \\{5\\}[^ 0\n]\\|\t[1-9]") | 1219 | (looking-at "[ \t]*$\\| \\{5\\}[^ 0\n]\\|\t[1-9]") |
| 1220 | (looking-at (concat "[ \t]*" comment-start-skip))))) | 1220 | (looking-at (concat "[ \t]*" comment-start-skip))))) |
| 1221 | (cond ((and continue-test | 1221 | (cond ((and continue-test |
| 1222 | (not not-first-statement)) | 1222 | (not not-first-statement)) |
| 1223 | (message "Incomplete continuation statement.")) | 1223 | (message "Incomplete continuation statement.")) |
| 1224 | (continue-test | 1224 | (continue-test |
| 1225 | (fortran-previous-statement)) | 1225 | (fortran-previous-statement)) |
| 1226 | ((not not-first-statement) | 1226 | ((not not-first-statement) |
| 1227 | 'first-statement)))) | 1227 | 'first-statement)))) |
| 1228 | 1228 | ||
| 1229 | (defun fortran-next-statement () | 1229 | (defun fortran-next-statement () |
| 1230 | "Move point to beginning of the next Fortran statement. | 1230 | "Move point to beginning of the next Fortran statement. |
| @@ -1235,14 +1235,14 @@ Directive lines are treated as comments." | |||
| 1235 | (let (not-last-statement) | 1235 | (let (not-last-statement) |
| 1236 | (beginning-of-line) | 1236 | (beginning-of-line) |
| 1237 | (while (and (setq not-last-statement | 1237 | (while (and (setq not-last-statement |
| 1238 | (and (zerop (forward-line 1)) | 1238 | (and (zerop (forward-line 1)) |
| 1239 | (not (eobp)))) | 1239 | (not (eobp)))) |
| 1240 | (or (looking-at fortran-comment-line-start-skip) | 1240 | (or (looking-at fortran-comment-line-start-skip) |
| 1241 | (looking-at fortran-directive-re) | 1241 | (looking-at fortran-directive-re) |
| 1242 | (looking-at "[ \t]*$\\| [^ 0\n]\\|\t[1-9]") | 1242 | (looking-at "[ \t]*$\\| [^ 0\n]\\|\t[1-9]") |
| 1243 | (looking-at (concat "[ \t]*" comment-start-skip))))) | 1243 | (looking-at (concat "[ \t]*" comment-start-skip))))) |
| 1244 | (if (not not-last-statement) | 1244 | (if (not not-last-statement) |
| 1245 | 'last-statement))) | 1245 | 'last-statement))) |
| 1246 | 1246 | ||
| 1247 | (defun fortran-looking-at-if-then () | 1247 | (defun fortran-looking-at-if-then () |
| 1248 | "Return non-nil if at the start of a line with an IF ... THEN statement." | 1248 | "Return non-nil if at the start of a line with an IF ... THEN statement." |
| @@ -1327,10 +1327,10 @@ pushes mark before moving point." | |||
| 1327 | "From a line matching REGEX, blink matching KEYWORD statement line. | 1327 | "From a line matching REGEX, blink matching KEYWORD statement line. |
| 1328 | Use function FIND-BEGIN to match it." | 1328 | Use function FIND-BEGIN to match it." |
| 1329 | (let ((top-of-window (window-start)) | 1329 | (let ((top-of-window (window-start)) |
| 1330 | (end-point (point)) | 1330 | (end-point (point)) |
| 1331 | (case-fold-search t) | 1331 | (case-fold-search t) |
| 1332 | matching | 1332 | matching |
| 1333 | message) | 1333 | message) |
| 1334 | (when (save-excursion | 1334 | (when (save-excursion |
| 1335 | (beginning-of-line) | 1335 | (beginning-of-line) |
| 1336 | (skip-chars-forward " \t0-9") | 1336 | (skip-chars-forward " \t0-9") |
| @@ -1354,7 +1354,7 @@ Use function FIND-BEGIN to match it." | |||
| 1354 | (defun fortran-blink-matching-if () | 1354 | (defun fortran-blink-matching-if () |
| 1355 | "From an ENDIF or ELSE statement, blink the matching IF statement." | 1355 | "From an ENDIF or ELSE statement, blink the matching IF statement." |
| 1356 | (fortran-blink-match "e\\(nd[ \t]*if\\|lse\\([ \t]*if\\)?\\)\\b" | 1356 | (fortran-blink-match "e\\(nd[ \t]*if\\|lse\\([ \t]*if\\)?\\)\\b" |
| 1357 | "if" #'fortran-beginning-if)) | 1357 | "if" #'fortran-beginning-if)) |
| 1358 | 1358 | ||
| 1359 | (defun fortran-blink-matching-do () | 1359 | (defun fortran-blink-matching-do () |
| 1360 | "From an ENDDO statement, blink the matching DO or DO WHILE statement." | 1360 | "From an ENDDO statement, blink the matching DO or DO WHILE statement." |
| @@ -1377,27 +1377,27 @@ The marks are pushed." | |||
| 1377 | Return point or nil." | 1377 | Return point or nil." |
| 1378 | (let ((case-fold-search t)) | 1378 | (let ((case-fold-search t)) |
| 1379 | (if (save-excursion (beginning-of-line) | 1379 | (if (save-excursion (beginning-of-line) |
| 1380 | (skip-chars-forward " \t0-9") | 1380 | (skip-chars-forward " \t0-9") |
| 1381 | (looking-at "end[ \t]*do\\b")) | 1381 | (looking-at "end[ \t]*do\\b")) |
| 1382 | ;; Sitting on one. | 1382 | ;; Sitting on one. |
| 1383 | (match-beginning 0) | 1383 | (match-beginning 0) |
| 1384 | ;; Search for one. | 1384 | ;; Search for one. |
| 1385 | (save-excursion | 1385 | (save-excursion |
| 1386 | (let ((count 1)) | 1386 | (let ((count 1)) |
| 1387 | (while (and (not (zerop count)) | 1387 | (while (and (not (zerop count)) |
| 1388 | (not (eq (fortran-next-statement) 'last-statement)) | 1388 | (not (eq (fortran-next-statement) 'last-statement)) |
| 1389 | ;; Keep local to subprogram. | 1389 | ;; Keep local to subprogram. |
| 1390 | (not (and (looking-at fortran-end-prog-re) | 1390 | (not (and (looking-at fortran-end-prog-re) |
| 1391 | (fortran-check-end-prog-re)))) | 1391 | (fortran-check-end-prog-re)))) |
| 1392 | (skip-chars-forward " \t0-9") | 1392 | (skip-chars-forward " \t0-9") |
| 1393 | (cond ((looking-at "end[ \t]*do\\b") | 1393 | (cond ((looking-at "end[ \t]*do\\b") |
| 1394 | (setq count (1- count))) | 1394 | (setq count (1- count))) |
| 1395 | ((looking-at | 1395 | ((looking-at |
| 1396 | "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+[^0-9]") | 1396 | "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+[^0-9]") |
| 1397 | (setq count (1+ count))))) | 1397 | (setq count (1+ count))))) |
| 1398 | (and (zerop count) | 1398 | (and (zerop count) |
| 1399 | ;; All pairs accounted for. | 1399 | ;; All pairs accounted for. |
| 1400 | (point))))))) | 1400 | (point))))))) |
| 1401 | 1401 | ||
| 1402 | (defun fortran-beginning-do () | 1402 | (defun fortran-beginning-do () |
| 1403 | "Search backwards for first unmatched DO [WHILE]. | 1403 | "Search backwards for first unmatched DO [WHILE]. |
| @@ -1405,28 +1405,28 @@ Return point or nil. Ignores labelled DO loops (ie DO 10 ... 10 CONTINUE)." | |||
| 1405 | (let ((case-fold-search t) | 1405 | (let ((case-fold-search t) |
| 1406 | (dostart-re "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+[^0-9]")) | 1406 | (dostart-re "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+[^0-9]")) |
| 1407 | (if (save-excursion | 1407 | (if (save-excursion |
| 1408 | (beginning-of-line) | 1408 | (beginning-of-line) |
| 1409 | (skip-chars-forward " \t0-9") | 1409 | (skip-chars-forward " \t0-9") |
| 1410 | (looking-at dostart-re)) | 1410 | (looking-at dostart-re)) |
| 1411 | ;; Sitting on one. | 1411 | ;; Sitting on one. |
| 1412 | (match-beginning 0) | 1412 | (match-beginning 0) |
| 1413 | ;; Search for one. | 1413 | ;; Search for one. |
| 1414 | (save-excursion | 1414 | (save-excursion |
| 1415 | (let ((count 1)) | 1415 | (let ((count 1)) |
| 1416 | (while (and (not (zerop count)) | 1416 | (while (and (not (zerop count)) |
| 1417 | (not (eq (fortran-previous-statement) 'first-statement)) | 1417 | (not (eq (fortran-previous-statement) 'first-statement)) |
| 1418 | ;; Keep local to subprogram. | 1418 | ;; Keep local to subprogram. |
| 1419 | (not (and (looking-at fortran-end-prog-re) | 1419 | (not (and (looking-at fortran-end-prog-re) |
| 1420 | (fortran-check-end-prog-re)))) | 1420 | (fortran-check-end-prog-re)))) |
| 1421 | (skip-chars-forward " \t0-9") | 1421 | (skip-chars-forward " \t0-9") |
| 1422 | (cond ((looking-at dostart-re) | 1422 | (cond ((looking-at dostart-re) |
| 1423 | (setq count (1- count))) | 1423 | (setq count (1- count))) |
| 1424 | ;; Note labelled loop ends not considered. | 1424 | ;; Note labelled loop ends not considered. |
| 1425 | ((looking-at "end[ \t]*do\\b") | 1425 | ((looking-at "end[ \t]*do\\b") |
| 1426 | (setq count (1+ count))))) | 1426 | (setq count (1+ count))))) |
| 1427 | (and (zerop count) | 1427 | (and (zerop count) |
| 1428 | ;; All pairs accounted for. | 1428 | ;; All pairs accounted for. |
| 1429 | (point))))))) | 1429 | (point))))))) |
| 1430 | 1430 | ||
| 1431 | (defun fortran-mark-if () | 1431 | (defun fortran-mark-if () |
| 1432 | "Put mark at end of Fortran IF-ENDIF construct, point at beginning. | 1432 | "Put mark at end of Fortran IF-ENDIF construct, point at beginning. |
| @@ -1446,103 +1446,103 @@ The marks are pushed." | |||
| 1446 | Return point or nil." | 1446 | Return point or nil." |
| 1447 | (let ((case-fold-search t)) | 1447 | (let ((case-fold-search t)) |
| 1448 | (if (save-excursion (beginning-of-line) | 1448 | (if (save-excursion (beginning-of-line) |
| 1449 | (skip-chars-forward " \t0-9") | 1449 | (skip-chars-forward " \t0-9") |
| 1450 | (looking-at "end[ \t]*if\\b")) | 1450 | (looking-at "end[ \t]*if\\b")) |
| 1451 | ;; Sitting on one. | 1451 | ;; Sitting on one. |
| 1452 | (match-beginning 0) | 1452 | (match-beginning 0) |
| 1453 | ;; Search for one. The point has been already been moved to first | 1453 | ;; Search for one. The point has been already been moved to first |
| 1454 | ;; letter on line but this should not cause troubles. | 1454 | ;; letter on line but this should not cause troubles. |
| 1455 | (save-excursion | 1455 | (save-excursion |
| 1456 | (let ((count 1)) | 1456 | (let ((count 1)) |
| 1457 | (while (and (not (zerop count)) | 1457 | (while (and (not (zerop count)) |
| 1458 | (not (eq (fortran-next-statement) 'last-statement)) | 1458 | (not (eq (fortran-next-statement) 'last-statement)) |
| 1459 | ;; Keep local to subprogram. | 1459 | ;; Keep local to subprogram. |
| 1460 | (not (and (looking-at fortran-end-prog-re) | 1460 | (not (and (looking-at fortran-end-prog-re) |
| 1461 | (fortran-check-end-prog-re)))) | 1461 | (fortran-check-end-prog-re)))) |
| 1462 | (skip-chars-forward " \t0-9") | 1462 | (skip-chars-forward " \t0-9") |
| 1463 | (cond ((looking-at "end[ \t]*if\\b") | 1463 | (cond ((looking-at "end[ \t]*if\\b") |
| 1464 | (setq count (1- count))) | 1464 | (setq count (1- count))) |
| 1465 | ((looking-at fortran-if-start-re) | 1465 | ((looking-at fortran-if-start-re) |
| 1466 | (save-excursion | 1466 | (save-excursion |
| 1467 | (if (or | 1467 | (if (or |
| 1468 | (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") | 1468 | (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") |
| 1469 | (let (then-test) ; multi-line if-then | 1469 | (let (then-test) ; multi-line if-then |
| 1470 | (while | 1470 | (while |
| 1471 | (and | 1471 | (and |
| 1472 | (zerop (forward-line 1)) | 1472 | (zerop (forward-line 1)) |
| 1473 | ;; Search forward for then. | 1473 | ;; Search forward for then. |
| 1474 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") | 1474 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") |
| 1475 | (not | 1475 | (not |
| 1476 | (setq then-test | 1476 | (setq then-test |
| 1477 | (looking-at | 1477 | (looking-at |
| 1478 | ".*then\\b[ \t]*[^ \t(=a-z0-9]"))))) | 1478 | ".*then\\b[ \t]*[^ \t(=a-z0-9]"))))) |
| 1479 | then-test)) | 1479 | then-test)) |
| 1480 | (setq count (1+ count))))))) | 1480 | (setq count (1+ count))))))) |
| 1481 | (and (zerop count) | 1481 | (and (zerop count) |
| 1482 | ;; All pairs accounted for. | 1482 | ;; All pairs accounted for. |
| 1483 | (point))))))) | 1483 | (point))))))) |
| 1484 | 1484 | ||
| 1485 | (defun fortran-beginning-if () | 1485 | (defun fortran-beginning-if () |
| 1486 | "Search backwards for first unmatched IF-THEN. | 1486 | "Search backwards for first unmatched IF-THEN. |
| 1487 | Return point or nil." | 1487 | Return point or nil." |
| 1488 | (let ((case-fold-search t)) | 1488 | (let ((case-fold-search t)) |
| 1489 | (if (save-excursion | 1489 | (if (save-excursion |
| 1490 | ;; May be sitting on multi-line if-then statement, first | 1490 | ;; May be sitting on multi-line if-then statement, first |
| 1491 | ;; move to beginning of current statement. Note: | 1491 | ;; move to beginning of current statement. Note: |
| 1492 | ;; `fortran-previous-statement' moves to previous statement | 1492 | ;; `fortran-previous-statement' moves to previous statement |
| 1493 | ;; *unless* current statement is first one. Only move | 1493 | ;; *unless* current statement is first one. Only move |
| 1494 | ;; forward if not first-statement. | 1494 | ;; forward if not first-statement. |
| 1495 | (if (not (eq (fortran-previous-statement) 'first-statement)) | 1495 | (if (not (eq (fortran-previous-statement) 'first-statement)) |
| 1496 | (fortran-next-statement)) | 1496 | (fortran-next-statement)) |
| 1497 | (skip-chars-forward " \t0-9") | 1497 | (skip-chars-forward " \t0-9") |
| 1498 | (and | 1498 | (and |
| 1499 | (looking-at fortran-if-start-re) | 1499 | (looking-at fortran-if-start-re) |
| 1500 | (save-match-data | 1500 | (save-match-data |
| 1501 | (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") | 1501 | (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") |
| 1502 | ;; Multi-line if-then. | 1502 | ;; Multi-line if-then. |
| 1503 | (let (then-test) | 1503 | (let (then-test) |
| 1504 | (while | 1504 | (while |
| 1505 | (and (zerop (forward-line 1)) | 1505 | (and (zerop (forward-line 1)) |
| 1506 | ;; Search forward for then. | 1506 | ;; Search forward for then. |
| 1507 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") | 1507 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") |
| 1508 | (not | 1508 | (not |
| 1509 | (setq then-test | 1509 | (setq then-test |
| 1510 | (looking-at | 1510 | (looking-at |
| 1511 | ".*then\\b[ \t]*[^ \t(=a-z0-9]"))))) | 1511 | ".*then\\b[ \t]*[^ \t(=a-z0-9]"))))) |
| 1512 | then-test))))) | 1512 | then-test))))) |
| 1513 | ;; Sitting on one. | 1513 | ;; Sitting on one. |
| 1514 | (match-beginning 0) | 1514 | (match-beginning 0) |
| 1515 | ;; Search for one. | 1515 | ;; Search for one. |
| 1516 | (save-excursion | 1516 | (save-excursion |
| 1517 | (let ((count 1)) | 1517 | (let ((count 1)) |
| 1518 | (while (and (not (zerop count)) | 1518 | (while (and (not (zerop count)) |
| 1519 | (not (eq (fortran-previous-statement) 'first-statement)) | 1519 | (not (eq (fortran-previous-statement) 'first-statement)) |
| 1520 | ;; Keep local to subprogram. | 1520 | ;; Keep local to subprogram. |
| 1521 | (not (and (looking-at fortran-end-prog-re) | 1521 | (not (and (looking-at fortran-end-prog-re) |
| 1522 | (fortran-check-end-prog-re)))) | 1522 | (fortran-check-end-prog-re)))) |
| 1523 | (skip-chars-forward " \t0-9") | 1523 | (skip-chars-forward " \t0-9") |
| 1524 | (cond ((looking-at fortran-if-start-re) | 1524 | (cond ((looking-at fortran-if-start-re) |
| 1525 | (save-excursion | 1525 | (save-excursion |
| 1526 | (if (or | 1526 | (if (or |
| 1527 | (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") | 1527 | (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") |
| 1528 | (let (then-test) ; multi-line if-then | 1528 | (let (then-test) ; multi-line if-then |
| 1529 | (while | 1529 | (while |
| 1530 | (and | 1530 | (and |
| 1531 | (zerop (forward-line 1)) | 1531 | (zerop (forward-line 1)) |
| 1532 | ;; Search forward for then. | 1532 | ;; Search forward for then. |
| 1533 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") | 1533 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") |
| 1534 | (not | 1534 | (not |
| 1535 | (setq then-test | 1535 | (setq then-test |
| 1536 | (looking-at | 1536 | (looking-at |
| 1537 | (concat ".*then\\b[ \t]*" | 1537 | (concat ".*then\\b[ \t]*" |
| 1538 | "[^ \t(=a-z0-9]")))))) | 1538 | "[^ \t(=a-z0-9]")))))) |
| 1539 | then-test)) | 1539 | then-test)) |
| 1540 | (setq count (1- count))))) | 1540 | (setq count (1- count))))) |
| 1541 | ((looking-at "end[ \t]*if\\b") | 1541 | ((looking-at "end[ \t]*if\\b") |
| 1542 | (setq count (1+ count))))) | 1542 | (setq count (1+ count))))) |
| 1543 | (and (zerop count) | 1543 | (and (zerop count) |
| 1544 | ;; All pairs accounted for. | 1544 | ;; All pairs accounted for. |
| 1545 | (point))))))) | 1545 | (point))))))) |
| 1546 | 1546 | ||
| 1547 | 1547 | ||
| 1548 | (defun fortran-indent-line () | 1548 | (defun fortran-indent-line () |
| @@ -1552,15 +1552,15 @@ Return point or nil." | |||
| 1552 | (save-excursion | 1552 | (save-excursion |
| 1553 | (beginning-of-line) | 1553 | (beginning-of-line) |
| 1554 | (if (or (not (= cfi (fortran-current-line-indentation))) | 1554 | (if (or (not (= cfi (fortran-current-line-indentation))) |
| 1555 | (and (re-search-forward "^[ \t]*[0-9]+" (+ (point) 4) t) | 1555 | (and (re-search-forward "^[ \t]*[0-9]+" (+ (point) 4) t) |
| 1556 | (not (fortran-line-number-indented-correctly-p)))) | 1556 | (not (fortran-line-number-indented-correctly-p)))) |
| 1557 | (fortran-indent-to-column cfi) | 1557 | (fortran-indent-to-column cfi) |
| 1558 | (beginning-of-line) | 1558 | (beginning-of-line) |
| 1559 | (if (fortran-find-comment-start-skip) | 1559 | (if (fortran-find-comment-start-skip) |
| 1560 | (fortran-indent-comment)))) | 1560 | (fortran-indent-comment)))) |
| 1561 | ;; Never leave point in left margin. | 1561 | ;; Never leave point in left margin. |
| 1562 | (if (< (current-column) cfi) | 1562 | (if (< (current-column) cfi) |
| 1563 | (move-to-column cfi)) | 1563 | (move-to-column cfi)) |
| 1564 | (and auto-fill-function | 1564 | (and auto-fill-function |
| 1565 | (> (save-excursion (end-of-line) (current-column)) | 1565 | (> (save-excursion (end-of-line) (current-column)) |
| 1566 | fill-column) | 1566 | fill-column) |
| @@ -1575,20 +1575,20 @@ Return point or nil." | |||
| 1575 | "Function to use for `normal-auto-fill-function' in Fortran mode." | 1575 | "Function to use for `normal-auto-fill-function' in Fortran mode." |
| 1576 | (if (> (current-column) (current-fill-column)) | 1576 | (if (> (current-column) (current-fill-column)) |
| 1577 | (let ((cfi (fortran-calculate-indent))) | 1577 | (let ((cfi (fortran-calculate-indent))) |
| 1578 | (save-excursion | 1578 | (save-excursion |
| 1579 | (beginning-of-line) | 1579 | (beginning-of-line) |
| 1580 | (if (or (not (= cfi (fortran-current-line-indentation))) | 1580 | (if (or (not (= cfi (fortran-current-line-indentation))) |
| 1581 | (and (re-search-forward "^[ \t]*[0-9]+" | 1581 | (and (re-search-forward "^[ \t]*[0-9]+" |
| 1582 | (+ (point) 4) t) | 1582 | (+ (point) 4) t) |
| 1583 | (not (fortran-line-number-indented-correctly-p)))) | 1583 | (not (fortran-line-number-indented-correctly-p)))) |
| 1584 | (fortran-indent-to-column cfi) | 1584 | (fortran-indent-to-column cfi) |
| 1585 | (beginning-of-line) | 1585 | (beginning-of-line) |
| 1586 | (if (fortran-find-comment-start-skip) | 1586 | (if (fortran-find-comment-start-skip) |
| 1587 | (fortran-indent-comment)))) | 1587 | (fortran-indent-comment)))) |
| 1588 | (fortran-fill) | 1588 | (fortran-fill) |
| 1589 | ;; Never leave point in left margin. | 1589 | ;; Never leave point in left margin. |
| 1590 | (if (< (current-column) cfi) | 1590 | (if (< (current-column) cfi) |
| 1591 | (move-to-column cfi))))) | 1591 | (move-to-column cfi))))) |
| 1592 | 1592 | ||
| 1593 | ;; Historically this was a separate function which advertised itself | 1593 | ;; Historically this was a separate function which advertised itself |
| 1594 | ;; as reindenting but only did so where `most likely to be necessary'. | 1594 | ;; as reindenting but only did so where `most likely to be necessary'. |
| @@ -1606,21 +1606,21 @@ Return point or nil." | |||
| 1606 | (defun fortran-calculate-indent () | 1606 | (defun fortran-calculate-indent () |
| 1607 | "Calculates the Fortran indent column based on previous lines." | 1607 | "Calculates the Fortran indent column based on previous lines." |
| 1608 | (let (icol first-statement (case-fold-search t) | 1608 | (let (icol first-statement (case-fold-search t) |
| 1609 | (fortran-minimum-statement-indent | 1609 | (fortran-minimum-statement-indent |
| 1610 | (if indent-tabs-mode | 1610 | (if indent-tabs-mode |
| 1611 | fortran-minimum-statement-indent-tab | 1611 | fortran-minimum-statement-indent-tab |
| 1612 | fortran-minimum-statement-indent-fixed))) | 1612 | fortran-minimum-statement-indent-fixed))) |
| 1613 | (save-excursion | 1613 | (save-excursion |
| 1614 | (setq first-statement (fortran-previous-statement)) | 1614 | (setq first-statement (fortran-previous-statement)) |
| 1615 | (if first-statement | 1615 | (if first-statement |
| 1616 | (setq icol fortran-minimum-statement-indent) | 1616 | (setq icol fortran-minimum-statement-indent) |
| 1617 | (if (= (point) (point-min)) | 1617 | (if (= (point) (point-min)) |
| 1618 | (setq icol fortran-minimum-statement-indent) | 1618 | (setq icol fortran-minimum-statement-indent) |
| 1619 | (setq icol (fortran-current-line-indentation))) | 1619 | (setq icol (fortran-current-line-indentation))) |
| 1620 | (skip-chars-forward " \t0-9") | 1620 | (skip-chars-forward " \t0-9") |
| 1621 | (cond ((looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?if[ \t]*(") | 1621 | (cond ((looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?if[ \t]*(") |
| 1622 | (if (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t_$(=a-z0-9]") | 1622 | (if (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t_$(=a-z0-9]") |
| 1623 | (let (then-test) ; multi-line if-then | 1623 | (let (then-test) ; multi-line if-then |
| 1624 | (while (and (zerop (forward-line 1)) | 1624 | (while (and (zerop (forward-line 1)) |
| 1625 | ;; Search forward for then. | 1625 | ;; Search forward for then. |
| 1626 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") | 1626 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") |
| @@ -1656,52 +1656,52 @@ Return point or nil." | |||
| 1656 | (beginning-of-line) | 1656 | (beginning-of-line) |
| 1657 | (cond ((looking-at "[ \t]*$")) | 1657 | (cond ((looking-at "[ \t]*$")) |
| 1658 | ;; Check for directive before comment, so as not to indent. | 1658 | ;; Check for directive before comment, so as not to indent. |
| 1659 | ((looking-at fortran-directive-re) | 1659 | ((looking-at fortran-directive-re) |
| 1660 | (setq fortran-minimum-statement-indent 0 icol 0)) | 1660 | (setq fortran-minimum-statement-indent 0 icol 0)) |
| 1661 | ((looking-at fortran-comment-line-start-skip) | 1661 | ((looking-at fortran-comment-line-start-skip) |
| 1662 | (cond ((eq fortran-comment-indent-style 'relative) | 1662 | (cond ((eq fortran-comment-indent-style 'relative) |
| 1663 | (setq icol (+ icol fortran-comment-line-extra-indent))) | 1663 | (setq icol (+ icol fortran-comment-line-extra-indent))) |
| 1664 | ((eq fortran-comment-indent-style 'fixed) | 1664 | ((eq fortran-comment-indent-style 'fixed) |
| 1665 | (setq icol (+ fortran-minimum-statement-indent | 1665 | (setq icol (+ fortran-minimum-statement-indent |
| 1666 | fortran-comment-line-extra-indent)))) | 1666 | fortran-comment-line-extra-indent)))) |
| 1667 | (setq fortran-minimum-statement-indent 0)) | 1667 | (setq fortran-minimum-statement-indent 0)) |
| 1668 | ((or (looking-at (concat "[ \t]*" | 1668 | ((or (looking-at (concat "[ \t]*" |
| 1669 | (regexp-quote | 1669 | (regexp-quote |
| 1670 | fortran-continuation-string))) | 1670 | fortran-continuation-string))) |
| 1671 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")) | 1671 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")) |
| 1672 | (skip-chars-forward " \t") | 1672 | (skip-chars-forward " \t") |
| 1673 | ;; Do not introduce extra whitespace into a broken string. | 1673 | ;; Do not introduce extra whitespace into a broken string. |
| 1674 | (setq icol | 1674 | (setq icol |
| 1675 | (if (fortran-is-in-string-p (point)) | 1675 | (if (fortran-is-in-string-p (point)) |
| 1676 | 6 | 1676 | 6 |
| 1677 | (+ icol fortran-continuation-indent)))) | 1677 | (+ icol fortran-continuation-indent)))) |
| 1678 | (first-statement) | 1678 | (first-statement) |
| 1679 | ((and fortran-check-all-num-for-matching-do | 1679 | ((and fortran-check-all-num-for-matching-do |
| 1680 | (looking-at "[ \t]*[0-9]+") | 1680 | (looking-at "[ \t]*[0-9]+") |
| 1681 | (fortran-check-for-matching-do)) | 1681 | (fortran-check-for-matching-do)) |
| 1682 | (setq icol (- icol fortran-do-indent))) | 1682 | (setq icol (- icol fortran-do-indent))) |
| 1683 | (t | 1683 | (t |
| 1684 | (skip-chars-forward " \t0-9") | 1684 | (skip-chars-forward " \t0-9") |
| 1685 | (cond ((looking-at "end[ \t]*\\(if\\|select\\|where\\)\\b") | 1685 | (cond ((looking-at "end[ \t]*\\(if\\|select\\|where\\)\\b") |
| 1686 | (setq icol (- icol fortran-if-indent))) | 1686 | (setq icol (- icol fortran-if-indent))) |
| 1687 | ((looking-at "else\\(if\\)?\\b") | 1687 | ((looking-at "else\\(if\\)?\\b") |
| 1688 | (setq icol (- icol fortran-if-indent))) | 1688 | (setq icol (- icol fortran-if-indent))) |
| 1689 | ((looking-at "case[ \t]*\\((.*)\\|default\\>\\)") | 1689 | ((looking-at "case[ \t]*\\((.*)\\|default\\>\\)") |
| 1690 | (setq icol (- icol fortran-if-indent))) | 1690 | (setq icol (- icol fortran-if-indent))) |
| 1691 | ((looking-at "\\(otherwise\\|else[ \t]*where\\)\\b") | 1691 | ((looking-at "\\(otherwise\\|else[ \t]*where\\)\\b") |
| 1692 | (setq icol (- icol fortran-if-indent))) | 1692 | (setq icol (- icol fortran-if-indent))) |
| 1693 | ((and (looking-at "continue\\b") | 1693 | ((and (looking-at "continue\\b") |
| 1694 | (fortran-check-for-matching-do)) | 1694 | (fortran-check-for-matching-do)) |
| 1695 | (setq icol (- icol fortran-do-indent))) | 1695 | (setq icol (- icol fortran-do-indent))) |
| 1696 | ((looking-at "end[ \t]*do\\b") | 1696 | ((looking-at "end[ \t]*do\\b") |
| 1697 | (setq icol (- icol fortran-do-indent))) | 1697 | (setq icol (- icol fortran-do-indent))) |
| 1698 | ((looking-at "end[ \t]*\ | 1698 | ((looking-at "end[ \t]*\ |
| 1699 | \\(structure\\|union\\|map\\|interface\\)\\b[ \t]*[^ \t=(a-z]") | 1699 | \\(structure\\|union\\|map\\|interface\\)\\b[ \t]*[^ \t=(a-z]") |
| 1700 | (setq icol (- icol fortran-structure-indent))) | 1700 | (setq icol (- icol fortran-structure-indent))) |
| 1701 | ((and (looking-at fortran-end-prog-re1) | 1701 | ((and (looking-at fortran-end-prog-re1) |
| 1702 | (fortran-check-end-prog-re) | 1702 | (fortran-check-end-prog-re) |
| 1703 | (not (= icol fortran-minimum-statement-indent))) | 1703 | (not (= icol fortran-minimum-statement-indent))) |
| 1704 | (message "Warning: `end' not in column %d. Probably\ | 1704 | (message "Warning: `end' not in column %d. Probably\ |
| 1705 | an unclosed block." fortran-minimum-statement-indent)))))) | 1705 | an unclosed block." fortran-minimum-statement-indent)))))) |
| 1706 | (max fortran-minimum-statement-indent icol))) | 1706 | (max fortran-minimum-statement-indent icol))) |
| 1707 | 1707 | ||
| @@ -1715,16 +1715,16 @@ non-indentation text within the comment." | |||
| 1715 | (save-excursion | 1715 | (save-excursion |
| 1716 | (beginning-of-line) | 1716 | (beginning-of-line) |
| 1717 | (cond ((looking-at fortran-comment-line-start-skip) | 1717 | (cond ((looking-at fortran-comment-line-start-skip) |
| 1718 | (goto-char (match-end 0)) | 1718 | (goto-char (match-end 0)) |
| 1719 | (skip-chars-forward | 1719 | (skip-chars-forward |
| 1720 | (if (stringp fortran-comment-indent-char) | 1720 | (if (stringp fortran-comment-indent-char) |
| 1721 | fortran-comment-indent-char | 1721 | fortran-comment-indent-char |
| 1722 | (char-to-string fortran-comment-indent-char)))) | 1722 | (char-to-string fortran-comment-indent-char)))) |
| 1723 | ((or (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")) | 1723 | ((or (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")) |
| 1724 | (goto-char (match-end 0))) | 1724 | (goto-char (match-end 0))) |
| 1725 | (t | 1725 | (t |
| 1726 | ;; Move past line number. | 1726 | ;; Move past line number. |
| 1727 | (skip-chars-forward "[ \t0-9]"))) | 1727 | (skip-chars-forward "[ \t0-9]"))) |
| 1728 | ;; Move past whitespace. | 1728 | ;; Move past whitespace. |
| 1729 | (skip-chars-forward " \t") | 1729 | (skip-chars-forward " \t") |
| 1730 | (current-column))) | 1730 | (current-column))) |
| @@ -1741,48 +1741,48 @@ notes: 1) A non-zero/non-blank character in column 5 indicates a continuation | |||
| 1741 | (save-excursion | 1741 | (save-excursion |
| 1742 | (beginning-of-line) | 1742 | (beginning-of-line) |
| 1743 | (if (looking-at fortran-comment-line-start-skip) | 1743 | (if (looking-at fortran-comment-line-start-skip) |
| 1744 | (if fortran-comment-indent-style | 1744 | (if fortran-comment-indent-style |
| 1745 | (let* ((char (if (stringp fortran-comment-indent-char) | 1745 | (let* ((char (if (stringp fortran-comment-indent-char) |
| 1746 | (aref fortran-comment-indent-char 0) | 1746 | (aref fortran-comment-indent-char 0) |
| 1747 | fortran-comment-indent-char)) | 1747 | fortran-comment-indent-char)) |
| 1748 | (chars (string ?\s ?\t char))) | 1748 | (chars (string ?\s ?\t char))) |
| 1749 | (goto-char (match-end 0)) | 1749 | (goto-char (match-end 0)) |
| 1750 | (skip-chars-backward chars) | 1750 | (skip-chars-backward chars) |
| 1751 | (delete-region (point) (progn (skip-chars-forward chars) | 1751 | (delete-region (point) (progn (skip-chars-forward chars) |
| 1752 | (point))) | 1752 | (point))) |
| 1753 | (insert-char char (- col (current-column))))) | 1753 | (insert-char char (- col (current-column))))) |
| 1754 | (if (looking-at "\t[1-9]") | 1754 | (if (looking-at "\t[1-9]") |
| 1755 | (if indent-tabs-mode | 1755 | (if indent-tabs-mode |
| 1756 | (goto-char (match-end 0)) | 1756 | (goto-char (match-end 0)) |
| 1757 | (delete-char 2) | 1757 | (delete-char 2) |
| 1758 | (insert-char ?\s 5) | 1758 | (insert-char ?\s 5) |
| 1759 | (insert fortran-continuation-string)) | 1759 | (insert fortran-continuation-string)) |
| 1760 | (if (looking-at " \\{5\\}[^ 0\n]") | 1760 | (if (looking-at " \\{5\\}[^ 0\n]") |
| 1761 | (if indent-tabs-mode | 1761 | (if indent-tabs-mode |
| 1762 | (progn (delete-char 6) | 1762 | (progn (delete-char 6) |
| 1763 | (insert ?\t (fortran-numerical-continuation-char) 1)) | 1763 | (insert ?\t (fortran-numerical-continuation-char) 1)) |
| 1764 | (forward-char 6)) | 1764 | (forward-char 6)) |
| 1765 | (delete-horizontal-space) | 1765 | (delete-horizontal-space) |
| 1766 | ;; Put line number in columns 0-4, or | 1766 | ;; Put line number in columns 0-4, or |
| 1767 | ;; continuation character in column 5. | 1767 | ;; continuation character in column 5. |
| 1768 | (cond ((eobp)) | 1768 | (cond ((eobp)) |
| 1769 | ((looking-at (regexp-quote fortran-continuation-string)) | 1769 | ((looking-at (regexp-quote fortran-continuation-string)) |
| 1770 | (if indent-tabs-mode | 1770 | (if indent-tabs-mode |
| 1771 | (progn | 1771 | (progn |
| 1772 | (indent-to | 1772 | (indent-to |
| 1773 | (if indent-tabs-mode | 1773 | (if indent-tabs-mode |
| 1774 | fortran-minimum-statement-indent-tab | 1774 | fortran-minimum-statement-indent-tab |
| 1775 | fortran-minimum-statement-indent-fixed)) | 1775 | fortran-minimum-statement-indent-fixed)) |
| 1776 | (delete-char 1) | 1776 | (delete-char 1) |
| 1777 | (insert-char (fortran-numerical-continuation-char) 1)) | 1777 | (insert-char (fortran-numerical-continuation-char) 1)) |
| 1778 | (indent-to 5) | 1778 | (indent-to 5) |
| 1779 | (forward-char 1))) | 1779 | (forward-char 1))) |
| 1780 | ((looking-at "[0-9]+") | 1780 | ((looking-at "[0-9]+") |
| 1781 | (let ((extra-space (- 5 (- (match-end 0) (point))))) | 1781 | (let ((extra-space (- 5 (- (match-end 0) (point))))) |
| 1782 | (if (< extra-space 0) | 1782 | (if (< extra-space 0) |
| 1783 | (message "Warning: line number exceeds 5-digit limit.") | 1783 | (message "Warning: line number exceeds 5-digit limit.") |
| 1784 | (indent-to (min fortran-line-number-indent extra-space)))) | 1784 | (indent-to (min fortran-line-number-indent extra-space)))) |
| 1785 | (skip-chars-forward "0-9"))))) | 1785 | (skip-chars-forward "0-9"))))) |
| 1786 | ;; Point is now after any continuation character or line number. | 1786 | ;; Point is now after any continuation character or line number. |
| 1787 | ;; Put body of statement where specified. | 1787 | ;; Put body of statement where specified. |
| 1788 | (delete-horizontal-space) | 1788 | (delete-horizontal-space) |
| @@ -1801,20 +1801,20 @@ Do not call if there is no line number." | |||
| 1801 | (beginning-of-line) | 1801 | (beginning-of-line) |
| 1802 | (skip-chars-forward " \t") | 1802 | (skip-chars-forward " \t") |
| 1803 | (and (<= (current-column) fortran-line-number-indent) | 1803 | (and (<= (current-column) fortran-line-number-indent) |
| 1804 | (or (= (current-column) fortran-line-number-indent) | 1804 | (or (= (current-column) fortran-line-number-indent) |
| 1805 | (progn (skip-chars-forward "0-9") | 1805 | (progn (skip-chars-forward "0-9") |
| 1806 | (= (current-column) 5)))))) | 1806 | (= (current-column) 5)))))) |
| 1807 | 1807 | ||
| 1808 | (defun fortran-check-for-matching-do () | 1808 | (defun fortran-check-for-matching-do () |
| 1809 | "When called from a numbered statement, return t if matching DO is found. | 1809 | "When called from a numbered statement, return t if matching DO is found. |
| 1810 | Otherwise return nil." | 1810 | Otherwise return nil." |
| 1811 | (let ((case-fold-search t) | 1811 | (let ((case-fold-search t) |
| 1812 | charnum) | 1812 | charnum) |
| 1813 | (save-excursion | 1813 | (save-excursion |
| 1814 | (beginning-of-line) | 1814 | (beginning-of-line) |
| 1815 | (when (looking-at "[ \t]*[0-9]+") | 1815 | (when (looking-at "[ \t]*[0-9]+") |
| 1816 | (skip-chars-forward " \t") | 1816 | (skip-chars-forward " \t") |
| 1817 | (skip-chars-forward "0") ; skip past leading zeros | 1817 | (skip-chars-forward "0") ; skip past leading zeros |
| 1818 | (setq charnum | 1818 | (setq charnum |
| 1819 | (buffer-substring (point) (progn | 1819 | (buffer-substring (point) (progn |
| 1820 | (skip-chars-forward "0-9") | 1820 | (skip-chars-forward "0-9") |
| @@ -1841,19 +1841,19 @@ If ALL is nil, only match comments that start in column > 0." | |||
| 1841 | ;; (comment-search-forward (line-end-position) t)) | 1841 | ;; (comment-search-forward (line-end-position) t)) |
| 1842 | (when (or all comment-start-skip) | 1842 | (when (or all comment-start-skip) |
| 1843 | (let ((pos (point)) | 1843 | (let ((pos (point)) |
| 1844 | (css (if comment-start-skip | 1844 | (css (if comment-start-skip |
| 1845 | (concat fortran-comment-line-start-skip | 1845 | (concat fortran-comment-line-start-skip |
| 1846 | "\\|" comment-start-skip) | 1846 | "\\|" comment-start-skip) |
| 1847 | fortran-comment-line-start-skip))) | 1847 | fortran-comment-line-start-skip))) |
| 1848 | (when (re-search-forward css (line-end-position) t) | 1848 | (when (re-search-forward css (line-end-position) t) |
| 1849 | (if (and (or all (> (match-beginning 0) (line-beginning-position))) | 1849 | (if (and (or all (> (match-beginning 0) (line-beginning-position))) |
| 1850 | (or (save-match-data | 1850 | (or (save-match-data |
| 1851 | (not (fortran-is-in-string-p (match-beginning 0)))) | 1851 | (not (fortran-is-in-string-p (match-beginning 0)))) |
| 1852 | ;; Recurse for rest of line. | 1852 | ;; Recurse for rest of line. |
| 1853 | (fortran-find-comment-start-skip all))) | 1853 | (fortran-find-comment-start-skip all))) |
| 1854 | (point) | 1854 | (point) |
| 1855 | (goto-char pos) | 1855 | (goto-char pos) |
| 1856 | nil))))) | 1856 | nil))))) |
| 1857 | 1857 | ||
| 1858 | ;; From: ralf@up3aud1.gwdg.de (Ralf Fassel) | 1858 | ;; From: ralf@up3aud1.gwdg.de (Ralf Fassel) |
| 1859 | ;; Test if TAB format continuation lines work. | 1859 | ;; Test if TAB format continuation lines work. |
| @@ -1862,57 +1862,57 @@ If ALL is nil, only match comments that start in column > 0." | |||
| 1862 | (save-excursion | 1862 | (save-excursion |
| 1863 | (goto-char where) | 1863 | (goto-char where) |
| 1864 | (cond | 1864 | (cond |
| 1865 | ((bolp) nil) ; bol is never inside a string | 1865 | ((bolp) nil) ; bol is never inside a string |
| 1866 | ((save-excursion ; comment lines too | 1866 | ((save-excursion ; comment lines too |
| 1867 | (beginning-of-line) | 1867 | (beginning-of-line) |
| 1868 | (looking-at fortran-comment-line-start-skip)) nil) | 1868 | (looking-at fortran-comment-line-start-skip)) nil) |
| 1869 | (t (let ((parse-state '(0 nil nil nil nil nil 0)) | 1869 | (t (let ((parse-state '(0 nil nil nil nil nil 0)) |
| 1870 | (quoted-comment-start (if comment-start | 1870 | (quoted-comment-start (if comment-start |
| 1871 | (regexp-quote comment-start))) | 1871 | (regexp-quote comment-start))) |
| 1872 | (not-done t) | 1872 | (not-done t) |
| 1873 | parse-limit end-of-line) | 1873 | parse-limit end-of-line) |
| 1874 | ;; Move to start of current statement. | 1874 | ;; Move to start of current statement. |
| 1875 | (fortran-next-statement) | 1875 | (fortran-next-statement) |
| 1876 | (fortran-previous-statement) | 1876 | (fortran-previous-statement) |
| 1877 | ;; Now parse up to WHERE. | 1877 | ;; Now parse up to WHERE. |
| 1878 | (while not-done | 1878 | (while not-done |
| 1879 | (if (or ;; Skip to next line if: | 1879 | (if (or ;; Skip to next line if: |
| 1880 | ;; - comment line? | 1880 | ;; - comment line? |
| 1881 | (looking-at fortran-comment-line-start-skip) | 1881 | (looking-at fortran-comment-line-start-skip) |
| 1882 | ;; - at end of line? | 1882 | ;; - at end of line? |
| 1883 | (eolp) | 1883 | (eolp) |
| 1884 | ;; - not in a string and after comment-start? | 1884 | ;; - not in a string and after comment-start? |
| 1885 | (and (not (nth 3 parse-state)) | 1885 | (and (not (nth 3 parse-state)) |
| 1886 | comment-start | 1886 | comment-start |
| 1887 | (equal comment-start | 1887 | (equal comment-start |
| 1888 | (char-to-string (preceding-char))))) | 1888 | (char-to-string (preceding-char))))) |
| 1889 | (if (> (forward-line) 0) | 1889 | (if (> (forward-line) 0) |
| 1890 | (setq not-done nil)) | 1890 | (setq not-done nil)) |
| 1891 | ;; else: | 1891 | ;; else: |
| 1892 | ;; If we are at beginning of code line, skip any | 1892 | ;; If we are at beginning of code line, skip any |
| 1893 | ;; whitespace, labels and tab continuation markers. | 1893 | ;; whitespace, labels and tab continuation markers. |
| 1894 | (if (bolp) (skip-chars-forward " \t0-9")) | 1894 | (if (bolp) (skip-chars-forward " \t0-9")) |
| 1895 | ;; If we are in column <= 5 now, check for continuation char. | 1895 | ;; If we are in column <= 5 now, check for continuation char. |
| 1896 | (cond ((= 5 (current-column)) (forward-char 1)) | 1896 | (cond ((= 5 (current-column)) (forward-char 1)) |
| 1897 | ((and (< (current-column) 5) | 1897 | ((and (< (current-column) 5) |
| 1898 | (equal fortran-continuation-string | 1898 | (equal fortran-continuation-string |
| 1899 | (char-to-string (following-char))) | 1899 | (char-to-string (following-char))) |
| 1900 | (forward-char 1)))) | 1900 | (forward-char 1)))) |
| 1901 | ;; Find out parse-limit from here. | 1901 | ;; Find out parse-limit from here. |
| 1902 | (setq end-of-line (line-end-position)) | 1902 | (setq end-of-line (line-end-position)) |
| 1903 | (setq parse-limit (min where end-of-line)) | 1903 | (setq parse-limit (min where end-of-line)) |
| 1904 | ;; Parse max up to comment-start, if non-nil and in current line. | 1904 | ;; Parse max up to comment-start, if non-nil and in current line. |
| 1905 | (if comment-start | 1905 | (if comment-start |
| 1906 | (save-excursion | 1906 | (save-excursion |
| 1907 | (if (re-search-forward quoted-comment-start end-of-line t) | 1907 | (if (re-search-forward quoted-comment-start end-of-line t) |
| 1908 | (setq parse-limit (min (point) parse-limit))))) | 1908 | (setq parse-limit (min (point) parse-limit))))) |
| 1909 | ;; Now parse if still in limits. | 1909 | ;; Now parse if still in limits. |
| 1910 | (if (< (point) where) | 1910 | (if (< (point) where) |
| 1911 | (setq parse-state (parse-partial-sexp | 1911 | (setq parse-state (parse-partial-sexp |
| 1912 | (point) parse-limit nil nil parse-state)) | 1912 | (point) parse-limit nil nil parse-state)) |
| 1913 | (setq not-done nil)))) | 1913 | (setq not-done nil)))) |
| 1914 | ;; Result. | 1914 | ;; Result. |
| 1915 | (nth 3 parse-state)))))) | 1915 | (nth 3 parse-state)))))) |
| 1916 | 1916 | ||
| 1917 | ;; From old version. | 1917 | ;; From old version. |
| 1918 | (defalias 'fortran-auto-fill-mode 'auto-fill-mode) | 1918 | (defalias 'fortran-auto-fill-mode 'auto-fill-mode) |
| @@ -1920,17 +1920,17 @@ If ALL is nil, only match comments that start in column > 0." | |||
| 1920 | (defun fortran-fill () | 1920 | (defun fortran-fill () |
| 1921 | "Fill the current line at an appropriate point(s)." | 1921 | "Fill the current line at an appropriate point(s)." |
| 1922 | (let* ((auto-fill-function #'fortran-auto-fill) | 1922 | (let* ((auto-fill-function #'fortran-auto-fill) |
| 1923 | (opoint (point)) | 1923 | (opoint (point)) |
| 1924 | (bol (line-beginning-position)) | 1924 | (bol (line-beginning-position)) |
| 1925 | (eol (line-end-position)) | 1925 | (eol (line-end-position)) |
| 1926 | (bos (min eol (+ bol (fortran-current-line-indentation)))) | 1926 | (bos (min eol (+ bol (fortran-current-line-indentation)))) |
| 1927 | ;; If in a string at fill-column, break it either before the | 1927 | ;; If in a string at fill-column, break it either before the |
| 1928 | ;; initial quote, or at fill-col (if string is too long). | 1928 | ;; initial quote, or at fill-col (if string is too long). |
| 1929 | (quote | 1929 | (quote |
| 1930 | (save-excursion | 1930 | (save-excursion |
| 1931 | (goto-char bol) | 1931 | (goto-char bol) |
| 1932 | ;; OK to break quotes on comment lines. | 1932 | ;; OK to break quotes on comment lines. |
| 1933 | (unless (looking-at fortran-comment-line-start-skip) | 1933 | (unless (looking-at fortran-comment-line-start-skip) |
| 1934 | (let (fcpoint start) | 1934 | (let (fcpoint start) |
| 1935 | (move-to-column fill-column) | 1935 | (move-to-column fill-column) |
| 1936 | (when (fortran-is-in-string-p (setq fcpoint (point))) | 1936 | (when (fortran-is-in-string-p (setq fcpoint (point))) |
| @@ -1949,12 +1949,12 @@ If ALL is nil, only match comments that start in column > 0." | |||
| 1949 | (- fill-column 6 fortran-continuation-indent)) | 1949 | (- fill-column 6 fortran-continuation-indent)) |
| 1950 | fcpoint | 1950 | fcpoint |
| 1951 | start)))))) | 1951 | start)))))) |
| 1952 | ;; Decide where to split the line. If a position for a quoted | 1952 | ;; Decide where to split the line. If a position for a quoted |
| 1953 | ;; string was found above then use that, else break the line | 1953 | ;; string was found above then use that, else break the line |
| 1954 | ;; before/after the last delimiter. | 1954 | ;; before/after the last delimiter. |
| 1955 | (fill-point | 1955 | (fill-point |
| 1956 | (or quote | 1956 | (or quote |
| 1957 | (save-excursion | 1957 | (save-excursion |
| 1958 | ;; If f-b-b-d is t, have an extra column to play with, | 1958 | ;; If f-b-b-d is t, have an extra column to play with, |
| 1959 | ;; since delimiter gets shifted to new line. | 1959 | ;; since delimiter gets shifted to new line. |
| 1960 | (move-to-column (if fortran-break-before-delimiters | 1960 | (move-to-column (if fortran-break-before-delimiters |
| @@ -1978,13 +1978,13 @@ If ALL is nil, only match comments that start in column > 0." | |||
| 1978 | (or (looking-at fortran-no-break-re) | 1978 | (or (looking-at fortran-no-break-re) |
| 1979 | (forward-char))))) | 1979 | (forward-char))))) |
| 1980 | ;; Line indented beyond fill-column? | 1980 | ;; Line indented beyond fill-column? |
| 1981 | (when (<= (point) bos) | 1981 | (when (<= (point) bos) |
| 1982 | (move-to-column (1+ fill-column)) | 1982 | (move-to-column (1+ fill-column)) |
| 1983 | ;; What is this doing??? | 1983 | ;; What is this doing??? |
| 1984 | (or (re-search-forward "[\t\n,'+-/*)=]" eol t) | 1984 | (or (re-search-forward "[\t\n,'+-/*)=]" eol t) |
| 1985 | (goto-char bol))) | 1985 | (goto-char bol))) |
| 1986 | (if (bolp) | 1986 | (if (bolp) |
| 1987 | (re-search-forward "[ \t]" opoint t)) | 1987 | (re-search-forward "[ \t]" opoint t)) |
| 1988 | (point))))) | 1988 | (point))))) |
| 1989 | ;; If we are in an in-line comment, don't break unless the | 1989 | ;; If we are in an in-line comment, don't break unless the |
| 1990 | ;; line of code is longer than it should be. Otherwise | 1990 | ;; line of code is longer than it should be. Otherwise |
| @@ -1993,20 +1993,20 @@ If ALL is nil, only match comments that start in column > 0." | |||
| 1993 | ;; Need to use fortran-find-comment-start-skip to make sure that | 1993 | ;; Need to use fortran-find-comment-start-skip to make sure that |
| 1994 | ;; quoted !'s don't prevent a break. | 1994 | ;; quoted !'s don't prevent a break. |
| 1995 | (when (and (save-excursion | 1995 | (when (and (save-excursion |
| 1996 | (beginning-of-line) | 1996 | (beginning-of-line) |
| 1997 | (if (not (fortran-find-comment-start-skip)) | 1997 | (if (not (fortran-find-comment-start-skip)) |
| 1998 | t | 1998 | t |
| 1999 | (goto-char (match-beginning 0)) | 1999 | (goto-char (match-beginning 0)) |
| 2000 | (>= (point) fill-point))) | 2000 | (>= (point) fill-point))) |
| 2001 | (save-excursion | 2001 | (save-excursion |
| 2002 | (goto-char fill-point) | 2002 | (goto-char fill-point) |
| 2003 | (not (bolp))) | 2003 | (not (bolp))) |
| 2004 | (> (save-excursion | 2004 | (> (save-excursion |
| 2005 | (goto-char opoint) | 2005 | (goto-char opoint) |
| 2006 | (current-column)) | 2006 | (current-column)) |
| 2007 | (min (1+ fill-column) | 2007 | (min (1+ fill-column) |
| 2008 | (+ (fortran-calculate-indent) | 2008 | (+ (fortran-calculate-indent) |
| 2009 | fortran-continuation-indent)))) | 2009 | fortran-continuation-indent)))) |
| 2010 | (goto-char fill-point) | 2010 | (goto-char fill-point) |
| 2011 | (fortran-break-line) | 2011 | (fortran-break-line) |
| 2012 | (end-of-line)))) | 2012 | (end-of-line)))) |
| @@ -2014,27 +2014,27 @@ If ALL is nil, only match comments that start in column > 0." | |||
| 2014 | (defun fortran-break-line () | 2014 | (defun fortran-break-line () |
| 2015 | "Call `fortran-split-line'. Joins continuation lines first, then refills." | 2015 | "Call `fortran-split-line'. Joins continuation lines first, then refills." |
| 2016 | (let ((bol (line-beginning-position)) | 2016 | (let ((bol (line-beginning-position)) |
| 2017 | (comment-string | 2017 | (comment-string |
| 2018 | (save-excursion | 2018 | (save-excursion |
| 2019 | (if (fortran-find-comment-start-skip) | 2019 | (if (fortran-find-comment-start-skip) |
| 2020 | (delete-and-extract-region | 2020 | (delete-and-extract-region |
| 2021 | (match-beginning 0) (line-end-position)))))) | 2021 | (match-beginning 0) (line-end-position)))))) |
| 2022 | ;; Forward line 1 really needs to go to next non white line. | 2022 | ;; Forward line 1 really needs to go to next non white line. |
| 2023 | (if (save-excursion (forward-line) | 2023 | (if (save-excursion (forward-line) |
| 2024 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")) | 2024 | (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")) |
| 2025 | (progn | 2025 | (progn |
| 2026 | (end-of-line) | 2026 | (end-of-line) |
| 2027 | (delete-region (point) (match-end 0)) | 2027 | (delete-region (point) (match-end 0)) |
| 2028 | (delete-horizontal-space) | 2028 | (delete-horizontal-space) |
| 2029 | (fortran-fill)) | 2029 | (fortran-fill)) |
| 2030 | (fortran-split-line)) | 2030 | (fortran-split-line)) |
| 2031 | (if comment-string | 2031 | (if comment-string |
| 2032 | (save-excursion | 2032 | (save-excursion |
| 2033 | (goto-char bol) | 2033 | (goto-char bol) |
| 2034 | (end-of-line) | 2034 | (end-of-line) |
| 2035 | (delete-horizontal-space) | 2035 | (delete-horizontal-space) |
| 2036 | (indent-to (fortran-comment-indent)) | 2036 | (indent-to (fortran-comment-indent)) |
| 2037 | (insert comment-string))))) | 2037 | (insert comment-string))))) |
| 2038 | 2038 | ||
| 2039 | (defun fortran-analyze-file-format () | 2039 | (defun fortran-analyze-file-format () |
| 2040 | "Return nil if fixed format is used, t if TAB formatting is used. | 2040 | "Return nil if fixed format is used, t if TAB formatting is used. |
| @@ -2044,12 +2044,12 @@ before the end or in the first `fortran-analyze-depth' lines." | |||
| 2044 | (save-excursion | 2044 | (save-excursion |
| 2045 | (goto-char (point-min)) | 2045 | (goto-char (point-min)) |
| 2046 | (while (not (or | 2046 | (while (not (or |
| 2047 | (eobp) | 2047 | (eobp) |
| 2048 | (eq (char-after) ?\t) | 2048 | (eq (char-after) ?\t) |
| 2049 | (looking-at " \\{6\\}") | 2049 | (looking-at " \\{6\\}") |
| 2050 | (> i fortran-analyze-depth))) | 2050 | (> i fortran-analyze-depth))) |
| 2051 | (forward-line) | 2051 | (forward-line) |
| 2052 | (setq i (1+ i))) | 2052 | (setq i (1+ i))) |
| 2053 | (cond | 2053 | (cond |
| 2054 | ((eq (char-after) ?\t) t) | 2054 | ((eq (char-after) ?\t) t) |
| 2055 | ((looking-at " \\{6\\}") nil) | 2055 | ((looking-at " \\{6\\}") nil) |
| @@ -2110,7 +2110,7 @@ arg DO-SPACE prevents stripping the whitespace." | |||
| 2110 | (save-excursion | 2110 | (save-excursion |
| 2111 | ;; We must be inside function body for this to work. | 2111 | ;; We must be inside function body for this to work. |
| 2112 | (fortran-beginning-of-subprogram) | 2112 | (fortran-beginning-of-subprogram) |
| 2113 | (let ((case-fold-search t)) ; case-insensitive | 2113 | (let ((case-fold-search t)) ; case-insensitive |
| 2114 | ;; Search for fortran subprogram start. | 2114 | ;; Search for fortran subprogram start. |
| 2115 | (if (re-search-forward | 2115 | (if (re-search-forward |
| 2116 | (concat "^[ \t]*\\(program\\|subroutine\\|function" | 2116 | (concat "^[ \t]*\\(program\\|subroutine\\|function" |