[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jun 15 13:08:45 1995 
Subject:Possibly useful Ved hack 
From:David S Young 
Volume-ID:950615.01 

I've found the following simple Ved hack remarkably useful.  The idea is
that the correct default for the left margin of a new line is to align
the text with the line above. So if you want an indented paragraph, you
just indent the first line and keep typing; to outdent again, you delete
a few spaces or shift the cursor left before typing the first outdented
line. When typing in code, you move the left margin in and out relative
to the previous line, rather than tabbing in from column 1. I've found
it saves time, expecially for things like ref files with lots of
different levels of indentation, though you have to get used to the
behaviour.

The code below allows ved_jp to continue to work - the first line of a
paragraph sets the left margin for that paragraph.

David Young

------------------------- help file -----------------------------------

HELP VED_SAME                                   David Young, June 1995

The command

            <ENTER> same

sets up a dynamic left margin in the current file, such that new lines
have the same left margin as the nearest line of text above them.

To revert to a static left margin, use

            <ENTER> lcol <N>

where N is the column number, or put the cursor where you want the left
margin and use

            <ENTER> lcol

------------------------- program -------------------------------------

/* Ved procedure to provide dynamic left margin */

compile_mode:pop11 +strict;

section;

define lconstant lmargin_as_above /* -> margin */;
    dlocal vedline, vedcolumn, vvedlinesize;
    ;;; Ignore current line unless doing automatic line breaking
    if iscaller(vedcharinsert) and vedline /== 1 then
        vedcharup()
    endif;
    ;;; Find a line with text on it
    until vedline == 1 or vvedlinesize /== 0 do
        vedcharup()
    enduntil;
    ;;; Return left margin for current line
    vedtextleft();
    vedcolumn - 1          ;;; returned
enddefine;

define ved_same;
    lmargin_as_above -> vedleftmargin;
    'Use <ENTER> lcol to restore normal left margin' -> vedmessage
enddefine;

endsection;