[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Oct 16 15:51:59 1993 
Subject:Long lines in email and news (Was: Garbage Collection etc) 
From:Aaron Sloman 
Volume-ID:931016.05 

 Anthony.Worrall@Reading.ac.uk writes (in response to one of Helen's
messages):

> PS. can we have an occasional newline in text :-).

Alas there are some crummy mail sending programs (and editors) that
make it look to the user as if they have inserted linebreaks when
they have not really done so. When they send mail to be read by
others the paragraphs arrive with no line breaks, and (in VED) you
have to use something like "ENTER jp" insert line breaks.

There are also inconsiderate people who type email and news broadcasts
in wide windows not realising that some people (e.g. with dumb terminals
or emulations) are restricted to 80 columns, and therefore have trouble
reading their messages. (Which is why the usenet convention is to
use considerably less than 80 column width, to allow for subsequent
quoting.)

Someone recently asked for a program to "wrap" long lines in VED, and I
sent out one to do it for a whole file.

Below is a potentially more useful version that does it only for the
marked range. It has the advantage over ved_j, and ved_jp that it
doesn't join any lines to previous lines, which can screw up email
headers. It merely inserts breaks.

Aaron

-----------------------------------------------------------------------

;;; Install as $poplocal/local/auto/ved_wrapmr.p
;;; Aaron Sloman, The University of Birmingham, Sat Oct 16 1993

;;; Install help file as $poplocal/local/help/ved_wrapmr
/*
HELP VED_WRAPMR                                Aaron Sloman October 1993

ENTER wrapmr

This command will "wrap" all long lines in the marked range in the
current VED buffer.

Long lines are defined in relation to the current value of the
variable * vedlinemax (which can be less than the window width,
determined by * vedscreenwidth).

vedlinemax can be set conveniently using ENTER rcol. See * ved_rcol.

ved_wrapmr works by repeatedly marking a line at a time and using
* ved_j to insert line breaks.

*/

define ved_wrapmr;
    ;;; wrap marked range
    lvars oldlo = vvedmarklo, oldhi = vvedmarkhi;

    dlocal vvedmarkprops;   ;;; make new marks temporarily invisible
    vedmarkpush();
    false -> vvedmarkprops;

    vedputmessage('PLEASE WAIT -- BREAKING LONG LINES');
    ;;; save current location
    vedpositionpush();

    ;;; get end of range location to be on * vedpositionstack, so that the
    ;;; location is automatically updated when preceding lines are broken
    vedendrange();
    vedpositionpush();

    vedjumpto(oldlo, 1);

    ;;; Now 'justify' each line, by breaking it.
    repeat
    ;;; stop if at end of original marked range
    quitif(vedline > vedpositionstack(1)(1));
        ;;; mark and 'justify' the current line
        vedmarklo(); vedmarkhi(); ved_j();
        ;;; go to next line
        vedchardown();
    endrepeat;
    ;;; return to original location
    vedpositionpop();
    vedmarkpop();
    vedputmessage('DONE');
enddefine;
--
Aaron Sloman,
School of Computer Science, The University of Birmingham, B15 2TT, England
EMAIL   A.Sloman@cs.bham.ac.uk  OR A.Sloman@bham.ac.uk
Phone: +44-(0)21-414-3711       Fax:   +44-(0)21-414-4281