<commit_before>(in-package :lem)

(export '(*info-mode-keymap*
          *info-mode-keymap*
          info-mode
          info-popup-closure
          info-popup))

(defvar *info-mode-keymap*
  (make-keymap "info"))

(define-minor-mode info-mode
  :name "info"
  :keymap *info-mode-keymap*)

(define-key *info-mode-keymap* (kbd "q") 'info-quit)
(define-command info-quit () ()
  (let ((buffer (window-buffer)))
    (when (buffer-get buffer :popup)
      (delete-current-window))
    (bury-buffer buffer)
    t))

(defun info-popup-closure (mode)
  #'(lambda (buffer fn focus-set-p)
      (let ((one-window-p (or (buffer-get buffer :popup)
                              (one-window-p)))
            window)
        (with-buffer-read-only buffer nil
          (setq window
                (popup buffer fn
                       :goto-bob-p t
                       :erase-p (if fn t nil)))
          (when focus-set-p
            (setq *current-window* window)))
        (let ((*current-window* window))
          (info-mode t)
          (when mode (funcall mode))
          (buffer-put buffer :popup one-window-p))
        window)))

(defun info-popup (buffer &optional fn (focus-set-p t))
  (funcall (info-popup-closure nil)
           buffer fn focus-set-p))<commit_msg>info-quitを修正<commit_after>(in-package :lem)

(export '(*info-mode-keymap*
          *info-mode-keymap*
          info-mode
          info-popup-closure
          info-popup))

(defvar *info-mode-keymap*
  (make-keymap "info"))

(define-minor-mode info-mode
  :name "info"
  :keymap *info-mode-keymap*)

(define-key *info-mode-keymap* (kbd "q") 'info-quit)
(define-command info-quit () ()
  (let ((buffer (window-buffer)))
    (bury-buffer buffer)
    (when (buffer-get buffer :popup)
      (delete-current-window))
    t))

(defun info-popup-closure (mode)
  #'(lambda (buffer fn focus-set-p)
      (let ((one-window-p (or (buffer-get buffer :popup)
                              (one-window-p)))
            window)
        (with-buffer-read-only buffer nil
          (setq window
                (popup buffer fn
                       :goto-bob-p t
                       :erase-p (if fn t nil)))
          (when focus-set-p
            (setq *current-window* window)))
        (let ((*current-window* window))
          (info-mode t)
          (when mode (funcall mode))
          (buffer-put buffer :popup one-window-p))
        window)))

(defun info-popup (buffer &optional fn (focus-set-p t))
  (funcall (info-popup-closure nil)
           buffer fn focus-set-p))
{'fraction_non_alphanumeric': 0.14825009830908376, 'fraction_numerical': 0.0, 'mean_word_length': 1.8843537414965987, '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': '5236274', 'n_tokens_mistral': 851, 'n_tokens_neox': 838, 'n_words': 195}