<commit_before>(in-package :lem)

(define-key *global-keymap* "C-x#" 'filter-buffer)
(defcommand filter-buffer (str) ("sFilter buffer: ")
  (let ((outstr (make-array '(0)
                  :element-type 'character
                  :fill-pointer t)))
    (with-output-to-string (output outstr)
      (let ((temp-file-name (temp-file-name)))
        (write-to-file (window-buffer) temp-file-name)
        (shell-command (format nil "cat ~a | ~a" temp-file-name str)
          :output output)
        (delete-file temp-file-name)))
    (erase-buffer)
    (insert-string outstr)
    (beginning-of-buffer)))
<commit_msg>pipe-commandを追加<commit_after>(in-package :lem)

(define-key *global-keymap* "C-x#" 'filter-buffer)
(defcommand filter-buffer (str) ("sFilter buffer: ")
  (let ((outstr (make-array '(0)
                  :element-type 'character
                  :fill-pointer t)))
    (with-output-to-string (output outstr)
      (let ((temp-file-name (temp-file-name)))
        (write-to-file (window-buffer) temp-file-name)
        (shell-command (format nil "cat ~a | ~a" temp-file-name str)
          :output output)
        (delete-file temp-file-name)))
    (erase-buffer)
    (insert-string outstr)
    (beginning-of-buffer)))

(define-key *global-keymap* "C-x@" 'pipe-command)
(defcommand pipe-command (str) ("sPipe command: ")
  (let ((outstr (make-array '(0)
                  :element-type 'character
                  :fill-pointer t)))
    (with-output-to-string (output outstr)
      (shell-command str :output output))
    (let ((buffer (get-buffer-create "*Command*")))
      (let ((*current-window* (pop-to-buffer buffer)))
        (buffer-erase buffer)
        (insert-string outstr)
        (beginning-of-buffer)))))

{'fraction_non_alphanumeric': 0.16820276497695852, 'fraction_numerical': 0.0017281105990783411, 'mean_word_length': 2.5594262295081966, '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': '5122281', 'n_tokens_mistral': 583, 'n_tokens_neox': 578, 'n_words': 125}