EditCommands.cm
SearchForward DoSubstitute
ClearSearchFor "xxx" ClearReplaceBy "xxx" 
SearchFor ReplaceBy SetMesaLooks
MatchText IgnoreText 
MatchLooks IgnoreLooks 
IgnoreCase MatchCase 
MatchLiterally MatchPattern 
ChangeInitCap LeaveInitCap 
SubstituteInSel SubstituteAfterSel SubstituteInEntireDoc
MatchWords MatchNodes MatchAnywhere 
EqualLooksTest SubsetLooksTest 
DoOperations DoReplace
DoTiogaOps
Put space after :
ClearSearchFor "{:}~%" ClearReplaceBy ": " IgnoreLooks MatchPattern LeaveInitCap MatchAnywhere DoReplace DoSubstitute
 
Put space after ,
ClearSearchFor "{,}@" ClearReplaceBy ", " IgnoreLooks MatchPattern LeaveInitCap MatchAnywhere DoReplace DoSubstitute
 
Put spaces around ←
ClearSearchFor "~%{←}~%" ClearReplaceBy " ← " IgnoreLooks MatchPattern LeaveInitCap MatchAnywhere DoReplace DoSubstitute
 
Change PROCEDURE to PROC
ClearSearchFor "PROCEDURE" SetMesaLooks ClearReplaceBy "PROC" SetMesaLooks MatchLooks MatchLiterally LeaveInitCap MatchWords DoReplace DoSubstitute
 
Change BOOLEAN to BOOL
ClearSearchFor "BOOLEAN" SetMesaLooks ClearReplaceBy "BOOL" SetMesaLooks MatchLooks MatchLiterally LeaveInitCap MatchWords DoReplace DoSubstitute
 
Change BEGIN END to { }
MatchLooks MatchLiterally LeaveInitCap MatchWords DoReplace ClearSearchFor "BEGIN" SetMesaLooks ClearReplaceBy "{" DoSubstitute ClearSearchFor "END" SetMesaLooks ClearReplaceBy "}" DoSubstitute
 
Nest procedure body
SelectMatchingCurlyBrackets Nest CaretBefore Join " " SetMesaLooks
 
Change { } to BEGIN END (for module body)
SelectMatchingCurlyBrackets SaveSelectionA CaretBefore MakePointSelection 1 DeleteNextChar "BEGIN" SetMesaLooks RestoreSelectionA CaretAfter MakePointSelection 1 BackSpace "END" SetMesaLooks
 
Put space after :
Put space after ,
Put spaces around ←
Change PROCEDURE to PROC
Change BOOLEAN to BOOL
Change BEGIN END to { }
ClearSearchFor "{:}~%" ClearReplaceBy ": " IgnoreLooks MatchPattern LeaveInitCap MatchAnywhere DoReplace DoSubstitute ClearSearchFor "{,}@" ClearReplaceBy ", " IgnoreLooks MatchPattern LeaveInitCap MatchAnywhere DoReplace DoSubstitute ClearSearchFor "~%{←}~%" ClearReplaceBy " ← " IgnoreLooks MatchPattern LeaveInitCap MatchAnywhere DoReplace DoSubstitute ClearSearchFor "PROCEDURE" SetMesaLooks ClearReplaceBy "PROC" SetMesaLooks MatchLooks MatchLiterally LeaveInitCap MatchWords DoReplace DoSubstitute ClearSearchFor "BOOLEAN" SetMesaLooks ClearReplaceBy "BOOL" SetMesaLooks MatchLooks MatchLiterally LeaveInitCap MatchWords DoReplace DoSubstitute MatchLooks MatchLiterally LeaveInitCap MatchWords DoReplace ClearSearchFor "BEGIN" SetMesaLooks ClearReplaceBy "{" DoSubstitute ClearSearchFor "END" SetMesaLooks ClearReplaceBy "}" DoSubstitute
 
Change { } to BEGIN END (for module body)
SelectMatchingCurlyBrackets SaveSelectionA CaretBefore MakePointSelection 1 DeleteNextChar "BEGIN" SetMesaLooks RestoreSelectionA CaretAfter MakePointSelection 1 BackSpace "END" SetMesaLooks
 
