;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:8; Patch-File:T -*-
;;; Patch file for System version 123.276
;;; Reason:
;;;  ZMACS will now let you kill the last buffer -- it will generate a new
;;;  empty buffer for you to use.
;;; Written 11-May-88 19:46:22 by pld (Peter L. DeWolf) at site Gigamos Cambridge
;;; while running on Azathoth from band 3
;;; with Experimental System 123.275, Experimental Local-File 73.5, Experimental FILE-Server 22.5, Experimental Unix-Interface 11.0, Experimental KERMIT 34.3, Experimental ZMail 71.2, Experimental Lambda-Diag 15.0, Experimental Tape 22.4, microcode 1756, SDU Boot Tape 3.14, SDU ROM 8, the old ones.



; From file DJ: L.ZWEI; ZMACS.LISP#572 at 11-May-88 19:46:23
#8R ZWEI#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "ZWEI")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: ZWEI; ZMACS  "

(DEFUN READ-BUFFER-NAME (PROMPT DEFAULT &OPTIONAL IMPOSSIBLE-IS-OK-P
			 (BUFFER-HISTORY (SEND *WINDOW* :BUFFER-HISTORY)))
  "Read a buffer name in the mini buffer and return a buffer.
DEFAULT is the default to use; T means use most recent buffer other than the current one.
PROMPT is a string to prompt with; should end in a colon if you want one.
IMPOSSIBLE-IS-OK can be T, NIL or MAYBE.
 T means create a new buffer if name does not complete.
 ZWEI:MAYBE means do so, but user must type Return twice to confirm.
 NIL means don't allow names that don't complete, at all.
BUFFER-HISTORY is a history object containing buffers.
 It defaults to *WINDOW*'s buffer history."
  (AND (EQ DEFAULT T)	; Select most recent buffer other than this one
       (SETQ DEFAULT (PREVIOUS-BUFFER)))
  (AND DEFAULT
       (SETQ PROMPT (STRING-APPEND PROMPT
				   " ("
				   (BUFFER-NAME DEFAULT)
				   " ... c-sh-F to specify filename)")))
  (AND DEFAULT
       (PATHNAME-DEFAULTS *PATHNAME-DEFAULTS* DEFAULT))	;In case of C-Shift-F.
  (LET* ((*READ-BUFFER-KLUDGE* T)
	 (*MINI-BUFFER-DEFAULT-STRING* (if default (BUFFER-NAME DEFAULT)))
	 (*COMPLETING-DELIMS* '(#/Space #/- #/. #/\ #// #/#))
	 (*MINI-BUFFER-VALUE-HISTORY* BUFFER-HISTORY)
	 (NAME (COMPLETING-READ-FROM-MINI-BUFFER PROMPT *ZMACS-BUFFER-NAME-ALIST*
						 IMPOSSIBLE-IS-OK-P)))
    (COND ((EQUAL NAME "") (SETQ NAME DEFAULT))
	  ((CONSP NAME) (SETQ NAME (CDR NAME))))		;Existing buffer
    (COND ((AND (NULL NAME) (NOT IMPOSSIBLE-IS-OK-P))
	   ;;She didn't type a name, no default was given, and we can't create one
	   (BARF))
	  ((OR (NULL NAME) (STRINGP NAME))
	   (FORMAT *QUERY-IO* "~&(New Buffer)")
	   (SETQ NAME (APPLY 'CREATE-ONE-BUFFER-TO-GO (IF NAME (NCONS NAME)))))
	  (T
	   (SEND *QUERY-IO* :FRESH-LINE)))
    NAME))	;which by now is a buffer

))
