Atom-beautify: Fortran beautifier automatically UPPERCASE - not required

Created on 25 Sep 2016  路  9Comments  路  Source: Glavin001/atom-beautify

Description

In the past, all Fortran source files were written in UPPERCASE, but ever since Fortran 90 this hasn't been required. Having a bunch of UPPERCASE keywords thrown around your sources can get unnecessarily noisy - is there a possibility of adding an opt-out feature to this?

Example

Currently, beautified code would look like this:

PROGRAM sample

  IMPLICIT NONE
  INTEGER:: ii

  DO ii = 1, 10, 1
     PRINT(6, *) ii
  END DO

END PROGRAM sample

However, having source in lower case is also valid, and is less intense on the eyes:

program sample

  implicit none
  integer:: ii

  do ii = 1, 10, 1
    print(6, *) ii
  end

end program sample

I don't know lisp, but it looks like the upper-case-ifying is occuring on line 44 of emacs-fortran-formating-script.lisp. Is there a way of putting an opt-out/-in feature in the atom-beautify settings for this behavior?

question stale

All 9 comments

As a secondary question: how does the beautifier actually work? I'm interested in adding support for fixed-form Fortran source files as well (related issue #544) - it doesn't seem like a terribly difficult task.

Due to the fact that .f77 is such a different file type than .f90 and above, would two separate beautifiers need to be created, or can you specify based on the file extension within the same beautifier?

Seems like @janbernloehr is the local fortran expert - any thoughts on these issues?

  1. Yes we can do that by generating the Lisp config on the fly according to user settings.
  2. I am pretty sure that f77 files are supported by emacs as well.

I am very busy at the moment but if you would like to create a PR, I will definitely have a look into it.

I'm not sure where to start, but I would like to learn. Is there a beautifier that has this functionality that I could expand on?

The current implementation is using emacs. To start I would run the emacs against your f77 files.

This is the command I am supposed to run?

emacs -batch -l ~/.emacs-batch-f90-indent -f f90-batch-indent-region file.f

I don't know where '.emacs-batch-f90-indent' is.

This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.

Its quite easy to fix. go to settings => atom beautify => view code
Then to src/beautifiers/fortran-beatuifier/emacs ...
just delete the line which has uppercase keywords in it.
Maybe this should go into the published version

Its quite easy to fix. go to settings => atom beautify => view code
Then to src/beautifiers/fortran-beatuifier/emacs ...
just delete the line which has uppercase keywords in it.
Maybe this should go into the published version

It is better to change it to (f90-downcase-keywords) and it works well

Was this page helpful?
0 / 5 - 0 ratings