3

Trying to learn lisp (and I guess emacs along with it). I was wondering how you would go about clearing the output and replacing it. Could be in a LISP repl, or an emacs buffer.
Something akin to the following in python.

def go(r):
    for i in range(r):
        sys.stdout.write("\rDoing %i" % i)
        sys.stdout.flush()

1 Answer 1

9

For common lisp, you are looking for

Functions FINISH-OUTPUT, FORCE-OUTPUT, CLEAR-OUTPUT:

finish-output, force-output, and clear-output exercise control over the internal handling of buffered stream output.

  • finish-output attempts to ensure that any buffered output sent to output-stream has reached its destination, and then returns.

  • force-output initiates the emptying of any internal buffers but does not wait for completion or acknowledgment to return.

  • clear-output attempts to abort any outstanding output operation in progress in order to allow as little output as possible to continue to the destination.

and

Variables *DEBUG-IO*, *ERROR-OUTPUT*, *QUERY-IO*, *STANDARD-INPUT*, *STANDARD-OUTPUT*, *TRACE-OUTPUT*

  • The value of *debug-io*, called debug I/O, is a stream to be used for interactive debugging purposes.

  • The value of *error-output*, called error output, is a stream to which warnings and non-interactive error messages should be sent.

  • The value of *query-io*, called query I/O, is a bidirectional stream to be used when asking questions of the user. The question should be output to this stream, and the answer read from it.

  • The value of *standard-input*, called standard input, is a stream that is used by many operators as a default source of input when no specific input stream is explicitly supplied.

  • The value of *standard-output*, called standard output, is a stream that is used by many operators as a default destination for output when no specific output stream is explicitly supplied.

  • The value of *trace-output*, called trace output, is the stream on which traced functions (see trace) and the time macro print their output.

Emacs Lisp is quite different, you might want to start here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Output-Functions.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.