Subject: Re: (warn) isn't doing what I expect it to
From: (Rob Warnock)
Date: Wed, 07 Sep 2005 05:20:20 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Raymond Toy  <> wrote:
| "Rob" == Rob Warnock <> writes:
| Rob> You can fix that with a (SETF *BATCH-MODE* T) in your "~/.cmucl-init"
| Rob> file. ...  Yes, it still takes *two* ^D's [why? I dunno],
| Rob> but at least it exits quietly in that case:
| This seems be be controlled by the constant lisp::eofs-before-quit,
| which is 10.  But I see no reason why this can't be a defparameter or
| something that the user could set.

Actually, in the case I was talking about, EOFS-BEFORE-QUIT doesn't come
into the picture at all. Look in the code in ".../src/code/lispinit.lisp",
in the function LISP::%TOP-LEVEL, in the COND branch controlled by the
predicate (EQL (INCF NUMBER-OF-EOFS) 1). When *BATCH-MODE* is true, a
single EOF *should* just quit... but for some odd reason it takes two.
Not 0, not 1, not LISP::EOFS-BEFORE-QUIT (10), but exactly 2.

Hmmm... I suspect it has something to do with the implementation
of READ (".../src/code/reader.lisp") and its interaction with the
the READ-CHAR and then the conditional UNREAD-CHAR. Maybe...  ;-}  ;-}

Silly thing to try [of interest only to CMUCL users]: Type the
following to the REPL *without* an ending newline:

	(read-char *standard-input* nil "BOO!")

and see how many EOFs you have to type before it says "BOO!".
In CMUCL-19a [on both Linux & FreeBSD], you have to type *three*!
[With normal Unix TTY semantics, you should only have to type *two*.]
But if you type the same thing followed by a newline, then you only
have to type one EOF. Go figure...


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607