T.R | Title | User | Personal Name | Date | Lines |
---|
794.1 | Tab => Space | CLOSET::ANKLAM | | Tue Aug 11 1987 14:38 | 11 |
|
We have had many discussions about this (most of them in the old
DOCUMENT Notes file) and it is on the list to look at for a future
release. For V1.0, all TAB characters are translated to individual
space characters.
For your purposes, you may want to skim the old Notes file; some
users had pointers to tools that will pre-process examples taken
directly from source code.
patti
|
794.2 | what are tab stop settings? | VAXUUM::KOHLBRENNER | | Tue Aug 11 1987 14:39 | 16 |
| I think there is much sympathy here for doing something
more intelligent with tabs than simply mapping them into
a single space. What to do, and the cost to do it was
not something that we could take on for V1.0.
If we try to do an expansion of tabs to multiple spaces
within <code_example>s, is it sufficient to default the
tab stops to char positions 9, 17, 25, 33, etc, or must
there be some kind of <tab_stop> tag that would set the
desired tab stops?
I suspect that we will never try to do more than we currently
do for tabs that appear in areas other than <code_example>.
bill
|
794.3 | | AUTHOR::WELLCOME | Steve | Tue Aug 11 1987 14:48 | 4 |
| I expect default 8-character tab stops are fine, at least for
the work we do here at Digital. Tabs are a real killer only
in program examples, and as far as I know those all assume
8-character tab stops. Tab support certainly would help!!!
|
794.4 | A YES Vote and an EVE Procedure | DICKNS::DENHAM | Jeff Denham, DTN 223-6770 | Wed Aug 12 1987 09:48 | 67 |
| I agree that a default of 8 with the opportunity to
<set_tabs>(4) would be a big help.
In the meantime, what follows is an EVEPLUS procedure to
eliminate tabs. It replaces tabs with spaces based on
the current tab setting. If you want 4-character tabs,
you'd set them up in EVE with the command SET TABS EVERY 4.
For people unfamiliar with EVE, here's what to do:
1. Fire up the EVE editor by typing EDIT/TPU YOUR_TABBED_FILE.SDML
2. Press the DO key and enter GET FILE TABS.TPU
3. Press DO and type EXTEND TPU * to compile the TPU code
4. Press DO and type BUFFER YOUR_TABBED_FILE (or whatever)
5. Press DO and type ELIMINATE TABS (no more tabs)
----------------------------- CUT HERE TABS.TPU -------------------------
!
! Edit History
!
! Which When Who What
!
! X00-01 26-Dec-84 JLB Created from MYSECINI.TPU
! X00-02 4-Feb-87 JMD De-EVEplus-ed; saves current pos.;
! adjusts to whatever the current
! tab setting in the buffer is
procedure eve_eliminate_tabs ! Turn TABs to spaces
local target,
old_mode,
this_buffer,
this_position,
tabs_set,
n;
on_error
message('All tabs removed.');
endon_error;
this_buffer := mark(none) ;
this_position := mark(none) ;
old_mode := get_info(current_buffer, "mode");
set(INSERT, current_buffer);
tabs_set := get_info(current_buffer,"tab_stops") ;
position(beginning_of(current_buffer));
loop
target := search(ascii(9), FORWARD);
exitif (target = 0);
position(beginning_of(target));
erase_character(1);
n := current_offset - (tabs_set * (current_offset / tabs_set));
copy_text(substr(" ", 1, tabs_set - n));
endloop;
position(this_buffer) ;
position(this_position) ;
set(old_mode, current_buffer);
endprocedure
|
794.5 | Substitute'em | GNUVAX::SJONES | | Fri Aug 14 1987 00:05 | 7 |
|
Silly thought, but isn't this overkill? You can use the EVE command
REPLACE to substitute spaces for tab characters:
Old string: <tab>
New string: <sp><sp><sp><sp>
|
794.6 | Please engage Brain | MATTER::COSCONNOLLY | Gerry with G not jerry with a J | Fri Aug 14 1987 04:45 | 8 |
| re .5
WHAT !!!!!!!!!!!!!!!!!!!!!!!!!!!
Have you tried doing that on a formatted document !!!!!!!!!!!!!!!
|
794.7 | Brain engaged, wedding planned for June | GNUVAX::SJONES | | Fri Aug 14 1987 10:33 | 15 |
| re .6
I have never used EVE to edit a formatted document, and never would,
if by "formatted document" you mean Document output.
My comment describes the way I regularly remove tab characters from code
examples in SDML source files, *before* I process those files. Note
794.4 describes another way of doing that same task, a way I felt was
unecessary given EVE's standard equipment...
As for my brain, I'm pleased to say that it is engaged and fully
functional. How's yours? ;-)
Scott
|
794.8 | glutton for punishment | 3D::BOYACK | pithy...pithy...pithy | Fri Aug 14 1987 10:43 | 9 |
| Well.... having tried substituting spaces for tabs somw time ago,
I maintain it doesn't work. Text entries at the tab stops consume
only part of the nominal eight space tab, and following text, the
tab can be anything from 1 to 8 spaces. Now toss all this into
a six or seven column table formatted in plain text with tabs,
and substitution leads to a complete mess, especially if you're
editing someone else's document and don't have a hard copy. But
don't take my word for it... try it.
|
794.9 | | CRAYON::GENT | Party gone out of bounds -- B52's | Fri Aug 14 1987 10:57 | 7 |
| There are quick ways around the 1-8 space replacement. I wrote
a procedure for use with TPU that replaces tabs with the
correct number of spaces to align the text as expected. It can
be copied from BOOKIE::DOC$TOOLS:NOTABS.TPU. Instructions are
in the comments at the beginning of the file.
--Andrew
|
794.10 | Starting over with a Clean Slate (Tab-ula rasa?) | GNUVAX::SJONES | | Fri Aug 14 1987 11:18 | 19 |
|
Okay, it's time for me to bite the bullet and
1.) Admit I'm off base
2.) Qualify maddly
You're absolutely right, tabs interspersed in lines of text are best
not substituted using EVE's REPLACE command.
My experience is mainly with leading tabs used to indent levels of
programming code in code examples. REPLACE substitutes leading tabs
okay. It's tabs that have text both to the right and to the left
of them that cause problems.
Because you never know where tabs are going to show up in code
examples, however, you should probably avoid using REPLACE altogether.
Now, that done, I'm sheepishly going to go back over my old files...
Scott
|
794.11 | Vote for some kind of tab control | STLSEE::USER | Garrett Van Siclen | Fri Aug 14 1987 15:39 | 14 |
|
Well, I'd like to put in a vote for some general tab tag. Make
it a switch for the <LINE> tag maybe. There is one place in my
current document I want to do something like this:
Item: Person Group Title
Of course I get this:
Item: Person Group Title
I would prefer not to use <CODE_EXAMPLE> or <LINEART>.
garrett
|
794.12 | | MARTY::FRIEDMAN | | Fri Aug 14 1987 16:14 | 5 |
| re. .10
Scott, you are hereby pardoned and absolved.
|
794.13 | Who's a hero | MATTER::COSCONNOLLY | Gerry with G not jerry with a J | Mon Aug 17 1987 05:14 | 5 |
| re .10 and .12
Scott, well done for owning up !!!!!!!!!!!!!!
Regards Gerry
|
794.14 | | AUTHOR::WELLCOME | Steve | Fri Aug 21 1987 13:13 | 2 |
| For all you TECO fanatics out there, AUTHOR::USER:[RTINDEX]TABFIX.TEC
substitutes spaces for tabs "correctly" (assuming 8-character tabstops).
|
794.15 | Do it right from DCL. | GLORY::STREMICK | If it ain't broke, don't fix it | Fri Aug 21 1987 17:02 | 58 |
| !
! T A B S _ T O _ S P A C E S . T P U
!
! This procedure changes all TABS in the input file to SPACES.
!
! This is very helpfull when running a document through VAX Document
! that has TABS in it. VAX Document treats TABS as SPACES, and therefore
! messes up formatted text.
!
! Use the following command to convert TABS to SPACES:
!
! $ SPACES :== "EDIT/TPU/NOSECTION/NODISPLAY/COMMAND=tabs_to_spaces.tpu"
! $ SPACES file-spec
!
! A new version of file-spec will be created that has SPACES instead of TABS.
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! This is the procedure that does all the work. Look for a TAB and replace
! it with the correct number of spaces.
!
PROCEDURE change_tabs_to_spaces
LOOP
target := SEARCH(ascii(9), FORWARD);
EXITIF (target = 0);
POSITION(BEGINNING_OF(target));
ERASE_CHARACTER(1);
n := CURRENT_OFFSET - (8 * (CURRENT_OFFSET / 8));
COPY_TEXT(SUBSTR(" ", 1, 8- n));
ENDLOOP;
ENDPROCEDURE;
!========================================================================
! Get the name of the input file and bring it into a buffer.
!
input_file := GET_INFO(COMMAND_LINE, 'file_name');
main_buffer := CREATE_BUFFER('main', input_file);
!========================================================================
! Go to the beginning of the document and then change TABS to SPACES.
!
POSITION(BEGINNING_OF(main_buffer));
change_tabs_to_spaces;
!========================================================================
! Write the file out, now with SPACES instead of TABS.
!
WRITE_FILE(main_buffer, input_file);
QUIT;
|
794.16 | An Enhancement for DCL Version? | DICKNS::DENHAM | Jeff Denham, DTN 223-6770 | Thu Aug 27 1987 14:39 | 5 |
| The advantage to the procedure in .4 is that it allows you to
choose the size of a tab stop before inserting the hard spaces.
I suppose the use-it-from-DCL TPU procedure could use an optional
parameter, n, that allows the user to specify the size of the
tabs. Otherwise, the usual size, 8, would be used.
|