21.10. Function `EXT:ELASTIC-NEWLINE`
Prev | Chapter 21. Streams | Next

## 21.10. Function `EXT:ELASTIC-NEWLINE`

The function `(`EXT:ELASTIC-NEWLINE` [`stream`])` is like `FRESH-LINE` but the other way around: It outputs a conditional newline on `stream`, which is canceled if the next output on `stream` happens to be a newline. More precisely, it causes a newline to be output right before the next character is written on `stream`, if this character is not a newline. The newline is also output if the next operation on the stream is `FRESH-LINE`, `FINISH-OUTPUT`, `FORCE-OUTPUT` or `CLOSE`.

The functionality of `EXT:ELASTIC-NEWLINE` is also available through the `FORMAT` directive `~.`.

A technique for avoiding unnecessary blank lines in output is to begin each chunk of output with a call to `FRESH-LINE` and to terminate it with a call to `EXT:ELASTIC-NEWLINE`.

See also Section 21.6, “Newline Convention”.

| These notes document CLISP version 2.45 | Last modified: 2008-05-14

Enter your search termsSubmit search form
Webclisp.cons.orgclisp.podval.orgwww.lisp.org

Prev | Up | Next
21.9. Function `FILE-POSITION` | Home | 21.11. Function `OPEN`