Google
 

Trailing-Edge - PDP-10 Archives - mit_emacs_170_teco_1220 - emacs/wrdlst.emacs
There are no other files named wrdlst.emacs in the archive.
!* -*-TECO-*-!

!^R Forward List:! !^R Move forward past one list (or several).!
!* This and the next few commands work by moving in the direction!
!* determined by the sign of ^Y, absval(^Y) times!
    f"L W-':<"L -' flr>"n fg' 0
!^R Backward List:! !^R Move backward past one list (or several).!
    f"L W-':<"g -' flr>"n fg' 0
!^R Forward Sexp:! !^R Move forward past one S-expression (or several).!
    f"L W-':<"l -' @flr>"n fg' 0
!^R Backward Sexp:! !^R Move backward past one S-expression (or several).!
    f"L W-':<"g -' @flr>"n fg' 0
!^R Down List:! !^R Move down one level of list structure, forward.!
    f"L W-':<"l -' fdl>"n fg' 0
!^R Forward Up List:! !^R Move up one level of list structure, forward.!
    f"L W-':<"l -' ful>"n fg' 0
!^R Backward Up List:! !^R Move up one level of list structure, backward.!
    f"L W-':<"g -' ful>"n fg' 0
!^R End of Defun:! !^R Move to end of this or next defun.
Leaves the mark behind, in case typed by accident.
With argument of 2, finds end of following defun.
With argument of -1, finds end of previous defun, etc.
A defun is a list whose ( falls in column 0.
Its end is after the CRLF following its ).!
    .: .[1
    -1:S
(
    FLL L			    !* Find end of 1st defun starting before point.!
    "L 1+'.-Q1"G  O Nofwd'	    !* If that end is before starting point,!
    :0L :S			    !* or if before 1st defun,!
("L 0L FLL L'		    !* use the end of the next one instead.!
 !Nofwd!
    -1F"G FLL L'		    !* If arg>1, move past a few more defuns.!
    "L -1:S			    !* If arg<0, move back a few defuns,!
("L FLL L' "# J''		    !* Then move to end again.!
    0
!^R Beginning of Defun:! !^R Move to beginning of this or previous defun.
Leaves the mark behind, in case typed by accident.
With a negative argument, moves forward to the beginning of a defun.
The beginning of a defun is any ( in column 0.!

    .:
    -:S
(()"L "L 0' L' 0
!^R Mark Defun:! !^R Put point and mark around this defun (or next).!
    .:			    !* Leave mark behind at starting point, for loss recovery!
    .[1
    :-S				    !* Find previous CRLF(.!
("L L'			    !* If find it, go to before the (.!
      "# 1-.+BA-("E J'	    !* If none, ( at beginning of buffer counts as one.!
         "# J O Bufbeg''	    !* If we are before the first ( on column 0, go down to 1st.!
    FL+.-Q1"L			    !* If we weren't within that defun, we were!
 !Bufbeg!
      :S			    !* between defuns, so find start of following one.!
("L 0L''
    .( FLL L .: )J		    !* Mark line after the one containing the ) of the defun.!
    < B-.; -L  -(:F);	    !* Move back past one blank line, but stop at buffer beg!
      @F	_R 1A-;"N L0;'   !* and don't move back over any non-comment line.!
      >
    0
!^R Mark Sexp:! !^R Set mark 1 (or n) s-expressions from point.!
    .(  @flr .: )j 0
!^R Kill Sexp:! !^R Kill next s-expression.!
    [9 .,( @flr).F	    !* Find S-expression(s)
!   :M(M.M &_Kill_Text)	    !* and kill them !
!^R Backward Kill Sexp:! !^R Kill last s-expression.!
    -[9 .,( - @flr ).F	    !* Find S-expression(s)
!   :m (m.m &_Kill_Text)	    !* then kill them !
!^R Kill List:! !^R Kill next list.!
    [9 .,( flr).F		    !* Find List(s)
!   :M(M.M &_Kill_Text)	    !* and kill them !
!& Matching Paren:! !S After a ) has been inserted, shows the matching (.!

!* This function is kept in FS ^R PAREN when QDisplay Matching Paren
is nonzero.  If that variable is negative, we show the (
only if it is already on the screen.  The variable's absolute value
is the number of seconds to display that position
before returning the cursor to its actual location.!

!* The third slot in ..D for a closeparen character can contain the matching
openparen character, in which case we complain if any other type of
openparen matches it.!

    FS RGETTY"E 0' Q..F"E 0    !* On printing tty, or if hack disabled, just return.!'
    0:"N 0'			    !* Do nothing if input available.!
    QDisplay_Matching_Paren[1
    Q1"E 0'
    .[0  FN Q0J
    R				    !* Back over the paren.!
    < B-.; 0A*5+1:G..D-/:@; R >   !* Move back over all slash-like chars before it.!
    Q0-1-.&1"N 0'		    !* If odd number of them, don't match this paren.!
    Q0J
    0F[%TOP
    0,0A*5+2:G..D[3		    !* Which open paren should match us?!
    QPermit_Unmatched_Paren[2	    !* 0 => beep if none found.!
    F[VB
    Q2"N Q1"L FS WINDOW+BFSVB''   !* Shouldn't beep => maybe don't think past top of scrn.!
    1:< -FLL >"L Q2"E FG' 0'	    !* Find the matching (.  Give up (beep) if there is none.!
    F]VB
    Q1"L FS WINDOW+B-."G		!* if ( is off screen!
      0x1 :x2				!* get surrounding text!
      fsEcho Dis			!* clear!
      CfsEcho Dis			!* echo area!
      :@ft1|2			!* show the line to the luser!
      1fs echo active			!* so that it stays!
      0''				!* exit!
    Q3-32"N 1A-Q3"N FG''
    0@V				    !* Else display to put cursor at the (.!
    Q1*30:
    q0J 0@V
    0				    !* After delay, or when char is typed, bring cursor back.!
!^R Make ():! !^R Insert () putting point between them.
Also make a space before them if appropriate.
With argument, put the ) after the specified number
of already existing s-expressions.  Thus, with argument 1,
puts extra parens around the following s-expression.!
    .[0
    9,0Af	_
:"l		    !* If prev character not space, colon, tab, or lf!
      !"! 0,0A*5+1:G..DF('"L	    !* and not openparen or prefix syntax,!
        I_''			    !* insert a space first.!
    I( FF"N F"G@FLL''W I) .[1
    Q0J 1a-32"e c' C Q0,Q1
!^R Move Over ):! !^R Move over a ), updating indentation.
Any indentation before the ) is deleted.
LISP-style indentation is inserted after the ).!
    F[S STRING
    S) R
    @-F
_	K			    !* Delete any indentation or CRLFs before the ).!
    .[0
    C -1F"G S)'
    MM			    !* The ) should be right after the last other text.!
    @M(M.M ^R_Indent_for_LISP)	    !* Then indent after the ).!
    Q0,.

!*** HERE ARE THE WORD COMMANDS!
!^R Forward Word:! !^R Move forward over one word!
    f"L W-':<"L -' .w fwl>"n fg' 0
!^R Backward Word:! !^R Move backward over one word!
    f"L W-':<"g -' .w fwl>"n fg' 0
!^R Mark Word:! !^R Set mark 1 (or n) words from point.!
    .(  .w fwr .: )j 0
!^R Kill Word:! !^R Kill next word.!
    [9 .,(  .w fwr ).F	    !* First find them
!   :M(M.M &_Kill_Text)	    !* Then kill them !
!^R Backward Kill Word:! !^R Kill last word.!
    -[9 .,( - .w fwr ).F    !* First find them
!   :M(M.M &_Kill_Text)	    !* Then kill them !
!^R Uppercase Word:! !^R Convert one word to upper case, moving past it.
With arg, applies to that many words backward or forward.
If backward, the cursor does not move.!

    .,( :<"L -' .w fwl>w .) ff( @fc )f(j)
!^R Lowercase Word:! !^R Convert one word to lower case, moving past it.
With arg, applies to that many words backward or forward.
If backward, the cursor does not move.!

    .,( :<"L -' .w fwl>w .) ff( fc ) f(j)
!^R Uppercase Initial:! !^R Put next word in lower case, but capitalize initial.
With arg, applies to that many words backward or forward.
If backward, the cursor does not move.!

    .(
      :<			    !* # words to hack is abs val of arg.!
	"L -.w fwl'		    !* If negative arg, move back before hacking.!
	:fwl .wfwfc 1@fc	    !* Convert the word after ., leaving . before it.!
	"G .w fwl'>		    !* If positive arg, move forward after hacking.!
       ),. ff(j)		    !* Return changed region.  Don't change point if negative arg.!
!^R Uppercase Region:! !^R Convert point to mark to upper case.!
    :I*case_convertm(m.m &_Save_Region_and_Query)f"e'
    :,.f f( @fc )
!^R Lowercase Region:! !^R Convert point to mark to lower case.!
    :I*case_convertm(m.m &_Save_Region_and_Query)f"e'
    :,.f f( fc )
!^R Forward Sentence:! !^R Move to end of this sentence.
A sentence is ended by a ., ? or  followed by
two spaces or a CRLF (with optional space), with
any number of "closing characters" ", ', ) and ] between.
A sentence also ends at the end of a paragraph.!

    "L -:M(M.M ^R_Backward_Sentence)'
    0[0 [1 M.M ^R_Backward_ParagraphU2
    < @F
R				    !* Move over CRLFs so we don't find same blank line again!
	.-Q0:"L .[1 -M2W	    !* If advance past end of paragraph,!
	        0@f"e 2r'	    !* find next end of paragraph.!
		.u0 Q1J'
	< .,Q0:FB

.?!+1@; ;		    !* Look at periods, ?s and excls,!
				    !* (also stopping at end of line before a blank line)!
	  @F)]"'R		    !* until we find one followed (after some closing-chars)!
	  :S
	  ___
	  +3;>		    !* by spaces/ CRLF!
        > FKC 0		    !* Stop BEFORE those spaces/CRLF, or before the two CRLFS!
!^R Backward Sentence:! !^R Move to beginning of sentence.
A sentence is ended by a ., ? or  followed by
two spaces or a CRLF (with optional space), with
any number of "closing characters" ", ', ) and ] between.
A sentence also starts at the start of a paragraph.!

    "L -:M(M.M ^R_Forward_Sentence)'
    Z[0 [1 M.M ^R_Backward_ParagraphU2
    < @-F
_)]"'R
	.-Q0:"G .U1 1M2W	    !* Q0 gets start of para.  Old value may still be good.!
	        :@f"e l'
		.U0 Q1J'
	< @-F
_)]"'R	R			    !* Move over end of last S so we don't find it again.!
	  .,Q0:FB

.?!(:)+1;		    !* Look at periods, ?s and excls, going backward,!
	!** (stopping at beg of buffer, or after a blank line)!
	  @F)]"'R		    !* until we find one followed by 0 or more close-chars!
	  :S
	  ___
	  +3;>		    !* and then by spaces or CRLF.!
	>
    @F_R 0			    !* Stop right before 1st char of sentence.!
!^R Mark Sentence:! !^R Put point at beginning and mark at end of sentence.
If you are between sentences, the following sentence is used
unless you are at the end of a paragraph.!

    0@F"N :@F"E		    !* If point is at end of nonblank line,!
      QPage_Delimiter[1
'		  FQ1:"Gf:I1ge Delim is null, a null string would lose!
				    !* in the S command, but a ^M is just redundant.!
      QParagraph_Delimiter[2
12@L .-(:S0L))"N   !* the next line separates paragraphs,!
        .:
	1M(M.M^R_Backward_Sentence)'''	    !* mark the sentence before point.!
    1 M(M.M ^R_Forward_Sentence)   !* Normally, mark the sentence after point.!
    @F_R @:F"E L'
    .:
    :1 M(M.M ^R_Backward_Sentence)
!^R Kill Sentence:! !^R Kill forward to end of sentence.
Accepts numeric argument of either sign.!

    [9
    .,( M(M.M ^R_Forward_Sentence)
        .)f:M(M.M &_Kill_Text)
!^R Backward Kill Sentence:! !^R Kills back to beginning of sentence.
Accepts numeric argument of either sign.!

    -[9			    !* indicate that this killing is "backwards"!
    .,(m(m.m ^R_Backward_Sentence)	    !* Find beginning of sentence.!
       .)f:m(m.m &_Kill_Text)	    !* Kill back to there.!
!^R Forward Paragraph:! !^R Move forward to end of paragraph.
See documentation on ^R Backward Paragraph.!
    -:m( m.m ^R_Backward_Paragraph)
!^R Backward Paragraph:! !^R Move backward to start of paragraph.
Paragraphs are delimited by blank lines or by lines which
start with a delimiter in Paragraph Delimiter or in Page Delimiter.
If there is a fill prefix, any line that doesn't start with it
starts a paragraph.
Lines which start with ".", "\", "-", "@" or "'", if that
first character is matched by Paragraph Delimiter, count as
blank lines in that they separate paragraphs and are not part of them.!

    qParagraph_Delimiter[0
    qPage_Delimiter[1
    0fo..qFill_Prefix[2
    0s 1  0 		    !* Search for para delim or page delim, or nothing.!
    "l 0@l'			    !* Move in reverse to line-beginning if not at one.!
    "# 0@f"n @l''

!* Note: we won't stop before line we start at, because Q3 is initially 1.!

    [3 [4 [5
    <			    !* As many times as wanted, find next P.   is ABS!
      1u3 0u5
      < q3u4			    !* Q4 is 1 if previous line was "blank".!
	0u3 :@f"e 1u3'	    !* Q3 gets 1 if this line is blank!
	fq2:"g			    !* No fill prefix => if line starts with a delimiter,!
	  !"! 0,1af
.@-\':"l    !* then if it's .@-\' this line is "blank".!
	    .-(s.(0l))"l 1u3'''
	q3"n q4"e q5-1"g 0;' :;'' !* Stop at first "blank" line we see, if we've gone > 1!
				    !* or are going forward.!
	%5
        "g :rw 0@l b-.;'	    !* Advance one line.!
	"l @l .-z; q3"n !<!>''    !* Don't stop, going fwd, on line after "blank" line.!
	fq2"g			    !* if there is a fill prefix,!
	  :@f"n fq2f~2:@;'' !* stop if the line doesn't start with it.!
	"# .-(s.(0l))"l	    !* No fill prefix => if line starts with a delimiter,!
	  !"! 0,1af
.@-\':;''   !* and it's not .@-' or \, stop.!
	> >

    "g q3"n q4"e @L''		    !* If we stopped moving backwards under a line that!
         -@F-2"E -@L''	    !* is really empty, include it as well.!
    0
!^R Mark Paragraph:! !^R Put point and mark around this paragraph.
In between paragraphs, puts it around the next one.  See documentation
on ^R Backward Paragraph for paragraph definition.!
    m.m ^R_Backward_Paragraph [0
    0l				    !* If we are at end of last line of para, mark that para!
    -m0			    !* Find next paragraph end.  It is end of the one we want.!
    .[1
    m0			    !* Find other end of that paragraph.!
    .,q1fu1j q1: 0	    !* Put point at front, mark at end.!
!^R Zap to Character:! !^R Kills text up to a target character.
Does not find immediate next char.  Does not kill target char.
Argument means kill up (or back for neg arg) to nth char.
Quote key () works for kill to , help key, or , and it 
preserves case.!

	[1[2
	.[p			    !* Save the point!
	ff"E1U1 1U2'"#f(U1)/Q1U2'

	M.I FI f([d) f"A#40.'[c	    !* character argument, up and low.!
	Qc-"E		    !* ^Q => !
         1F[NOQUIT		    !*   Turn off ^G !
	 FSOSTECO"N -1F[HELPCHAR' !*   and help key (on twenex)!
         M.I FI f(Uc)Ud'	    !*   and reread.!

	Q2[9
        Q1<Q2C Q2@:fcdL>
	.-z"E :i*Not Found @fg QpJ '
	"#Qp,.FM(M.M&_Kill_Text)'  !* kill & put in the kill ring!
	.,.
!^R Reverse Zap to Character:! !^R Calls ^R Zap to Character with neg. arg.!

  -1*(F):M(M.M ^R_Zap_to_Character)
!^R Delete Horizontal Space:! !^R Delete all spaces and tabs around point.!

    @-f_	k		    !* Delete all tabs/spaces before point.!
    @f_	k		    !* Delete all tabs/spaces after point.!
    0
!^R Just One Space:! !^R Delete whitespace, then insert ARG spaces.
Uses the current definition of the space character.!

    @m(m.m^R_Delete_Horizontal_Space) f
    f@:m_
!^R Change Font Word:! !^R Puts the previous word in a different font (R).
The font to change to is specified with a numeric argument.
No arg means move last font change forward past next word.
A negative arg means move last font change back one word.!

!* ^].W before each FW takes care of Atom Word Mode.!

    FF"N +1"G		    !* Positive arg => put ^Farg ... ^F* around prev. word.!
      Z-.[0 .W-FWL .[1 I \ .WFWL I* Z-Q0J Q1,.''
    .[0 :CW :-S"E 0'	    !* Find previous font change (no-op if none).!
    .[2 2FX*[1		    !* Remove it, remembering what and where it was.!
    "L			    !* negative arg => move to previous word-end.!
      [4
      -2:.WFWL .[3
      Q2,.-2:FB"L		    !* If that would move back over another font-change,!
	2F=*"E 2FX4	    !* If stationary one is ^F*, move them both together.!
	  :i141'
        "# F=1*"E 2D .,Q2'	    !* Else if moving one is ^F*, flush them both.!
	   2D''			    !* ^F2 moving back over ^F1, flush the ^F1.!
      Q3-."L Q3J'
      G1 .-FQ1,Q2+2'
    Q0-2J .WFWL .U0		    !* No arg => move to next word-end.!
    Q2,.+2:FB"L		    !* moving over some other font change =>!
      0A-*"E -2D Q2,.'	    !* flush it, and if it's ^F* flush this one too.!
      -2D Q0-2U0'
    Q0J G1
    Q2,.
!^R Change Font Region:! !^R Puts the region in a different font (R).
The font to change to is specified with a numeric argument.
Inserts ^F<n> before and ^F* after.
A negative arg removes font changes in or next to region.!

    [0 [1  .,(W.)fu1u0	    !* Q0 gets region start, Q1 gets region end.!
    +1"g
      q0j i \		    !* Insert the change into the spec'd font at front.!
      q1+2j i*		    !* Insert pop-font at end.!
      .u1'			    !* Make Q0,Q1 describe region including font changes.!
    "l			    !* With negative arg, take out font changes.!
      q1j 0,1a-"e 2d'	    !* Remove any font-change right after the region.!
      q0j 0,0a-"e %0'
      q0j 0,-1a-"e -2d .u0 q1-2u1'	    !* Remove any font change right before region.!
      q0j <.,q1:fb;		    !* Remove font changes inside region.!
	   -dd q1-2u1> q1j'
    q0:			    !* Set mark at front, now that we are at end.!
    q0,q1			    !* Return range pointing to region.!
!^R Underline Word:! !^R Puts underlines around the previous word (R).
If there is an underline begin or end near that word,
it is moved forward one word.
An argument specifies the number of words, and the direction:
positive means forward.
Underline Begin and Underline End may be set to the strings
or characters to be used to begin and end underlines.!

    0FO..Q Underline_Begin QB"E UB'
    0FO..Q Underline_End QE"E UE'
    .[0
    Z-.[9 FF"E FN Z-Q9-.F"G C''	    !* Don't in any case move point back thru the text!
    :FWL .,(1:<-2:FWL>"L J'
     .):FBBE"E	    !* No underline begin or end in or near prev. word =>!
      Q0J
      FF"N ' "# -1'[1	    !* put them around -1 or arg words.!
      Q1"L Q1FWL .U0 IB -Q1FWL IE'
      "# IB Q1FWL IE'
      Q0,.'			    !* put underlines around it.!
    FKFX*[1 .[2		    !* Found one before this word => flush it but remember it!
    .,( 1:<"L -'1+:FWR>"L "L J' "# ZJ''
     .):FBBE"L	    !* If it's going to move over or next to another begin or end,!
      FKF=1[3 FKD	    !* flush that one,!
      Q3"N Q2,.''		    !* and if they are different flush them both.!
    Q2J "L:-1+'FWL I1	    !* Move it <arg> words.  If backwds, to end of word.!
    "L .+FK,Q2-FK'
    Q2,.
!^R Underline Region:! !^R Puts underlines a la R around the region.
A negative argument removes underlines in or next to region.
Underline Begin and Underline End may be set to the strings
or characters to be used to begin and end underlines.!

    0FO..Q Underline_Begin QB"E UB'
    0FO..Q Underline_End QE"E UE'
    [0 [1  .,(W.)fu1u0	    !* Q0 gets region start, Q1 gets region end.!
    +1"g
      q0j iB		    !* Insert start-underline front.!
      q1j fkr iE		    !* Insert end-underline at end.!
      .u1'
    "l			    !* With negative arg, take out underlinings.!
      q1j :fwl z-.u1
      q0j -:fwl <.,z-q1:fbBE; fkd> z-q1u1 q1j'
    q0:			    !* Set mark at front, now that we are at end.!
    q0,q1			    !* Return range pointing to region.!