f90 indentation fix.
authorGlenn Morris <rgm@gnu.org>
Sat, 8 Oct 2011 21:52:08 +0000 (14:52 -0700)
committerGlenn Morris <rgm@gnu.org>
Sat, 8 Oct 2011 21:52:08 +0000 (14:52 -0700)
* lisp/progmodes/f90.el (f90-calculate-indent):
Give preprocessor lines before the first code statement zero indent.

Fixes: debbugs:9690

lisp/ChangeLog
lisp/progmodes/f90.el

index 611219c..1b3c22e 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-08  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/f90.el (f90-calculate-indent): Give preprocessor lines
+       before the first code statement zero indent.  (Bug#9690)
+
 2011-10-08  Chong Yidong  <cyd@stupidchicken.com>
 
        * simple.el (count-words-region): Always count in the region.
index eb33822..3d5c8a9 100644 (file)
@@ -1489,14 +1489,19 @@ Does not check type and subprogram indentation."
       (if (not (f90-previous-statement))
           ;; If f90-previous-statement returns nil, we must have been
           ;; called from on or before the first line of the first statement.
-          (setq icol (if (save-excursion
-                           ;; f90-previous-statement has moved us over
-                           ;; comment/blank lines, so we need to get
-                           ;; back to the first code statement.
-                           (when (looking-at "[ \t]*\\([!#]\\|$\\)")
-                             (f90-next-statement))
-                           (skip-chars-forward " \t0-9")
-                           (f90-looking-at-program-block-start))
+          (setq icol (if (or (save-excursion
+                               (goto-char pnt)
+                               (beginning-of-line)
+                               ;; Preprocessor line before code statement.
+                               (looking-at "[ \t]*#"))
+                             (progn
+                               ;; f90-previous-statement has moved us over
+                               ;; comment/blank lines, so we need to get
+                               ;; back to the first code statement.
+                               (when (looking-at "[ \t]*\\([!#]\\|$\\)")
+                                 (f90-next-statement))
+                               (skip-chars-forward " \t0-9")
+                               (f90-looking-at-program-block-start)))
                          0
                        ;; No explicit PROGRAM start statement.
                        f90-program-indent))