mirror of
https://github.com/PDP-10/its.git
synced 2026-03-26 02:05:51 +00:00
EMACS 142 from TENEX or SUMEX or something.
This commit is contained in:
235
src/e142/page..75
Normal file
235
src/e142/page..75
Normal file
@@ -0,0 +1,235 @@
|
||||
!~Filename~:! !Commands for handling pages intelligently. -*-TECO-*-!
|
||||
PAGE
|
||||
|
||||
!& Setup PAGE Library:! !S Put macros on appropriate characters.!
|
||||
|
||||
0FO..Q PAGE_Setup_Hook[0
|
||||
fq0"G M0'
|
||||
"#
|
||||
M.M^R_Insert_Pagemark u:.X(P) !* Insert Pagemark on ^X P!
|
||||
M.M^R_Goto_Next_Page u:.X(]) !* Goto Next Page on C-X ]!
|
||||
M.M^R_Goto_Previous_Page u:.X([) !* Goto Prev Page on C-X [!
|
||||
M.M^R_Join_Next_Page u:.X(J) !* Join Pages on ^X J !
|
||||
M.M^R_Widen_Bounds u:.X(W) !* Widen Bounds on ^X W !
|
||||
M.M^R_Incremental_Search [0
|
||||
M.M^R_String_Search [1
|
||||
(q.S-q0)*(q.S-Q1)"E !* if Search is on C-S !
|
||||
q.S M.V Real_Search_Macro
|
||||
M.M^R_PAGE_Search u.S !* Then PAGE Search on C-S !
|
||||
M.M^R_PAGE_Reverse_Search u.R !* Reverse Search on C-R!
|
||||
'"# (q..S-q0)*(q..S-q1)"E !* else if Search is on M-S!
|
||||
q..S M.V Real_Search_Macro
|
||||
M.M^R_PAGE_Search u..S !* then PAGE Search on M-S !
|
||||
M.M^R_PAGE_Reverse_Search u..R !* Reverse Search on M-R !
|
||||
'"# FTCannot_find_Search!!!__Send_a_note_to_Rubenstein.''
|
||||
M.M^R_Go_To_Page U..G !* Go to page on C-X C-P !
|
||||
M.M^R_Fill_Region U...G !* Fill Region on C-M-G !
|
||||
'
|
||||
|
||||
0M.LPAGE_Flush_Crlf
|
||||
0M.LCurrent_Page
|
||||
qSet_Mode_Line_Hook[1
|
||||
:i*1 M(M.M&_Set_PAGE_Mode_Line) uSet_Mode_Line_Hook
|
||||
0fo..q TECO_ mode_ hook F"E
|
||||
M.VTECO_ mode_ hook
|
||||
:i*'u1
|
||||
:i*1
|
||||
1uPAGE_ Flush_ Crlf
|
||||
|
||||
uTECO_ mode_ hook
|
||||
|
||||
0fo..q Visit_ File_ Hookf"E
|
||||
M.VVisit_ File_ Hook
|
||||
:i*'u1
|
||||
:i*1
|
||||
M.LCurrent_Page
|
||||
0fo..q PAGE_ Flush_ Crlf M.LPAGE_Flush_Crlf
|
||||
|
||||
uVisit_File_Hook
|
||||
|
||||
0
|
||||
|
||||
!& Set PAGE Mode Line:! !S Add Page <n> onto the mode line, maybe.
|
||||
If given a string argument, appends Page <n> onto the end of the
|
||||
string, if there are buffer bounds in effect, and returns the
|
||||
new string.!
|
||||
|
||||
|
||||
qCurrent_Page"E ' !* if Current Page is 0, return argument!
|
||||
"E :i*' "#' [1 !* if no argument, cons up a blank string!
|
||||
qCurrent_Page :\ [2
|
||||
:I*1_Page_2 (]1 ]2)
|
||||
|
||||
|
||||
!^R Insert Pagemark:! !^R Insert a page mark, leaving new second page current
|
||||
Inserts a formfeed and a crlf, sets the virtual buffer
|
||||
boundaries to be the second half of the old page.!
|
||||
|
||||
13i 10i 12i !* insert a pagemark!
|
||||
qCurrent_Page"N
|
||||
%Current_Page
|
||||
0:M(M.M^R_Goto_Next_Page)'
|
||||
|
||||
!^R Goto Next Page:! !^R Make the next page current.
|
||||
Set the virtual buffer boundaries to the next page. If given
|
||||
a negative argument, goes to previous page.!
|
||||
|
||||
[0 .[1
|
||||
M(M.M^R_Set_Bounds_Full)
|
||||
qCurrent_Page"E !* if no virtual bounds then!
|
||||
FF "E 0U0' !* if no args then narrow to current page!
|
||||
0[3
|
||||
0j <%3 !* increment counter!
|
||||
qPAGE_Flush_Crlf"E
|
||||
:s
|
||||
'"#:s
|
||||
|
||||
'; !* Search for page delim, throw ifn found!
|
||||
.-3-Q1;> !* if past point then we're there!
|
||||
q3 uCurrent_Page ]3
|
||||
q1j'
|
||||
qCurrent_Page+q0 [2
|
||||
q2:"G !* if page num is not positive then!
|
||||
0M(M.M^R_Goto_Next_Page) !* set bounds to this page!
|
||||
@FENIB Fs Err' !* generate an error!
|
||||
q0 M(M.M^R_Mark_Page)
|
||||
q2 uCurrent_Page !* Update page number!
|
||||
z-."E M(M.M^R_Widen_Bounds) !* If at end (tried to go to far)!
|
||||
0M(M.M^R_Goto_Next_Page) !* Set bounds to this page!
|
||||
@FENIB FS Err' !* Generate a "NOT IN BUFFER" error!
|
||||
."'N & qPAGE_flush_Crlf"N2c' !* if not at beginning then skip crlf!
|
||||
.(W): !* exchange point and mark!
|
||||
z-."N -3c' !* if not end then back over crlf and ^L!
|
||||
M(M.M^R_Set_Bounds_Region) !* set bounds to this region!
|
||||
1:<q1J>"N BJ' !* go back to where we were if we can!
|
||||
]2 ]1 ]0
|
||||
M(M.M&_Set_Mode_Line)
|
||||
0
|
||||
|
||||
!^R Go to Page:! !^R Go to a specific page, arg is page number.
|
||||
If no arg then go to next page!
|
||||
|
||||
"L -1[0' !* Negative arg -=> Goto previous page!
|
||||
"# FF"N !* if explicit argument!
|
||||
-1[0
|
||||
M(M.M^R_Set_Bounds_Full) !* widen the bounds!
|
||||
1uCurrent_Page
|
||||
0j' !* Jump to the beginning!
|
||||
"# 1[0''
|
||||
Q0 M(M.M^R_Goto_Next_Page) !* get to the right page!
|
||||
0
|
||||
|
||||
!^R PAGE Search:! !C Search that crosses virtual buffer boundaries.
|
||||
Uses ^R Incremental Search or ^R String Search, whichever you had on C-S
|
||||
or M-S when you loaded the PAGE library. See the documentation of
|
||||
whichever search you use for details. You can change the search used by
|
||||
doing, for instance, M.M^R String Search$ u$Real Search Macro$.!
|
||||
|
||||
QReal_ Search_ Macro, @:M(M.M&_ Macro_ on_ Whole_ Buffer)
|
||||
|
||||
!& Macro on whole buffer:! !S Macros its precomma arg on the whole buffer.
|
||||
The post-comma argument and @ flag are passed on to the macro.
|
||||
If Q$Current Page$ is non-zero, then the bounds are widened, the argument
|
||||
is macroed, and the bounds are narrowed again to the current page. Thus,
|
||||
the way to do, say, a search is:
|
||||
M.M^R Incremental Search$, @M(M.M& Macro on Whole Buffer$)!
|
||||
|
||||
F F & 2 "E @FEWNA FS Err' !* if no pre-comma arg, then explode!
|
||||
qCurrent_ Page"E
|
||||
F F & 8 "N @:M()' "# :M()''
|
||||
M(M.M^R_Set_Bounds_Full)
|
||||
F F & 8 "N @M()' "# M()'
|
||||
0uCurrent_Page
|
||||
@M(M.M^R_Goto_Next_Page)
|
||||
0
|
||||
|
||||
!^R PAGE Reverse Search:! !C Reverse Search that crosses virtual buffer
|
||||
boundaries. See documentation of ^R PAGE Search for details.!
|
||||
|
||||
-1:M(M.M^R_PAGE_Search)
|
||||
|
||||
!& File Directory:! !S Returns a string pointer to the file directory!
|
||||
|
||||
.[1 0[2 0[3 0[4 [5 [6 [7 [c
|
||||
FS V Z+B "N FS Boundaries u2 u3 !* Remember if we had any bounds!
|
||||
@M(M.M^R_Set_Bounds_Full)'
|
||||
0j
|
||||
q..o [A !* remember our buffer!
|
||||
FS B Cons [B !* and make a scratch buffer!
|
||||
< .,(@f
|
||||
_ L %4 !* Advance over CRLF's, increment page no.!
|
||||
3,Q4 :\ u5
|
||||
1X6
|
||||
QPAGE_ Flush_ Crlf "E
|
||||
:S
|
||||
' "# :S
|
||||
|
||||
'uc
|
||||
qc"E zj').FS Boundaries
|
||||
M(M.MCount_Lines) u7
|
||||
4,q7 :\ u7
|
||||
qB u..o
|
||||
I5__7__6 !* Print the page number!
|
||||
qA u..O
|
||||
0,fs z FS Boundaries
|
||||
qc;>
|
||||
Q1J
|
||||
q2"N Q3, Q2 FS Boundaries'
|
||||
qb u..o HFX* (qA u..o qB FS B Kill)
|
||||
|
||||
|
||||
!Print File Directory:! !C Prints a directory of the file
|
||||
Prints out the first non-blank line on each page, preceded by its
|
||||
page number.!
|
||||
|
||||
M(M.M&_ File_ Directory) [0
|
||||
FTPage__#_Lines___First_Non-blank_Line
|
||||
0
|
||||
]0 0
|
||||
|
||||
|
||||
!Make File Directory:! !Inserts a directory of the file at the beginning
|
||||
Prints out the first non-blank line on each page, preceded by its
|
||||
page number. If given an argument, puts Q$Comment Start$ at the start
|
||||
of each line and Q$Comment End$ at the end!
|
||||
|
||||
M(M.M&_ File_ Directory) [0
|
||||
BJ
|
||||
I0
|
||||
|
||||
FF"N
|
||||
.[1 BJ
|
||||
QComment_ Start [2
|
||||
QComment_ End [3
|
||||
<G2 :L G3 2c .-q1"'L;>
|
||||
]3 ]2 ]1'
|
||||
]0 b,.
|
||||
|
||||
!^R Widen Bounds:! !^R Widen the virtual buffer bounds to include the whole file
|
||||
Calls ^R Set Bounds Full and clears the page number from the mode line.!
|
||||
|
||||
@M(M.M^R_Set_Bounds_Full) !* widen the bounds!
|
||||
0uCurrent_Page
|
||||
:M(M.M&_Set_Mode_Line)
|
||||
|
||||
|
||||
!^R Goto Previous Page:! !^R Make the previous page current.
|
||||
Set the virtual buffer boundaries to the previous page. If given
|
||||
a negative argument, goes to the next page.!
|
||||
|
||||
FF "E -1'"#-' :M(M.M^R_Goto_Next_Page) !* go do it!
|
||||
|
||||
!^R Join Next Page:! !^R Combine two pages together
|
||||
Combines this page with next. If given negative arg,
|
||||
combines previous page with this one.!
|
||||
|
||||
"L BJ
|
||||
M(M.M^R_Set_Bounds_Full)
|
||||
."E @FENIB FS Err'
|
||||
"# -3D''
|
||||
"# ZJ
|
||||
M(M.M^R_Set_Bounds_Full)
|
||||
Z-."E @FENIB FS Err'
|
||||
"# 3D''
|
||||
0M(M.M^R_Goto_Next_Page)
|
||||
0
|
||||
Reference in New Issue
Block a user