Nest procedure body
SelectMatchingCurlyBrackets Nest CaretBefore Join " " SetMesaLooks
 
Remove : FROM "..."
ClearSearchFor ": FROM \"&\"" ClearReplaceBy "" IgnoreLooks MatchCase MatchPattern MatchAnywhere DoSubstitute
 
Fix up module header
CaretBefore MakePointSelection Break 1 GoToNextNode Nest 1 GoToNextNode Nest 
 
Fix up module header
Everything CaretBefore MakePointSelection SaveSelectionA ClearSearchFor "{&&}: PROGRAM" IgnoreLooks MatchCase MatchPattern MatchAnywhere SearchForward SaveForPaste RestoreSelectionA Paste ".mesa" Break Nest "Copyright (C) 1981, 1984 Xerox Corporation. All rights reserved." Break 1 GoToNextNode Nest GrowSelection GrowSelection GrowSelection CaretAfter Break "Edited by Doug Wyatt, " Time 1 GoToNextNode Nest ClearSearchFor ": FROM \"&\"" ClearReplaceBy "" DoSubstitute RestoreSelectionA ClearSearchFor "PROGRAM" MatchLiterally SearchForward CaretBefore "CEDAR " SetMesaLooks ClearSearchFor "{" SearchForward 1 GoToNextChar SelectMatchingCurlyBrackets SaveSelectionA CaretBefore MakePointSelection 1 DeleteNextChar "BEGIN" SetMesaLooks RestoreSelectionA CaretAfter MakePointSelection 1 BackSpace "END" SetMesaLooks
 
Clean up module
ClearSearchFor "{:}~%" ClearReplaceBy ": " IgnoreLooks MatchPattern LeaveInitCap MatchAnywhere DoReplace DoSubstitute ClearSearchFor "{,}@" ClearReplaceBy ", " IgnoreLooks MatchPattern LeaveInitCap MatchAnywhere DoReplace DoSubstitute ClearSearchFor "~%{←}~%" ClearReplaceBy " ← " IgnoreLooks MatchPattern LeaveInitCap MatchAnywhere DoReplace DoSubstitute ClearSearchFor "PROCEDURE" SetMesaLooks ClearReplaceBy "PROC" SetMesaLooks MatchLooks MatchLiterally LeaveInitCap MatchWords DoReplace DoSubstitute ClearSearchFor "BOOLEAN" SetMesaLooks ClearReplaceBy "BOOL" SetMesaLooks MatchLooks MatchLiterally LeaveInitCap MatchWords DoReplace DoSubstitute MatchLooks MatchLiterally LeaveInitCap MatchWords DoReplace ClearSearchFor "BEGIN" SetMesaLooks ClearReplaceBy "{" DoSubstitute ClearSearchFor "END" SetMesaLooks ClearReplaceBy "}" DoSubstitute Everything CaretBefore MakePointSelection SaveSelectionA ClearSearchFor "{&&}: PROGRAM" IgnoreLooks MatchCase MatchPattern MatchAnywhere SearchForward SaveForPaste RestoreSelectionA Paste ".mesa" Break Nest "Copyright (C) 1983, 1984 Xerox Corporation. All rights reserved." Break 1 GoToNextNode Nest GrowSelection GrowSelection GrowSelection CaretAfter Break "Edited by Doug Wyatt, " Time 1 GoToNextNode Nest ClearSearchFor ": FROM \"&\"" ClearReplaceBy "" DoSubstitute RestoreSelectionA ClearSearchFor "PROGRAM" MatchLiterally SearchForward CaretBefore "CEDAR " SetMesaLooks ClearSearchFor "{" SearchForward 1 GoToNextChar SelectMatchingCurlyBrackets SaveSelectionA CaretBefore MakePointSelection 1 DeleteNextChar "BEGIN" SetMesaLooks RestoreSelectionA CaretAfter MakePointSelection 1 BackSpace "END" SetMesaLooks