   )
 
 
-(defun modified-buffers-exist() 
+(defun modified-buffers-exist()
   "This function will check to see if there are any buffers
 that have been modified.  It will return true if there are
 and nil otherwise. Buffers that have buffer-offer-save set to

      (message "Opening frame on display: %s" display)
      (select-frame (make-frame-on-display display '((window-system . x)))))
    
    ;; Save the current frame.  
    (setq new-frame (selected-frame))


    ;; When displaying the number of clients and frames: 
    ;; subtract 1 from the clients for this client.
    ;; subtract 2 from the frames this frame (that we just created) and the default frame.
    (when ( or (not active-clients-or-frames)
	       (yes-or-no-p (format "There are currently %d clients and %d frames. Exit anyway?" (- (length server-clients) 1) (- (length (frame-list)) 2)))) 
      
      ;; If the user quits during the save dialog then don't exit emacs.
      ;; Still close the terminal though.
      (let((inhibit-quit t))
        ;; Save buffers
	(with-local-quit
	  (save-some-buffers)) 
	      
	(if quit-flag
	    (setq quit-flag nil)  
          ;; Kill all remaining clients
	  (progn
	    (dolist (client server-clients)
	      (server-delete-client client))
	    ;; Exit emacs
	    (kill-emacs))) 
	))

    ;; If we made a frame then kill it.

    (setq modified-buffers (modified-buffers-exist))
    (setq active-clients-or-frames ( or (> (length server-clients) 1)
					(> (length (frame-list)) 1)
					))

    ;; Create a new frame if prompts are needed.
    (when (or modified-buffers active-clients-or-frames)
