f90.el matching END statements

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

f90.el matching END statements

Salvatore Filippone
Dear All,
I have recently run into an issue with f90.el, version 26.2
distributed with fedora 30.
The issue is with the autocompletion feature; Fortran 2008 has
introduced submodules; among the changes entailed by this, it is now
possible to have a piece of code like the following:
--------------------
  interface
    module subroutine foo(bar)
      integer  :: bar
    end subroutine foo
  end interface
---------------------
Now, if I hit TAB on the first "end" the autocompletion feature tries to insert
   end module subroutine
which is wrong, whereas I would like to insert
   end subroutine foo

I have found a fix for this. I changed file f90.el:1385-1386  from
-------------
   ((and (not (looking-at "module[ \t]*procedure\\_>"))
         (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>"))
--------------
to
--------------
   ((and (not (or
           (looking-at "module[ \t]*procedure\\_>")
           (looking-at "module[ \t]*subroutine\\_>")))
         (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>"))
---------------
and I got the desired behaviour.
It is quite possible that somebody on this list will have a better
solution, but this does the job.

Hope this helps
Salvatore Filippone

Reply | Threaded
Open this post in threaded view
|

Re: f90.el matching END statements

Stefan Kangas
Salvatore Filippone <[hidden email]> writes:

> I have recently run into an issue with f90.el, version 26.2
> distributed with fedora 30.
> The issue is with the autocompletion feature; Fortran 2008 has
> introduced submodules; among the changes entailed by this, it is now
> possible to have a piece of code like the following:

I suggest that you file a bug report for this, to ensure that it
eventually gets followed up.  You can use M-x report-emacs-bug or send
an e-mail to [hidden email] with the same contents as your
message to this list.

> I have found a fix for this. I changed file f90.el:1385-1386  from
> -------------
>    ((and (not (looking-at "module[ \t]*procedure\\_>"))
>          (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>"))
> --------------
> to
> --------------
>    ((and (not (or
>            (looking-at "module[ \t]*procedure\\_>")
>            (looking-at "module[ \t]*subroutine\\_>")))
>          (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>"))
> ---------------

If you could include this as a patch file attached to your e-mail,
that would be helpful.  If you don't know how to do that, the above
code fragment is also fine.

Best regards,
Stefan Kangas