[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Strange SA/NV behavior--BK is culprit



Quoting Harry Binswanger:
How about an AutoSav-like insertion of something at the top of the file?
And/or prevent a SA from being executed, without a warning, if the file
to be SAved is in the VADR directory.
The routine already does the latter (skips the backup copy if the
displayed file is located in the backup directory; in other words,
SAves once not twice in that instance). I don't like the idea of
inserting a header in the backup copy. I want my backups to be
identical to the originals. How often do you edit files in the backup
directory, anyway? If you're using the backup directory as intended,
the answer should be almost never. (The only exception would be an
UNTITLED file, after you've done SA. But there is no danger
of confusion there.)
I've rearranged the code so that default BK is set/reset only if the
backup copy is made; also, improved the BK=1 workaround.

The formal usage is unchanged:
SA [[d:\path\]new_filename]
If you're calling this frame as a subroutine in XPL, be sure S/G is explicitly zeroed out if you do not intend to SAve with a new filename:

Compare
JM 2.saQ2 ;*; SAve
with
JM 2.saQ2 ;*; SAve with new filename

XPLeNCODE v2.0
b-gin [UNTITLED]
{{;5sa}} SAve current file and make backup copy in {<}VADR{>}
 [CLD rev. 10/16/09][cr|lf]{002}{<}IF{<}VA$WS{>}==1{>}{<}SX01
,0{>}[GT_]{<}SV02,{>}{<}GT02{>}{<}SX02,{<}VA$FI{>}{>}{<}SV03,
{>}{<}IF"["{238}{<}IS02{>}==0{>}{<}SX02,{<}VA@02[;2{>}{>}{<}S
V03,!{>}{<}EI{>}{<}IF{<}IS02{>}{240}"]"{>}{<}SX02,{<}VA@02]1{
{062}}{>}{<}SV03,!{>}{<}EI{>}{<}SX04,{<}VABK{>}{>}{<}IF{<}PV04{>}
{062}0{>}[BX_]d bk=0[Q2_]{<}EI{>}{<}IF{<}IS02{>}=="UNTITLED"{>}{<
}SX02,{<}VA$WN{>}{>}{<}SX02,"UNTITLED."+{<}IS02{>}{>}{<}EI{>}
{<}SX02,{<}VADR{>}+{<}IS02{>}{>}{<}IF{<}VA|50{>}>0!{<}VA|03{>
}<1{>}[BX_]sa{<}IF{<}VA|50{>}>0{>} {<}PV50{>}{<}EI{>}[Q2_]{<}
IF{<}ER{>}{>}{<}SX01,{<}VA$ER{>}{>}{<}EI{>}[BX_]wt[Q2_]{<}EI{
{062}}{<}IF{<}IS02{>}<>{<}VA$FP{>}{>}[BX_]sa/nv {<}PV02{>}[Q2_]{<
}IF{<}ER{>}&{<}PV01{>}<1{>}{<}SX01,{<}VA$ER{>}{>}{<}EI{>}[BX_
]wt[Q2_]{<}IF{<}PV04{>}>0{>}[BX_]d bk=1[Q2_]{<}EI{>}{<}EI{>}{
<}IF{<}PV01{>}>0{>}{<}PR\@01{>}{<}EX{>}{<}EI{>}{<}PRSaved{>}{
<}EX{>}{<}EI{>}{002}[cr|lf][cr|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx