Subject: Re: bug#20680: f90.el --- indent-region errors

From: Glenn Morris <[email-masked]>
Date: Thu, 28 May 2015 02:14:45 -0400

Joris Picot wrote:

> I have trouble running M-x indent-region in whole Fortran programs with
> some Fortran 2003 features such as the module enclosed with this mail.

Thanks for the report, but please report bugs to [email-masked]
(preferably using M-x report-emacs-bug), rather than directly to me (or
anyone else whose name happens to be in a file header).

Anyway, I think this fixes it:

--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -900,9 +900,11 @@ Can be overridden by the value of `font-lock-maximum-decoration'.")
   ;; type :: word
   ;; type, stuff :: word
   ;; type, bind(c) :: word
+  ;; type, extends(stuff) :: word
   ;; NOT "type ("
   "\\_<\\(type\\)\\_>\\(?:\\(?:[^()\n]*\\|\
-.*,[ \t]*bind[ \t]*([ \t]*c[ \t]*)[ \t]*\\)::\\)?[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)"
+.*,[ \t]*\\(?:bind\\|extends\\)[ \t]*(.*)[ \t]*\\)::\\)?\
+[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)"
   "Regexp matching the definition of a derived type.")
 
 (defconst f90-typeis-re
@@ -1450,7 +1452,7 @@ if all else fails."
     (not (or (looking-at "end")
              (looking-at "\\(do\\|if\\|else\\(if\\|where\\)?\
 \\|select[ \t]*\\(case\\|type\\)\\|case\\|where\\|forall\\|\
-block\\|critical\\)\\_>")
+block\\|critical\\|enum\\)\\_>")
              (looking-at "\\(program\\|\\(?:sub\\)?module\\|\
 \\(?:abstract[ \t]*\\)?interface\\|block[ \t]*data\\)\\_>")
              (looking-at "\\(contains\\|\\(?:\\sw\\|\\s_\\)+[ \t]*:\\)")