From 0812589b0507ba6cad167d99d9c50fd30384cc33 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 8 Oct 2011 14:52:08 -0700 Subject: [PATCH] f90 indentation fix. * lisp/progmodes/f90.el (f90-calculate-indent): Give preprocessor lines before the first code statement zero indent. Fixes: debbugs:9690 --- lisp/ChangeLog | 5 +++++ lisp/progmodes/f90.el | 21 +++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 611219cb5ec..1b3c22e8c73 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-10-08 Glenn Morris + + * progmodes/f90.el (f90-calculate-indent): Give preprocessor lines + before the first code statement zero indent. (Bug#9690) + 2011-10-08 Chong Yidong * simple.el (count-words-region): Always count in the region. diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index eb33822ce55..3d5c8a97835 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -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)) -- 2.39.2