all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8691: 23.2; In fortran 90 mode, f90-indent-subprogram gets confused by bind(c) type definitions
@ 2011-05-18 15:51 James Tappin
  2011-05-18 19:10 ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: James Tappin @ 2011-05-18 15:51 UTC (permalink / raw)
  To: 8691

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)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8691: 23.2; In fortran 90 mode, f90-indent-subprogram gets confused by bind(c) type definitions
  2011-05-18 15:51 bug#8691: 23.2; In fortran 90 mode, f90-indent-subprogram gets confused by bind(c) type definitions James Tappin
@ 2011-05-18 19:10 ` Glenn Morris
       [not found]   ` <BANLkTinR-j4b5jHD=q_+rtXCeZMQwXeggQ@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2011-05-18 19:10 UTC (permalink / raw)
  To: James Tappin; +Cc: 8691


Hello, I think this patch fixes it. You can test it with:

(setq f90-type-def-re "...value-from-patch...")


*** lisp/progmodes/f90.el	2011-02-04 03:21:11 +0000
--- lisp/progmodes/f90.el	2011-05-18 19:09:26 +0000
***************
*** 809,816 ****
    ;; type word
    ;; type :: word
    ;; type, stuff :: word
    ;; NOT "type ("
!   "\\<\\(type\\)\\>\\(?:[^()\n]*::\\)?[ \t]*\\(\\sw+\\)"
    "Regexp matching the definition of a derived type.")
  
  (defconst f90-typeis-re
--- 809,818 ----
    ;; type word
    ;; type :: word
    ;; type, stuff :: word
+   ;; type, bind(c) :: word
    ;; NOT "type ("
!   "\\<\\(type\\)\\>\\(?:\\(?:[^()\n]*\\|\
! .*,[ \t]*bind[ \t]*([ \t]*c[ \t]*)[ \t]*\\)::\\)?[ \t]*\\(\\sw+\\)"
    "Regexp matching the definition of a derived type.")
  
  (defconst f90-typeis-re






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8691: 23.2; In fortran 90 mode, f90-indent-subprogram gets confused by bind(c) type definitions
       [not found]   ` <BANLkTinR-j4b5jHD=q_+rtXCeZMQwXeggQ@mail.gmail.com>
@ 2011-05-18 21:21     ` Glenn Morris
  2011-05-18 21:38       ` James Tappin
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2011-05-18 21:21 UTC (permalink / raw)
  To: James Tappin; +Cc: 8691


(Please keep 8691@debbugs included)

James Tappin wrote (on Wed, 18 May 2011 at"15:05 -0600):

> Thanks for the quick response. Unfortunately it's not clear to me
> how to use the patch: I've tried pasting the command and patch into
> the *Scratch* buffer and using "Evaluate defun" without any success.
> Also as far as I can see Ubuntu only provides the compiled emacs
> lisp files (*.elc) or I'd have made a copy and applied the patch.

sudo apt-get install emacs23-el

is probably the right command to get the Lisp sources.

However, rather than patching, it's probably easier to add to your
.emacs:

(eval-after-load "f90"
  '(setq f90-type-def-re "\\<\\(type\\)\\>\\(?:\\(?:[^()\n]*\\|\
.*,[ \t]*bind[ \t]*([ \t]*c[ \t]*)[ \t]*\\)::\\)?[ \t]*\\(\\sw+\\)"))

which should have the same effect.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8691: 23.2; In fortran 90 mode, f90-indent-subprogram gets confused by bind(c) type definitions
  2011-05-18 21:21     ` Glenn Morris
@ 2011-05-18 21:38       ` James Tappin
  0 siblings, 0 replies; 4+ messages in thread
From: James Tappin @ 2011-05-18 21:38 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 8691

On 18 May 2011 15:21, Glenn Morris <rgm@gnu.org> wrote:
>
> (Please keep 8691@debbugs included)
>
> However, rather than patching, it's probably easier to add to your
> .emacs:
>
> (eval-after-load "f90"
>  '(setq f90-type-def-re "\\<\\(type\\)\\>\\(?:\\(?:[^()\n]*\\|\
> .*,[ \t]*bind[ \t]*([ \t]*c[ \t]*)[ \t]*\\)::\\)?[ \t]*\\(\\sw+\\)"))
>
> which should have the same effect.
>

Thanks Glenn,
That works on the test file, and on the original "problem" file.

James





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-18 21:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-18 15:51 bug#8691: 23.2; In fortran 90 mode, f90-indent-subprogram gets confused by bind(c) type definitions James Tappin
2011-05-18 19:10 ` Glenn Morris
     [not found]   ` <BANLkTinR-j4b5jHD=q_+rtXCeZMQwXeggQ@mail.gmail.com>
2011-05-18 21:21     ` Glenn Morris
2011-05-18 21:38       ` James Tappin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.