Subject: 23.2; In fortran 90 mode, f90-indent-subprogram gets confused by bind(c) type definitions

From: James Tappin <[email-masked]>
Date: Wed, 18 May 2011 09:51:58 -0600

In fortran 90 mode, the indentation function f90-indent-subprogram does
not properly recognize type definitions with the bind(c)
property. Using tab to indent line by line does work.

I suspect that the presence of a double colon is causing the function
to think that the line is a variable declaration.

--------- Example code --------------
module demo1

  use iso_c_binding
  implicit none

  type, bind(c) :: simple_struct
  integer(kind=c_int) :: tag1
  real(kind=c_double) :: tag2
end type simple_struct

contains
subroutine s1(a)
 type(simple_struct) :: a

 print *, a%tag1, a%tag2

end subroutine s1
end module demo1
---------- END Example -------------

In GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4)
 of 2011-04-04 on crested, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11001000
configured using `configure  '--build' 'x86_64-linux-gnu' '--build'
'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var/lib'
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim'
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g'
'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: F90

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
e a l ( k i n d = c _ d o u b l e ) S-SPC : : S-SPC
t a g 2 <return> C-c C-w <return> c o n t a i n s <return>
<tab> s u b r o u t i n e SPC a 1 <backspace> <backspace>
s 1 ( a ) <return> <tab> t y p e ( s i m p l e _ s
t r i c <backspace> <backspace> u c t ) S-SPC : : S-SPC
a <return> <return> ` <backspace> <tab> p r i n t SPC
* , SPC a % t a g 1 <return> <tab> <up> <end> , SPC
a % t a g 2 <return> <return> C-c C-w C-c C-w <help-echo>
<help-echo> <down-mouse-1> <mouse-1> <help-echo> <help-echo>
<help-echo> <help-echo> <menu-bar> <F90> <Indent Subprogram>
<down-mouse-1> <mouse-1> C-x C-s C-a <up> <up> <down>
C-k C-k <down-mouse-1> <mouse-1> <return> <tab> u s
e SPC i s o _ c _ b i n d i n s <backspace> f <backspace>
g <return> <tab> i m p l i c i t SPC n o n e <return>
<help-echo> <menu-bar> <F90> <Indent Subprogram> C-x
C-s <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<f1> a i n d e <tab> <backspace> n t - s u b p r o
b <backspace> g r a m <return> <help-echo> <help-echo>
<help-echo> <down-mouse-1> <mouse-1> C-x C-w n o <backspace>
b i n d . f 9 0 <return> <down-mouse-1> <mouse-1> <backspace>
2 <down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5>
<down-mouse-5> <mouse-5> <down-mouse-1> <mouse-movement>
<mouse-1> <backspace> 2 <down-mouse-4> <mouse-4> <double-down-mouse-4>
<double-mouse-4> <triple-down-mouse-4> <triple-mouse-4>
<triple-down-mouse-4> <triple-mouse-4> <down-mouse-1>
<mouse-movement> <mouse-movement> <drag-mouse-1> C-w
<help-echo> <menu-bar> <F90> <Indent Subprogram> C-x
C-s <down-mouse-5> <mouse-5> <down-mouse-4> <mouse-4>
<double-down-mouse-4> <double-mouse-4> <help-echo>
<help-echo> M-x r e p <tab> <help-echo> <down-mouse-2>
<down-mouse-6> <mouse-6> <mouse-2>

Recent messages:
Saving file /home/james/Data/Linux/emacsbg/nbind.f90...
Wrote /home/james/Data/Linux/emacsbg/nbind.f90
Auto-saving...done
down-slightly: Beginning of buffer
Mark set
Indenting module demo2...done
Saving file /home/james/Data/Linux/emacsbg/nbind.f90...
Wrote /home/james/Data/Linux/emacsbg/nbind.f90
down-slightly: Beginning of buffer
Making completion list...

Load-path shadows:
/usr/share/emacs/23.2/site-lisp/auctex/toolbar-x hides
/usr/share/emacs/site-lisp/auctex/toolbar-x
/usr/share/emacs/23.2/site-lisp/auctex/texmathp hides
/usr/share/emacs/site-lisp/auctex/texmathp
/usr/share/emacs/23.2/site-lisp/auctex/tex hides
/usr/share/emacs/site-lisp/auctex/tex
/usr/share/emacs/23.2/site-lisp/auctex/tex-style hides
/usr/share/emacs/site-lisp/auctex/tex-style
/usr/share/emacs/23.2/site-lisp/auctex/tex-mik hides
/usr/share/emacs/site-lisp/auctex/tex-mik
/usr/share/emacs/23.2/site-lisp/auctex/tex-jp hides
/usr/share/emacs/site-lisp/auctex/tex-jp
/usr/share/emacs/23.2/site-lisp/auctex/tex-info hides
/usr/share/emacs/site-lisp/auctex/tex-info
/usr/share/emacs/23.2/site-lisp/auctex/tex-fptex hides
/usr/share/emacs/site-lisp/auctex/tex-fptex
/usr/share/emacs/23.2/site-lisp/auctex/tex-font hides
/usr/share/emacs/site-lisp/auctex/tex-font
/usr/share/emacs/23.2/site-lisp/auctex/tex-fold hides
/usr/share/emacs/site-lisp/auctex/tex-fold
/usr/share/emacs/23.2/site-lisp/auctex/tex-buf hides
/usr/share/emacs/site-lisp/auctex/tex-buf
/usr/share/emacs/23.2/site-lisp/auctex/tex-bar hides
/usr/share/emacs/site-lisp/auctex/tex-bar
/usr/share/emacs/23.2/site-lisp/auctex/multi-prompt hides
/usr/share/emacs/site-lisp/auctex/multi-prompt
/usr/share/emacs/23.2/site-lisp/auctex/latex hides
/usr/share/emacs/site-lisp/auctex/latex
/usr/share/emacs/23.2/site-lisp/auctex/font-latex hides
/usr/share/emacs/site-lisp/auctex/font-latex
/usr/share/emacs/23.2/site-lisp/auctex/context hides
/usr/share/emacs/site-lisp/auctex/context
/usr/share/emacs/23.2/site-lisp/auctex/context-nl hides
/usr/share/emacs/site-lisp/auctex/context-nl
/usr/share/emacs/23.2/site-lisp/auctex/context-en hides
/usr/share/emacs/site-lisp/auctex/context-en
/usr/share/emacs/23.2/site-lisp/auctex/bib-cite hides
/usr/share/emacs/site-lisp/auctex/bib-cite
/usr/share/emacs/23.2/site-lisp/cmake-data/cmake-mode hides
/usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs/23.2/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs23/site-lisp/dictionaries-common/ispell hides
/usr/share/emacs/23.2/lisp/textmodes/ispell
/usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides
/usr/share/emacs/23.2/lisp/textmodes/flyspell

Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils mailheader canlock sha1
hex-util hashcash mail-utils emacsbug help-mode view apropos f90
cus-edit easymenu cus-start cus-load wid-edit preview-latex tex-site
auto-loads tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win
x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode register
page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind system-font-setting
font-render-setting gtk x-toolkit x multi-tty emacs)