(FILECREATED " 7-May-86 12:56:53" {QV}<NOTECARDS>1.3K>FGHPATCH034.;2 4118   

      changes to:  (VARS FGHPATCH034COMS)
		   (FNS NC.TEditPutFn)

      previous date: " 7-May-86 12:12:14" {QV}<NOTECARDS>1.3K>FGHPATCH034.;1)


(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT FGHPATCH034COMS)

(RPAQQ FGHPATCH034COMS ((* * Fixes Bug # 31 -- TEDIT.PUT asks for FileName twice. FROM NCTEXTCARD)
			  (FNS NC.TEditPutFn)))
(* * Fixes Bug # 31 -- TEDIT.PUT asks for FileName twice. FROM NCTEXTCARD)

(DEFINEQ

(NC.TEditPutFn
  (LAMBDA (TextStream FileName When?)                        (* fgh: " 7-May-86 12:55")

          (* * This function designed to be attached to the PUTFN Tedit property of NC textstreams.)



          (* * Before actions: Mark the card dirty for NoteCards, if TEdit thinks the card is dirty. Also, change the link 
	  icons to be ExternalPut Link Icons so that thety are no longer active in the file being put to.
	  Necessary when a put is done outside the normal NoteCards mechanism.)



          (* * fgh 5/7/86 Added kludge to get around bug in TEDIT.PUT that causes FileName to be NIL most of the time.
	  Submitted AR #5621 about TEDIT.PUT bug. Also added scheme to temporarily set the TEXPROP CACHE in order to prevent 
	  TEDIT.PUT from updating the file info in the piece table.)


    (SELECTQ When?
	       (BEFORE (PROG ((TextObj (TEXTOBJ TextStream))
				LinkIcons)

          (* * Kludge to get around bug in TEDIT.PUT described in AR #5621. Note the OFILE is called freely!!!)


			       (SETQ FileName (COND
				   (FileName (FULLNAME (PACKFILENAME (QUOTE VERSION)
									 NIL
									 (QUOTE BODY)
									 FileName
									 (QUOTE VERSION)
									 NIL)
							 (QUOTE NEW)))
				   (T (FULLNAME OFILE (QUOTE NEW)))))

          (* * first Mark the card dirty NoteCards style, if necessary)


			       (COND
				 ((TEDIT.STREAMCHANGEDP TextStream)
				   (NC.MarkCardDirty (NC.CardFromTextStream (TEXTSTREAM 
										       TextStream)))))
			       (RESETLST 

          (* * Remove this PUTFN from the TEXTOBJ temporarily)


					   (RESETSAVE (TEXTPROP TextObj (QUOTE PUTFN)
								    NIL)
							(BQUOTE (TEXTPROP , TextObj PUTFN ,
									      (TEXTPROP
										TextObj
										(QUOTE PUTFN)))))

          (* * Collect all the link icons in the TextStream)


					   (SETQ LinkIcons (TEDIT.LIST.OF.OBJECTS
					       TextObj
					       (FUNCTION NC.LinkIconImageObjP)))

          (* * Temporarily set them to be ExternalPut link icons)


					   (RESETSAVE (NC.TEditPutFnAuxiliary LinkIcons 
								   NC.ExternalPutLinkIconImageFns)
							(BQUOTE (NC.TEditPutFnAuxiliary , 
											LinkIcons , 
									      NC.LinkIconImageFns)))

          (* * Fix up the title on the way out)


					   (RESETSAVE NIL (BQUOTE
							  (AND , (WINDOW.FROM.TEDIT.THING 
										       TextStream)
								 (WINDOWPROP , (
									  WINDOW.FROM.TEDIT.THING
										 TextStream)
									       (QUOTE TITLE)
									       ,
									       (NC.RetrieveTitle
										 (
									    NC.CardFromTextStream
										   TextStream))))))

          (* * Temporarily set TEdit to think this is CAHCEd so that the piece table doesn't get messed up.)


					   (RESETSAVE (TEXTPROP (TEXTOBJ TextStream)
								    (QUOTE CACHE)
								    T)
							(BQUOTE (TEXTPROP , (TEXTOBJ TextStream)
									      CACHE ,
									      (TEXTPROP
										(TEXTOBJ TextStream)
										(QUOTE CACHE)))))

          (* * Put the file as usual. NOTE: FORCENEW UNFORMATTED? OLDFORMAT? used freely!!!!)


					   (TEDIT.PUT TextStream FileName FORCENEW UNFORMATTED? 
							OLDFORMAT?))
			       (RETURN (QUOTE DON'T))))
	       NIL)))
)
(PUTPROPS FGHPATCH034 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (544 4036 (NC.TEditPutFn 554 . 4034)))))
STOP