Hi Eric,
Below is a macro I use from time to time that, I think, does what you want.
It uses the TSE macro cmpfiles to compare the changed file to a copy
of that file from disk.
--- Manual compare ----
Note that this can be done manually fairly easily .
1) Make and save temporary copy of changed file from copy still on
disk. ( Note: doing this external to TSE from command line or with
file browser will assure you that you are getting copy from disk.)
2) Use TSE macro cmp2disk.s to compare files (note: if the disk copy
and changed copy are open in two TSE windows, TSE compares them
without having to enter their file names)
--- Fred's cmp2disk.s macro ---
I created it a long time ago and there are details I dont recall
without more study than I have done recently... Also I would do some things
differently if I were writing it today...
I use the Linux version of TSE and there are some Linux specific aspects...
I have a file ~/l/tmp/on-disk-file that gets overwritten by a copy of the
file that has been changed from disk. There is a symlink called ~/c2d
to ~/l/tmp/on-disk-file I think that this was to give a short
path/filename of the copy from disk.
Maybe you could modify it for your system.
Sorry, it it surely wont work for you as is.
I've appended a copy of the short macro at the end.
Fred
// --- Fred Olson's macto cmp2disk.s
// Steps:
// fetch filename of current file
//open ~/l/tmp/on-disk-file, delete all , insert prev current file, save
//call cmpfiles macro and compare file to c2d
//If diff wanted, should be kept, save file manually.
// Else close file w/o saving
proc main()
string curfile[80]
integer filebuf
if FileChanged()
Warn('Current file has changed, locate changes, compare it to "c2d" ')
curfile=CurrFilename()
filebuf=GetBufferID() BegFile()
// Open temporary file:
editfile("/home/fholson/l/tmp/on-disk-file.txt")
// delete any contents in temporary file:
BegFile() MarkLine() EndFile() BegLine() MarkLine() Cut()
// Put contents of unchanged file in disk in temporary file:
InsertFile(CurFile) unmarkBlock() savefile()
// go back to changed file and compare it to temp file:
GotoBufferID(filebuf)
if FileExists("/home/fholson/c2d")
pushkeystr("/home/fholson/c2d")
// pushkey(<d>) pushkey(<2>) pushkey(<c>)
execMacro("cmpfiles")
// Note. if changes show by cmpfiles macro are desired, save file
// If none of changes are desired, abandon file
// If some are and some aren't, fix one of them.
else warn("Link ~/c2d does not exist ")
warn("Create it now by copy/pasting command below and try again. ")
warn("ln -s ~/l/tmp/on-disk-file.txt ~/c2d ")
endif
else Warn("Current file has not changed from copy on disk")
endif
end
--
Fred H. Olson Minneapolis,MN 55411 USA (near north Mpls)
Email: fholson at
cohousing.org 612-588-9532
My Link Pg:
http://fholson.cohousing.org