<commit_before>;;;; SPDX-FileCopyrightText: Atlas Engineer LLC
;;;; SPDX-License-Identifier: BSD-3-Clause

(in-package :nyxt)

(defmethod mode-status ((mode mode))
  (princ-to-string mode))

(export-always 'format-status-modes)
(defun format-status-modes (buffer window)
  "Format the modes for the status area.
This leverages `mode-status' which can be specialized for individual modes."
  (if (modable-buffer-p buffer)
      (spinneret:with-html-string
        (when (nosave-buffer-p buffer) (:span "⚠ nosave"))
        (:button :type "button" :class "button"
                 :onclick (ps:ps (nyxt/ps:lisp-eval '(nyxt:toggle-modes)))
                 :title (str:concat "Enabled modes: " (modes-string buffer)) "✚")
        (loop for mode in (sera:filter (alex:conjoin #'enabled-p #'visible-in-status-p)
                                       (modes buffer))
              collect (let* ((formatted-mode (if (glyph-mode-presentation-p (status-buffer window))
                                                 (glyph mode)
                                                 (mode-status mode))))
                        (if (html-string-p formatted-mode)
                            (:raw formatted-mode)
                            (:button :class "button"
                                     :onclick (ps:ps (nyxt/ps:lisp-eval
                                                      `(describe-class :class ',(name mode))))
                                     :title (format nil "Describe ~a" mode)
                                     formatted-mode)))))
      ""))

(defun modes-string (buffer)
  (when (modable-buffer-p buffer)
    (format nil "~{~a~^ ~}" (mapcar #'princ-to-string
                                    (sera:filter #'enabled-p (modes buffer))))))

(export-always 'format-status-buttons)
(defun format-status-buttons ()
  (spinneret:with-html-string
    (:button :type "button" :class "button"
             :title "Backwards"<commit_msg>status: Replace ' with (quote ...) for style consistency.<commit_after>;;;; SPDX-FileCopyrightText: Atlas Engineer LLC
;;;; SPDX-License-Identifier: BSD-3-Clause

(in-package :nyxt)

(defmethod mode-status ((mode mode))
  (princ-to-string mode))

(export-always 'format-status-modes)
(defun format-status-modes (buffer window)
  "Format the modes for the status area.
This leverages `mode-status' which can be specialized for individual modes."
  (if (modable-buffer-p buffer)
      (spinneret:with-html-string
        (when (nosave-buffer-p buffer) (:span "⚠ nosave"))
        (:button :type "button" :class "button"
                 :onclick (ps:ps (nyxt/ps:lisp-eval '(nyxt:toggle-modes)))
                 :title (str:concat "Enabled modes: " (modes-string buffer)) "✚")
        (loop for mode in (sera:filter (alex:conjoin #'enabled-p #'visible-in-status-p)
                                       (modes buffer))
              collect (let* ((formatted-mode (if (glyph-mode-presentation-p (status-buffer window))
                                                 (glyph mode)
                                                 (mode-status mode))))
                        (if (html-string-p formatted-mode)
                            (:raw formatted-mode)
                            (:button :class "button"
                                     :onclick (ps:ps (nyxt/ps:lisp-eval
                                                      `(describe-class :class (quote ,(name mode)))))
                                     :title (format nil "Describe ~a" mode)
                                     formatted-mode)))))
      ""))

(defun modes-string (buffer)
  (when (modable-buffer-p buffer)
    (format nil "~{~a~^ ~}" (mapcar #'princ-to-string
                                    (sera:filter #'enabled-p (modes buffer))))))

(export-always 'format-status-buttons)
(defun format-status-buttons ()
  (spinneret:with-html-string
    (:button :type "button" :class "button"
             :title "Backwards"
{'fraction_non_alphanumeric': 0.13247539742619227, 'fraction_numerical': 0.0005046681806712087, 'mean_word_length': 1.6747638326585694, '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': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '67628', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1067, 'n_words': 274}