Topic: Auto-correct 'non-conforming tab characters'

The editor settings already include options to
- Use spaces for tabs, and
- Remove excess whitespace on Save.

Unless I am mistaken, this appears not to substitute spaces for tab characters, because, although I have noth of the above selected, I am finding that all my code is riddled with compiler warnings about illegal tab characters, especially at character position 1.  I have tried to understand why this might be, and I can only assume that it must  be that, selecting the "Use spaces for tabs" option must causes the editor to enter spaces when the user enters tab characters, but does NOT mean that it makes the editor substitute spaces for tab characters already in a source file.

If I am correct then could a further option be added, to make these the three Edit options:
- Use spaces when new tabs are entered.
- Substitute spaces for existing tabs on Save.
- Remove excess whitespace on Save

---
John

Re: Auto-correct 'non-conforming tab characters'

Hhhmmm...I don't quite agree with that.  I think things are just fine the way they are.

On the one hand, I would like to split these features into behaviors and actions and say that:

  • behaviours can be permanent settings under "Options-> Editor", for as long as they only affect the manner in which current session edits are done and do not change other preexisting conditions of the file; and

  • actions can (should) be under "Edit" menu and should be on-demand activities that can potentially change the existing or preexisting contents of the file.

The slight discrepancy, here, is that Option "remove excess white space on save" can (potentially) change the preexisting condition of the file...but it does not do so in any significant manner that would change the interpretation of the source.

In particular, I am thinking make files. If I create a project, add files, generate make file, compile and then I find myself wanting to tweak the make file, as soon as I save my Makefile, the Options->Editor->Replace-Tabs would remove significant tabs that are required for the correct interpretation of the source. 

Never mind that having "Options->Editor->Use-spaces-instead-of-tabs" keeps you from creating make files from scratch, in the first place...that is a different matter.

My 2 cents.

Re: Auto-correct 'non-conforming tab characters'

Never mind that having "Options->Editor->Use-spaces-instead-of-tabs" keeps you from creating make files from scratch, in the first place...that is a different matter.

Just as a minor point, this option does not actually apply to Makefiles.  If Simply Fortran thinks you are editing a Makefile, it will always use actual tabs regardless of that editor setting.

Jeff Armstrong
Approximatrix, LLC

Re: Auto-correct 'non-conforming tab characters'

- Use spaces when new tabs are entered.
- Substitute spaces for existing tabs on Save.
- Remove excess whitespace on Save

There isn't an option to all three things above automatically.  However, all three exist as options alone.  Obviously "Use spaces when new tabs are entered" is available in the Editor Options window.

"Substitute spaces for existing tabs" is already in the Edit menu as "Convert Tabs to Spaces."  Doing this automatically seems like overkill simply because you'd only actually want to do this action once per file.  It might be nice for a large code base, I suppose, but you'd still have to load each file into the editor and re-save it even if it were automatic.

"Remove excess whitespace on save" is also already present in the Editor Options window. 

Was there a different feature you were looking for?

Jeff Armstrong
Approximatrix, LLC

Re: Auto-correct 'non-conforming tab characters'

Thanks Jeff, I simply hadn't noticed the edit menu tabs-to-spaces action.  I'd been looking only in the edit options list.  SF therefore already does what I need.

Nonetheless, it would be quite good if this facility could also be added to the edit options.

At present, it seems I need to open each source file, select the edit action, then save.
If it were an edit option then an entire project might be tidied up just by doing a clean and rebuild.
---
J.

Re: Auto-correct 'non-conforming tab characters'

gsal wrote:

I would like to split these features into behaviors and actions and say that:

  • behaviours can be permanent settings under "Options-> Editor", for as long as they only affect the manner in which current session edits are done and do not change other preexisting conditions of the file; and

  • actions can (should) be under "Edit" menu and should be on-demand activities that can potentially change the existing or preexisting contents of the file.

I like the clarity of this way of looking at edit options and menu actions.
All I was suggesting was that what I hadn't realised was already available as an edit menu action, might usefully be added under file options as an optional behaviour.

My suggestion doesn't preclude the possibility that users might prefer this option switched off, which should therefore be the default.
--
John

Re: Auto-correct 'non-conforming tab characters'

Oh, I hadn't realized that SF was smart enough to not use spaces instead of tabs in Makefiles...that's very good.

A bit more testing and I noticed that Option "remove excess white space" does take effect even if the file hadn't been modified...which helps John.  As John already said, one can do "File -> Save" on a single opened file and this Option removes excess white space.  Nevertheless, one would need to open each file and click "File -> Save"...because...

...one cannot simply open a project and click on "File -> Save All" and expect white space removal on all files just because...even after opening ALL files and clicking on "Save All", excess white space is not removed; which seems to indicate a difference in behavior between "Save" and "Save All"...

...which brings us back to John's high level macro abilities and the possibly of new menu options like "File -> Open All"... 

...Or a change in behavior of the "Save All" command to take effect even on un-opened files...I am not sure if this starts getting dangerous.

Of course, I would just go to my (Linux) command line and do:

for f in *.f90; do sed 's/\t/    /' $f > $f.notabs; mv $f.notabs $f; done

smile