Reply To: Tab interpretation vs Tab expand

Product Compare Forums Multi-Edit Support Tab interpretation vs Tab expand Reply To: Tab interpretation vs Tab expand

#6860
deleyd
Participant

If I understand correctly, it seems the problem is reading in other files which have tabs in them and expect the tabs to be set to every 8 characters. So, see if the following is what you want, and if so it can probably be streamlined by writing a macro.

To read in a file with tab characters and tabs set to every 8 characters:
1. Set tabs to every 8 characters for the filename extension being read in.
Tools | Customize | Filename Extensions, select your extension, click ‘Edit’, in the resulting Edit Filename Extension Setup dialog, set Tab settings mode to Use Tab and Margin settings and Tab spacing: 8

2. Then open the file.
3. Then convert all tabs to spaces:
3a. Tools | Customize | Editing, set Tab expand to spaces.
3b. Text | Convert Tabs. This will convert all tab characters to spaces, using tab spacing as every 8 which we set above.

4. Now set tabs to every 4 characters, which is what you want for normal editing.
Tools | Customize | Filename Extensions, select your extension, click ‘Edit’, in the resulting Edit Filename Extension Setup dialog, set Tab settings mode to Use Tab and Margin settings and Tab spacing: 4

Now you can edit.
And sometime in the future if you want you can convert those spaces back in to tab characters. Set Tab expand to Tabs
Tools | Customize | Editing, set Tab expand to Tabs.
Then run Tools | Convert Tabs again, and it will insert Tab characters wherever it can, keeping the indent the same by using spaces after tabs wherever necessary, using whatever Tab Spacing you’ve set. (Oh, you might want to go back and set Tab Spacing back to 8 before doing this, if that’s what.)

Now if this is what you want, then we can make a macro which does it all, so you don’t have to go wading through menus every time. I think you would leave the settings what you want for normal editing, which I think is Tabs Expand To Spaces and Tab Spacing: 4. Then we just have a macro when you want to read in a file (I’m assuming it’s of the same filename extension) you run the macro, the macro sets Tab Spacing to 8, reads in the file, performs Convert Tabs to Spaces (using tab spacing of 8), and resets Tab Spacing back to 4.

Is that what you want? Do I understand this correctly?

If so, there’s also the possibility of I think you can define pre-load and post-load macros when you load a file of a particular filename extension type, let me check; well not quite, in the Edit Filename Extension Setup dialog you can define a Post-load macro, and a Pre-Save macro; No I don’t think that will do, I think we need a pre-load macro to temporarily set tabs to 8, convert to spaces, then set tabs back to 4. Actually I’m not sure, it depends. I’ll have to try a test to find out.

Well let me know if I understand this correctly. I could probably make a macro without much trouble if that would solve your problem.

EDIT: Yes I did a test. I think a post-load macro could do it all.