]> git.eshelyaron.com Git - emacs.git/commitdiff
(f90-calculate-indent): Fix treatment of first statement in buffer
authorGlenn Morris <rgm@gnu.org>
Sun, 24 Apr 2005 19:42:28 +0000 (19:42 +0000)
committerGlenn Morris <rgm@gnu.org>
Sun, 24 Apr 2005 19:42:28 +0000 (19:42 +0000)
(broken by 2004-11-24 change).

lisp/progmodes/f90.el

index 14363e4dccf4e330bab2116f72133aecd3be47ae..eb6db05c1590d397c0acd55be617521e26d650b4 100644 (file)
@@ -1109,9 +1109,15 @@ Does not check type and subprogram indentation."
   (let (icol cont (case-fold-search t) (pnt (point)))
     (save-excursion
       (if (not (f90-previous-statement))
-          ;; First statement in buffer.
+          ;; 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-next-statement)
+                           ;; 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.