It sometimes happes that one get Fortran 77 code that was edited in another editor. Depending on how tabs and spaces are handled, an import in Plato can mean that many lines are not within the 72 character limit. Furthermore, a line break can also be a problem.

In case of a few lines it is no problem to do it by hand. Is there perhaps some trick a method to get the code correct in case of a few thousand lines?

Plato already has some smart indenting when typing Fortran.
Constructs such as DO etc. auto-indent provided you select "Automatic block indentation" from the Options dialog under Text Editor and General.

Thanks for the tips. What possibilities do I have to rearrange the code when I "import" source code that was not edited from the begining with Plato. The code that I am working on originated in the time before PC's. The over 10 000 lines of code is not "organised" which makes reading it extremely difficult. Luckily all the carination characters are in the correct column!

In the Options dialog under Environment and Keyboard, you will find an entry Edit.ReplaceTabs. This is set to Ctrl+Shift+T on my machine but I do not remember if this is the default.

You can use this when you first open a file but make sure that your tab size for fixed Fortran is set correctly before you do this.

If you want to remove the tabs in all the files in one go then you could write a little Fortran program to do this. Alternatively you could experiment with the Plato macro recorder but it probably isn't clever enough to handle this task. Another editor like Word for Windows or Visual Studio might manage it via a macro.

Plato already has some smart indenting when typing Fortran.
Constructs such as DO etc. auto-indent provided you select "Automatic block indentation" from the Options dialog under Text Editor and General.

If you want to reduce the indentation then press SHIFT and ENTER.

I get auto-indentation of DO even though I don't have that option checked!? On the other hand, I can't make any sense of SHIFT-ENTER at all, whether I have the option checked or not. If I select some lines and hit S-E, they just get deleted. If I place the cursor at the start of a line and hit S-E, I get a new blank line and the original line doubles its original indentation. How is it supposed to work?

I agree with Johann, improving the indentation would be a really good thing to do. All it would require would be assigning a keystroke combination to the existing menu item. Having to navigate to the third level of the menu with the mouse, to achieve one space of indentation per navigation, is extremely inefficient.

When I type a line that starts with for (ML equivalent of do) all subsequent lines are indented until I enter an end, which is outdented to line up with the do. Similarly for if (although I suspect you'd really need to check for the the "then")

The ML editor also has a "clean up the indenting" option where I can type ctrl/a ctrl/i (select all and auto indent) which "does the right thing" for the whole file.

I realize that fortran is a little more complex than the matlab language and that none of this is a trivial task (else it would have been done long ago) but it's a goal worth aiming for.

The auto indent is always on for Fortran and it has the effect of providing additional indentation (when pressing ENTER) after lines beginning with DO, IF etc.

If you press SHIFT+ENTER there is no indentation.

For fixed Fortran you get extra help in the label field etc.

This was the best I could do with the time available. I can put this on the wish list if you want to tell me how it could be improved.

Paul - sorry, but I'm having trouble understanding what you are saying here, relative to what you said before.

Are you agreeing that the Tools-Options -Text Editor-General "Automatic block indentation" setting has no effect on FORTRAN source code? This is certainly how it seems to me, but it's different to what (I thought) you were saying earlier in the thread.

I also misunderstood what you meant about Shift-Enter until just before I hit Send. Then I read it again and a potential light went on. But it still doesn't behave as I (currently) understand you to mean: if I enter a DO line of source code and hit Shift-Enter rather than simply Enter, not only do I get no indentation, I get outdentation (new line starts two spaces to the left of the DO rather than two spaces to the right). Again, this is true whether or not I have the Text Editor-General setting checked.

As to wish list ... most of the Plato menu items seem to have keyboard shortcuts. Edit-Advanced-Increase/Decrease Indentation are unusual in not doing so, and I'm not sure why - they seem to me to be more deserving candidates than many, because they only work one space at a time and thus usually need to be iterated more than once. Provision of a keyboard shortcut for these two menu items would be on my wish list - but since I'm not paying maintenance at the moment, you'd need independent support for the suggestion.

The Matlab editor is also what I have in mind. There you can mesh up the code indentation and afterwords select an option to "smart indent" it again. The need for such an option can arise, among others, in the following situations:
1.) import code from another text editor and
2.) when one copy some code into a if-statement or do-loop.

However, the Matlab editor has some disadvantage (at least in my memory). Once you used the latest editor you cannot go back to the previous one (without getting some problems). This would be a problem in Fortran since we have to cope with all the language developments. I think that it will be really tricky to "fix" some code if one mixes the syntax.

The free code converters form Metcalf and Allan works OK, but not really as I would like it to work. Anyway, it will be difficult to find some editor that can do everthing. Plato works fine for me and I quite often use it instead of Wordpad or Notebook for "general" purpose tasks!

Without wanting to create a new wave of ed discussions, the editor I use has block mode which is good for re-doing indenting. ( ed 4 windows )
Lots of us forum participants use different editors, which we are very loyal to. There are many posts on this issue.

I think you can redefine the indent size in Allan Miller's program, but it does come with a lot of other reformatting baggage (which can be very useful if you are, like me, a supporter of implicit none). In the end, it is not too hard to write your own program for limited indenting.