changeset 61810:ab4b241ac836

(f90-calculate-indent): Fix treatment of first statement in buffer (broken by 2004-11-24 change).
author Glenn Morris <rgm@gnu.org>
date Sun, 24 Apr 2005 19:42:28 +0000
parents f83775915bd2
children d15bf442151d
files lisp/progmodes/f90.el
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/f90.el	Sun Apr 24 19:41:45 2005 +0000
+++ b/lisp/progmodes/f90.el	Sun Apr 24 19:42:28 2005 +0000
@@ -1109,9 +1109,15 @@
   (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.