(FILECREATED "28-Oct-87 20:47:04" {ERINYES}<LISPUSERS>KOTO>TEDIT-CLOSE-ON-SHRINK.;2 3073   

      changes to:  (VARS TEDIT-CLOSE-ON-SHRINKCOMS)

      previous date: " 3-Aug-87 18:04:54" {QV}<BRIGGS>LISP>TEDIT-CLOSE-ON-SHRINK.;1)


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

(PRETTYCOMPRINT TEDIT-CLOSE-ON-SHRINKCOMS)

(RPAQQ TEDIT-CLOSE-ON-SHRINKCOMS [(FNS \TEDIT-CLOSE-ON-SHRINK)
	(DECLARE: DONTEVAL@LOAD DOCOPY
		  (P (if (GETD (QUOTE TEDIT))
			 then
			 [PUTPROP (QUOTE TEDIT.CREATEW)
				  (QUOTE READVICE)
				  (QUOTE (NIL (AFTER NIL (if [NOT (MEMB (QUOTE \TEDIT-CLOSE-ON-SHRINK)
									(WINDOWPROP !VALUE
										    (QUOTE SHRINKFN]
							     then
							     (WINDOWADDPROP !VALUE (QUOTE SHRINKFN)
									    (QUOTE 
									   \TEDIT-CLOSE-ON-SHRINK]
			 [PUTPROP (QUOTE \TEDIT.CREATEW.FROM.REGION)
				  (QUOTE READVICE)
				  (QUOTE (NIL (AFTER NIL (if [NOT (MEMB (QUOTE \TEDIT-CLOSE-ON-SHRINK)
									(WINDOWPROP !VALUE
										    (QUOTE SHRINKFN]
							     then
							     (WINDOWADDPROP !VALUE (QUOTE SHRINKFN)
									    (QUOTE 
									   \TEDIT-CLOSE-ON-SHRINK]
			 [PUTPROP (QUOTE \TEDIT.REOPEN.STREAM)
				  (QUOTE READVICE)
				  (QUOTE (NIL (AFTER NIL (replace (TEXTOBJ TXTFILE)
								  of
								  (TEXTOBJ TEXTSTREAM)
								  with !VALUE]
			 (READVISE TEDIT.CREATEW \TEDIT.CREATEW.FROM.REGION \TEDIT.REOPEN.STREAM)
			 (SETQ ADVISEDFNS (LDIFFERENCE ADVISEDFNS (QUOTE (TEDIT.CREATEW 
								       \TEDIT.CREATEW.FROM.REGION 
									     \TEDIT.REOPEN.STREAM])
(DEFINEQ

(\TEDIT-CLOSE-ON-SHRINK
  [LAMBDA (teditWindow)                                      (* N.H.Briggs " 3-Aug-87 17:24")
    [LET* ((textObj (TEXTOBJ teditWindow))
	   (backingStream (fetch (TEXTOBJ TXTFILE) of textObj)))
          (if (NOT (fetch (TEXTOBJ \DIRTY) of textObj))
	      then (AND backingStream (CLOSEF? backingStream]
    T])
)
(DECLARE: DONTEVAL@LOAD DOCOPY 
[if (GETD (QUOTE TEDIT))
    then
    [PUTPROP (QUOTE TEDIT.CREATEW)
	     (QUOTE READVICE)
	     (QUOTE (NIL (AFTER NIL (if [NOT (MEMB (QUOTE \TEDIT-CLOSE-ON-SHRINK)
						   (WINDOWPROP !VALUE (QUOTE SHRINKFN]
					then
					(WINDOWADDPROP !VALUE (QUOTE SHRINKFN)
						       (QUOTE \TEDIT-CLOSE-ON-SHRINK]
    [PUTPROP (QUOTE \TEDIT.CREATEW.FROM.REGION)
	     (QUOTE READVICE)
	     (QUOTE (NIL (AFTER NIL (if [NOT (MEMB (QUOTE \TEDIT-CLOSE-ON-SHRINK)
						   (WINDOWPROP !VALUE (QUOTE SHRINKFN]
					then
					(WINDOWADDPROP !VALUE (QUOTE SHRINKFN)
						       (QUOTE \TEDIT-CLOSE-ON-SHRINK]
    [PUTPROP (QUOTE \TEDIT.REOPEN.STREAM)
	     (QUOTE READVICE)
	     (QUOTE (NIL (AFTER NIL (replace (TEXTOBJ TXTFILE)
					     of
					     (TEXTOBJ TEXTSTREAM)
					     with !VALUE]
    (READVISE TEDIT.CREATEW \TEDIT.CREATEW.FROM.REGION \TEDIT.REOPEN.STREAM)
    (SETQ ADVISEDFNS (LDIFFERENCE ADVISEDFNS (QUOTE (TEDIT.CREATEW \TEDIT.CREATEW.FROM.REGION 
								   \TEDIT.REOPEN.STREAM]
)
(PUTPROPS TEDIT-CLOSE-ON-SHRINK COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1550 1955 (\TEDIT-CLOSE-ON-SHRINK 1560 . 1953)))))
STOP