]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/f90.el
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / lisp / progmodes / f90.el
index 181704f82b97325c3fbfc734740a09cfc1b944e3..dba1d6a2f9b503fefe6564ff048e92a37e8d9fa3 100644 (file)
@@ -1178,11 +1178,11 @@ and lies before point."
 
 (defsubst f90-line-continued ()
   "Return t if the current line is a continued one.
-This includes comment lines embedded in continued lines, but
-not the last line of a continued statement."
+This includes comment or preprocessor lines embedded in continued lines,
+but not the last line of a continued statement."
   (save-excursion
     (beginning-of-line)
-    (while (and (looking-at "[ \t]*\\(!\\|$\\)") (zerop (forward-line -1))))
+    (while (and (looking-at "[ \t]*\\([!#]\\|$\\)") (zerop (forward-line -1))))
     (end-of-line)
     (while (f90-in-comment)
       (search-backward "!" (line-beginning-position))
@@ -1832,11 +1832,15 @@ after indenting."
         (f90-indent-line-no)
       (setq no-line-number t)
       (skip-chars-forward " \t"))
-    (if (looking-at "!")
-        (setq indent (f90-comment-indent))
-      (and f90-smart-end (looking-at "end")
-           (f90-match-end))
-      (setq indent (f90-calculate-indent)))
+    ;; FIXME This means f90-calculate-indent gives different answers
+    ;; for comments and preprocessor lines to this function.
+    ;; Better to make f90-calculate-indent return the correct answer?
+    (cond ((looking-at "!") (setq indent (f90-comment-indent)))
+          ((looking-at "#") (setq indent 0))
+          (t
+           (and f90-smart-end (looking-at "end")
+                (f90-match-end))
+           (setq indent (f90-calculate-indent))))
     (or (= indent (current-column))
         (f90-indent-to indent no-line-number))
     ;; If initial point was within line's indentation,
@@ -1973,12 +1977,13 @@ If run in the middle of a line, the line is not broken."
           (f90-indent-to ind-curr))
       (while (and (f90-line-continued) (zerop (forward-line 1))
                   (< (point) end-region-mark))
-        (if (looking-at "[ \t]*!")
-            (f90-indent-to (f90-comment-indent))
-          (or (= (current-indentation)
-                 (+ ind-curr f90-continuation-indent))
-              (f90-indent-to
-               (+ ind-curr f90-continuation-indent) 'no-line-no)))))
+        (cond ((looking-at "[ \t]*#") (f90-indent-to 0))
+              ((looking-at "[ \t]*!") (f90-indent-to (f90-comment-indent)))
+              (t
+               (or (= (current-indentation)
+                      (+ ind-curr f90-continuation-indent))
+                   (f90-indent-to
+                    (+ ind-curr f90-continuation-indent) 'no-line-no))))))
     ;; Restore point, etc.
     (setq f90-cache-position nil)
     (goto-char save-point)