<commit_before>(in-package :lem)

(export '(*enable-recursive-minibuffers*
          *minibuffer-completion-function*
          *minibuffer-file-complete-function*
          *minibuffer-activate-hook*
          *minibuffer-deactivate-hook*
          *minibuf-keymap*
          minibuffer-prompt-attribute
          minibuffer-window-p
          minibuffer-window-active-p
          minibuffer-window-height
          minibufferp
          message
          message-without-log
          message-buffer
          active-echoarea-p
          prompt-for-character
          active-minibuffer-window
          check-switch-minibuffer-window
          minibuffer-read-line-execute
          minibuffer-read-line-completion
          minibuffer-read-line-prev-history
          minibuffer-read-line-next-history
          prompt-for-y-or-n-p
          prompt-for-line
          prompt-for-string
          prompt-for-integer
          prompt-for-buffer
          prompt-for-file
          prompt-for-directory))

(defparameter *minibuffer-window-height* 1)
(defvar *enable-recursive-minibuffers* t)

(defvar +recursive-minibuffer-break-tag+ (gensym))

(defvar *minibuf-window*)
(defvar *minibuffer-calls-window*)
(defvar *minibuffer-start-charpos*)

(defvar *echoarea-buffer*)
(defvar *minibuffer-buffer*)

(defvar *minibuffer-completion-function* nil)
(defvar *minibuffer-file-complete-function* nil)

(defvar *minibuffer-activate-hook* '())
(defvar *minibuffer-deactivate-hook* '())

(defclass minibuffer-window (window) ())

(defun make-minibuffer-window (buffer)
  (make-instance 'minibuffer-window
                 :buffer buffer
                 :x 0
                 :y (- (display-height)
                       (minibuffer-window-height))
                 :width (display-width)
                 :height (minibuffer-window-height)
                 :use-modeline-p nil))

(define-attribute minibuffer-prompt-attribute
  (t :foreground "blue" :bold-p t))

(defun minibuffer-window () *minibuf-window*)
(defun minibuffer-window-p (window) (typep window 'minibuffer-window))
(defun minibuffer-window-active-p () (eq (current-window) (minibuffer-window)))
(defun minibuffer-window-height () *minibuffer-window-height*)
(defun minibuffer () (window-buffer (minibuffer-window)))
(defun minibufferp (buffer) (eq buffer (minibuffer)))
(defun minibuffer-calls-window () *minibuffer-calls-window*)

(define-major-mode minibuffer-mode nil
    (:name "minibuffer"
     :keymap *minibuf-keymap*
     :syntax-table (make-syntax-table
                    :symbol-chars '(#\_ #\-))))

(defun setup-minibuffer ()
  (setf *echoarea-buffer*
        (make-buffer "*echoarea*" :temporary t :enable-undo-p nil))
  (setf *minibuffer-buffer*
        (make-buffer "*minibuffer*" :temporary t :enable-undo-p t))
  (setf *minibuf-window*
        (make-minibuffer-window *echoarea-buffer*)))

(defun teardown-minibuffer ()
  (%free-window *minibuf-window*))

(defun minibuf-update-size ()
  (window-set-pos (minibuffer-window) 0 (1- (display-height)))
  (window-set-size (minibuffer-window) (display-width) 1))

(defun log-message (string args)
  (when string
    (let ((msg (apply #'format nil string args)))
      (let ((buffer (make-buffer "*Messages*")))
        (with-open-stream (stream (make-buffer-output-stream<commit_msg>disable wrapping in minibuffer<commit_after>(in-package :lem)

(export '(*enable-recursive-minibuffers*
          *minibuffer-completion-function*
          *minibuffer-file-complete-function*
          *minibuffer-activate-hook*
          *minibuffer-deactivate-hook*
          *minibuf-keymap*
          minibuffer-prompt-attribute
          minibuffer-window-p
          minibuffer-window-active-p
          minibuffer-window-height
          minibufferp
          message
          message-without-log
          message-buffer
          active-echoarea-p
          prompt-for-character
          active-minibuffer-window
          check-switch-minibuffer-window
          minibuffer-read-line-execute
          minibuffer-read-line-completion
          minibuffer-read-line-prev-history
          minibuffer-read-line-next-history
          prompt-for-y-or-n-p
          prompt-for-line
          prompt-for-string
          prompt-for-integer
          prompt-for-buffer
          prompt-for-file
          prompt-for-directory))

(defparameter *minibuffer-window-height* 1)
(defvar *enable-recursive-minibuffers* t)

(defvar +recursive-minibuffer-break-tag+ (gensym))

(defvar *minibuf-window*)
(defvar *minibuffer-calls-window*)
(defvar *minibuffer-start-charpos*)

(defvar *echoarea-buffer*)
(defvar *minibuffer-buffer*)

(defvar *minibuffer-completion-function* nil)
(defvar *minibuffer-file-complete-function* nil)

(defvar *minibuffer-activate-hook* '())
(defvar *minibuffer-deactivate-hook* '())

(defclass minibuffer-window (window) ())

(defun make-minibuffer-window (buffer)
  (make-instance 'minibuffer-window
                 :buffer buffer
                 :x 0
                 :y (- (display-height)
                       (minibuffer-window-height))
                 :width (display-width)
                 :height (minibuffer-window-height)
                 :use-modeline-p nil))

(define-attribute minibuffer-prompt-attribute
  (t :foreground "blue" :bold-p t))

(defun minibuffer-window () *minibuf-window*)
(defun minibuffer-window-p (window) (typep window 'minibuffer-window))
(defun minibuffer-window-active-p () (eq (current-window) (minibuffer-window)))
(defun minibuffer-window-height () *minibuffer-window-height*)
(defun minibuffer () (window-buffer (minibuffer-window)))
(defun minibufferp (buffer) (eq buffer (minibuffer)))
(defun minibuffer-calls-window () *minibuffer-calls-window*)

(define-major-mode minibuffer-mode nil
    (:name "minibuffer"
     :keymap *minibuf-keymap*
     :syntax-table (make-syntax-table
                    :symbol-chars '(#\_ #\-)))
  (setf (variable-value 'truncate-lines :buffer (current-buffer)) nil))

(defun setup-minibuffer ()
  (setf *echoarea-buffer*
        (make-buffer "*echoarea*" :temporary t :enable-undo-p nil))
  (setf *minibuffer-buffer*
        (make-buffer "*minibuffer*" :temporary t :enable-undo-p t))
  (setf *minibuf-window*
        (make-minibuffer-window *echoarea-buffer*)))

(defun teardown-minibuffer ()
  (%free-window *minibuf-window*))

(defun minibuf-update-size ()
  (window-set-pos (minibuffer-window) 0 (1- (display-height)))
  (window-set-size (minibuffer-window) (display-width) 1))

(defun log-message (string args)
  (when string
    (let ((msg (apply #'format nil string args)))
      (let ((buffer (make-buffer "*Messages*")))
        (with-open-stream (stream (make-buffer-output-stream
{'fraction_non_alphanumeric': 0.13511495968945955, 'fraction_numerical': 0.001492982979994028, 'mean_word_length': 2.7529411764705882, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6505462', 'n_tokens_mistral': 2213, 'n_tokens_neox': 2178, 'n_words': 380}