Google
 

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

!^R Other Window:! !^R Switch to the other window.
In two-window mode, moves cursor to other window.
In one-window mode, exchanges contents of visible window
with remembered contents of (invisible) window two.
An argument means switch windows but select the same
buffer in the other window.!

    0FO..QWindow_2_Buffer"E
	:I*O1B	Only_One_Window FS ERR'
    MMM_&_Check_Top_Levelwindows
    [Previous_Buffer		    !* Don't set Previous Buffer to buffer of window we leave.!
    Q..O UOther_Window_Buffer
    0FO..QWindow_2_Size"E	    !* If only 1 window now, but second has existed,!
	.( QBuffer_Name( FS WINDOW(	    !* Then select window 2's buffer in existing window!
	  QWindow_2_BufferM(M.M Select_Buffer)
	  QWindow_2_Point:J
	  QWindow_2_Window FS WINDOW
	 ) UWindow_2_Window	    !* And put this window's old buffer into!
	 ) UWindow_2_Buffer	    !* (now invisible) window 2!
	 ) UWindow_2_Point
	'
    [1 [2
    FS TOP LINE"E
      :I2 1 :I1 2		    !* Q1 gets window switching to, Q2 gets window being left.!
      QWindow_1_Size+1FS Top Lin
      QWindow_2_SizeFS Lines'
    "#
      :I2 2 :I1 1
      0FS Top Lin
      QWindow_1_SizeFS Lines'
    QBuffer_NameUWindow_2_Buffer
    .UWindow_2_Pointer
    FS WINDOW UWindow_2_Window
    FF"E QWindow_1_BufferM(M.M Select_Buffer)
        QWindow_1_Pointer:J
	QWindow_1_WindowFSWINDOW'
    
!^R View Two Windows:! !^R Show two windows but stay in first.!
    1, M(M.M ^R_Two_Windows)
!^R Two Windows:! !^R Show two windows and select window two.
An argument > 1 means give window 2 the same buffer as in Window 1.
A pre-comma argument means keep the cursor in window 1.!

    0FO..QWindow_2_Size"N
	:I*A2W	Already_Two_Windows FS ERR'
    fs rgetty"e
        :I*TTY	You_are_on_a_printing_terminalFS ERR'
    MMM_&_Check_Top_Levelwindows
    [Previous_Buffer		    !* Don't set Previous Buffer to buffer of window we leave.!
    QBuffer_Name M.V Window_1_Buffer
    Q..O M.V Other_Window_Buffer
    FS WINDOW M.V Window_1_Window
    . M.V Window_1_Pointer
    FSLINES M.VDefault_Size
    FS LINESF"E
	FS HEIGHT-(fs Top Line)-(FS ECHO LINES)-1 ' M.V Total_Size
    0FO..Q Window_2_Buffer"E	    !* If never have had window 2 as yet,!
        QTotal_Size/2 M.V Window_1_Size  !* Make window 2 hold same buffer as window 1,!
	0FO..Q Tags_Find_File"N  o Same'
	-1"N  o Same'
	"N :I*W2 m(m.m &_Create_Buffer)' !* or make it hold W2.!
	:I*W2 M.V Window_2_Buffer  o W2'
    -1"N
      !Same!
        QBuffer_Name M.V Window_2_Buffer
      !W2!
        . M.V Window_2_Pointer	    !* Arg => Window 2 gets same buffer as window 1.!
	FS Window M.V Window_2_Window'
    QWindow_1_Size[0
    QTotal_Size-1-Q0:"G	    !* If old window 1 size is unreasonable, fix it up.!
      QTotal_Size/2U0 Q0UWindow_1_Size'
    1F[NOQUIT
    QTotal_Size-1-Q0 M.V Window_2_Size
    FS REFRESHM.V Window_1_Refresh
    M.M &_Multi-window_Refresh FS REFRESH
    "N Q0 FS LINESW
         Q:.B(QWindow_2_Buffer M(M.M &_Find_Buffer)+4!*bufbuf!) M.V Other_Window_Buffer
	 F]NOQUIT
	 M(FS REFRESH)W '	    !* If cursor should stay in top window, display bottom one.!
    Q0 FS TOP LINE		    !* Else, draw the line of dots, and switch into bottom!
    :FT  FS WIDTH/10<FT----------> 0U..H !* window, causing it to be displayed.!
    -1FS TYPEOUT
    0FS TOP LINE
    F]NOQUIT
    :M(M.M ^R_Other_Window)
!^R One Window:! !^R Display only one window.
Normally, we display what used to be in the top window,
but a numeric argument says to display what was in the bottom one.!

    0FO..QWindow_2_Size"E
	:I*O1B	Only_One_Window FS ERR'
    MMM_&_Check_Top_Levelwindows
    [Previous_Buffer		    !* Don't set Previous Buffer to buffer of window we leave.!
    FS TOP LIN"N		    !* If we're in window 2 now,!
	M(M.M^R_Other_Window)'	    !* switch to window 1.!
    0UWindow_2_Size		    !* Put us officially in one window mode.!
    0FS Top Line
    QDefault_Size FS LINES
    QWindow_1_Refresh FS REFRESH
    FF"N
	:M(M.M ^R_Other_Window)'   !* With arg, stay in what used to be window 2.!
    
!& Multi-window Refresh:! !S Redisplay the screen when there are two windows.!

    QWindow_1_RefreshF"N[1 M(Q1(]1))'	    !* Execute the global FS REFRESH if any.!
    FS QP PTR
    0F[REFRESH
    .[1  FN q1j  [1  [2
    FS TOP LINE"N		    !* Temporarily TECO-select the other window!
      QWindow_1_SizeF[LINES 0F[TOP LINE
      :I2 1'
    "# QWindow_2_SizeF[LINES QWindow_1_Size+1F[TOP LINE
       :I2 2'
    QWindow_2_WindowF[WINDOW   !* but don't take the time for an EMACS buffer switch.!
    QWindow_2_Point:J
    QOther_Window_Buffer[..O
    -1F[D FORCE		    !* Don't abort this display due to typeahead.!
    0U..H @V			    !* Now redisplay that window.!
    0FS LINES			    !* Now redisplay the line of stars across the middle.!
    QWindow_1_SizeFS TOP LIN
    :FT  FS WIDTH/10<FT---------->
    -FSTYPEOUTW 0U..H
    QPFS QP UNWIND W

!* Note that we fall off the end, with all qregs popped by the FS QP UNWIND.!
!* This is so that other things can be consed onto the end of FS REFRESH.!
!^R Grow Window:! !^R Make this window (or minibuffer) use more lines.
Argument is number of extra lines (can be negative).!
    Q..F-Q.F"N FS LINES"E FG 0'  !* If not at top level, try to extend minibuffer.!
				    !* Complain if uses whole screen.!
	   FS LINES+FS LINES
	   M(FS REFRESH) W'
    0FO..QWindow_2_Size"E	    !* Else if only one window, can't grow it.!
	:I*O1B	Only_One_Window FS ERR'
    [1 FS TOP LIN[0
    Q0"E -Q1U1'			    !* Q1 gets # lines window 2 is growing by.!
    QWindow_1_Size-Q1-1"L  O LOSE'
    QWindow_2_Size+Q1 F"G UWindow_2_Size'
      "#  !LOSE!
         :I*Windows_need_at_least_one_line FSERR'
    QWindow_1_Size-Q1 UWindow_1_Size    !* Adjust both sizes!
    Q0"E
       QOther_Window_Buffer[..O   !* if in window 1, temporarily teco-select window 2!
       QWindow_2_Window F[Window !* but don't do the EMACS buffer switch.!
       .[P  FN QPJ
       QWindow_2_Point:J'
    .( 1:< FS WINDOW+BJ	    !* Adjust w2's FS WINDOW for lines!
	   -Q1F"G :' "# @' ,0FM	    !* it is gaining or losing at the top.!
	   .-BFS WINDOW>W )J
    Q0"E FS WINDOW UWindow_2_Window
         -4 FS QP UNWIND'	    !* pop back to actual current window.!
    Q0"E FS LINES+ FS LINES'
    "# FS TOP LINE- FS TOP LINE !* Also adjust TECO window settings.!
       FS LINES+ FS LINES'
    :M(FS REFRESH)
!^R Scroll Other Window:! !^R Scroll other window up several lines.
Specify the number as a numeric argument, negative for down.
The default is a whole screenful up.  Just Meta-Minus as argument
means scroll a whole screenful down.!

    0FO..QWindow_2_Size"E
      :I*O1B	Only_One_Window FS ERR'
    .[1  FN q1j  [1  [2
    QOther_Window_Buffer[..O
    FS TOP LINE"N		    !* Now TECO-select the other window,!
      QWindow_1_SizeF[LINES 0F[TOP LINE
      :I2 1'
    "# QWindow_2_SizeF[LINES QWindow_1_Size+1F[TOP LINE
       :I2 2'
    QWindow_2_WindowF[WINDOW   !* but don't take the time for an EMACS buffer switch.!
    QWindow_2_Point:J
    -1F[DFORCE			    !* Don't stop this display for type-ahead.!
    FS ^R ARGP-5"E		    !* Handle just Meta-minus as argument.!
      @M(M.M ^R_Previous_Screen)'
    "# F@M(M.M ^R_Next_Screen)'
    0@V
    .UWindow_2_Point
    FS WINDOW UWindow_2_Window
    
!^R Visit in Other Window:! !^R Find buffer, tag or file in other window.
Follow this command by B or C-B and a buffer name,
F or C-F and a file name, or T or . and a tag name.
We find the buffer, tag or file in the other window,
creating the other window if necessary.!

    0fo..Q Window_2_Size"e	    !* If not in 2 window mode, enter it.!
      2m(m.m ^R_Two_Windows)'
    "# 2m(m.m ^R_Other_Window)'    !* Else go to other window.!
    1fstypeoutw m.i fi:fc[1	    !* Make ^X4 echo if we pause, but prevent redisplay.!
    -1fstypeout		    !* Make ? now not print on same line as dashes.!
    q1f*B"g :m(m.m Select_Buffer)'
    q1f*F"g :m(m.m Find_File)'
    q1f*T."g :m(m.m ^R_Find_Tag)'
    :fg 0