<commit_before>;;; ui/popup/autoload.el -*- lexical-binding: t; -*-

;;;###autoload
(defvar +popup--display-buffer-alist nil)

;;;###autoload
(def-setting! :popup (condition &optional alist parameters)
  "Define a popup rule.

CONDITION can be a regexp string or a function.

For ALIST, see `display-buffer' and `display-buffer-alist' for a list of
possible entries, which instruct the display system how to initialize the popup
window.

ALIST also supports the `size' parameter, which will be translated to
`window-width' or `window-height' depending on `side'.

PARAMETERS is an alist of window parameters. See `+popup-window-parameters' for
a list of custom parameters provided by the popup module.

If certain attributes/parameters are omitted, the ones from
`+popup-default-alist' and `+popup-default-parameters' will be used.

The buffers of new windows displayed by `pop-to-buffer' and `display-buffer'
will be tested against CONDITION, which is either a) a regexp string (which is
matched against the buffer's name) or b) a function that takes no arguments and
returns a boolean."
  `(progn
     (when after-init-time
       (setq +popup--display-buffer-alist
             (map-delete +popup--display-buffer-alist ,condition)))
     (push (+popup--rule (list ,condition ,alist ,parameters))
           +popup--display-buffer-alist)
     (when (bound-and-true-p +popup-mode)
       (setq display-buffer-alist +popup--display-buffer-alist))
     +popup--display-buffer-alist))

;;;###autoload
(def-setting! :popups (&rest rules)
  "Define multiple popup rules. See `doom--set:popup' for the specifications of
each individual rule.

 (set! :popups
   (\"^ \\*\" '((slot . 1) (vslot . -1) (size . +popup-shrink-to-fit)))
   (\"^\\*\"  '((slot . 1) (vslot . -1)) '((select . t))))"
  `(progn
     (dolist (rule (nreverse (list ,@rules)))
       (when after-init-time
         (setq +popup--display-buffer-alist
               (map-delete +popup--display-buffer-alist (car rule))))
       (push (+popup--rule rule) +popup--display-buffer-alist))
     (when (bound-and-true-p +popup-mode)
       (setq display-buffer-alist +popup--display-buffer-alist))
     +popup--display-buffer-alist))

;;;###autoload
(defsubst +popup--rule (args)
  (declare (indent 1))
  (cl-destructuring-bind (condition &optional alist parameters) args
    (if (eq alist :ignore)
        (list condition nil)
      `(,condition (+popup-buffer)
                   ,@alist
                   (window-parameters ,@parameters)))))


;;
;; Library
;;

(defvar +popup--populate-wparams (not EMACS26+))
(defvar +popup--inhibit-transient nil)
(defvar +popup--inhibit-select nil)<commit_msg>Correct :popup/:popups docstrings<commit_after>;;; ui/popup/autoload.el -*- lexical-binding: t; -*-

;;;###autoload
(defvar +popup--display-buffer-alist nil)

;;;###autoload
(def-setting! :popup (condition &optional alist parameters)
  "Define a popup rule.

CONDITION can be a regexp string or a function.

For ALIST, see `display-buffer' and `display-buffer-alist' for a list of
possible entries, which instruct the display system how to initialize the popup
window.

ALIST also supports the `size' parameter, which will be translated to
`window-width' or `window-height' depending on `side'.

PARAMETERS is an alist of window parameters. See `+popup-window-parameters' for
a list of custom parameters provided by the popup module. If certain
attributes/parameters are omitted, the ones from `+popup-default-alist' and
`+popup-default-parameters' will be used.

The buffers of new windows displayed by `pop-to-buffer' and `display-buffer'
will be tested against CONDITION, which is either a) a regexp string (which is
matched against the buffer's name) or b) a function that takes no arguments and
returns a boolean."
  `(progn
     (when after-init-time
       (setq +popup--display-buffer-alist
             (map-delete +popup--display-buffer-alist ,condition)))
     (push (+popup--rule (list ,condition ,alist ,parameters))
           +popup--display-buffer-alist)
     (when (bound-and-true-p +popup-mode)
       (setq display-buffer-alist +popup--display-buffer-alist))
     +popup--display-buffer-alist))

;;;###autoload
(def-setting! :popups (&rest rules)
  "Define multiple popup rules. See `doom--set:popup' for the specifications of
each individual rule.

 (set! :popups
   '(\"^ \\*\" ((slot . 1) (vslot . -1) (size . +popup-shrink-to-fit)))
   '(\"^\\*\"  ((slot . 1) (vslot . -1)) ((select . t))))"
  `(progn
     (dolist (rule (nreverse (list ,@rules)))
       (when after-init-time
         (setq +popup--display-buffer-alist
               (map-delete +popup--display-buffer-alist (car rule))))
       (push (+popup--rule rule) +popup--display-buffer-alist))
     (when (bound-and-true-p +popup-mode)
       (setq display-buffer-alist +popup--display-buffer-alist))
     +popup--display-buffer-alist))

;;;###autoload
(defsubst +popup--rule (args)
  (declare (indent 1))
  (cl-destructuring-bind (condition &optional alist parameters) args
    (if (eq alist :ignore)
        (list condition nil)
      `(,condition (+popup-buffer)
                   ,@alist
                   (window-parameters ,@parameters)))))


;;
;; Library
;;

(defvar +popup--populate-wparams (not EMACS26+))
(defvar +popup--inhibit-transient nil)
(defvar +popup--inhibit-select nil)
{'fraction_non_alphanumeric': 0.14660667416572928, 'fraction_numerical': 0.0026246719160104987, 'mean_word_length': 3.3198380566801617, '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': '5189307', 'n_tokens_mistral': 1719, 'n_tokens_neox': 1669, 'n_words': 517}