anchor.diff:            editor-io-stream
             make-editor-io-stream))
   
  -(defclass buffer-output-stream (trivial-gray-streams:fundamental-output-stream)
  +(defclass buffer-stream (trivial-gray-streams:fundamental-stream)
     ((marker
       :initarg :marker
  -    :accessor buffer-output-stream-marker)
  -   (interactive-update-p
  +    :accessor buffer-stream-marker)))
  +
  +(defclass buffer-input-stream (buffer-stream)
  +  ((unread-char
  +    :initform nil
  +    :accessor buffer-input-stream-unread-char)))
  +
  +(defun make-buffer-input-stream (&optional (buffer (current-buffer)))
  +  (make-instance 'buffer-input-stream
  +                 :marker (make-marker buffer (make-min-point))))
  +
  +(defmethod trivial-gray-streams::close ((stream buffer-input-stream) &key abort)
  +  (declare (ignore abort))
  +  (delete-marker (buffer-stream-marker stream))
  +  t)
  +
  +(defmethod trivial-gray-streams:stream-read-char ((stream buffer-input-stream))
  +  (let ((character (buffer-input-stream-unread-char stream)))
  +    (prog1 (cond (character
  +                  (setf (buffer-input-stream-unread-char stream) nil)
  +                  character)
  +                 (t
  +                  (character-at (buffer-stream-marker stream))))
  +      (character-offset (buffer-stream-marker stream) 1))))
  +
  +(defmethod trivial-gray-streams:stream-unread-char ((stream buffer-input-stream) character)
  +  (setf (buffer-input-stream-unread-char stream) character)
  +  (character-offset (buffer-stream-marker stream) -1)
  +  nil)
  +
  +#+nil
  +(defmethod trivial-gray-streams:stream-read-char-no-hang ((stream buffer-input-stream))
  +  )
  +
  +(defmethod trivial-gray-streams:stream-peek-char ((stream buffer-input-stream))
  +  (character-at (buffer-stream-marker stream)))
  +
  +(defmethod trivial-gray-streams:stream-listen ((stream buffer-input-stream))
  +  (not (eobp/marker (buffer-stream-marker stream))))
  +
  +(defmethod trivial-gray-streams:stream-read-line ((stream buffer-input-stream))
  +  (points-to-string (copy-marker (buffer-stream-marker stream) :temporary)
  +                    (line-end (buffer-stream-marker stream))))
  +
  +(defmethod trivial-gray-streams:stream-clear-input ((stream buffer-input-stream))
  +  nil)
  +
  +(defclass buffer-output-stream (buffer-stream)
  +  ((interactive-update-p
       :initarg :interactive-update-p
       :accessor buffer-output-stream-interactive-update-p)))
   
  
positive.code: (defmethod trivial-gray-streams:stream-force-output ((stream buffer-output-stream))
    (buffer-output-stream-refresh stream))
  
  #-(and)
  (defmethod trivial-gray-streams:clear-output ((stream buffer-output-stream))
    )
  
  
negative.code: (in-package :lem)
  
  (export '(buffer-input-stream
            make-buffer-input-stream
            buffer-output-stream
            make-buffer-output-stream
            buffer-output-stream-point
            minibuffer-input-stream
  