              'jail-windows-mode-hook
              (unless (jail-windows/active-p)
                'jail-windows-mode-out-hook))
+  (jail-windows--update-modeline)
   (jail-windows--message 'on-off
                          "jail-windows-mode %sabled"
                          (if (jail-windows/active-p)

          (eq horizontal nil))
      (setq horizontal nil)
    (setq horizontal t))
  (let ((first-run t)
        (new-window)
        (requested-size)
        (window-size-fun (if horizontal
                             #'window-body-width
                           #'window-text-height))
        (window-min-size (if horizontal
                             (max jail-windows-repeat-minimum-horz
                                  jail-windows--real-repeat-minimum-horz)
                           (max jail-windows-repeat-minimum-vert
                                jail-windows--real-repeat-minimum-vert)))
        (split-position (if horizontal
                            'right
                          'below)))
    (let-alist option-alist
      (setq requested-size (or .size
                               (when .ratio
                                 (round (* (funcall window-size-fun)
                                           .ratio)))))
      (while (or first-run
                 (and .repeat
                      (or (and .size
                               (<= window-min-size
                                   (- (funcall window-size-fun)
                                      .size)))
                          (and .ratio
                               (<= window-min-size
                                   (* (funcall window-size-fun)
                                      (- 1.0 .ratio)))))))
        (setq first-run nil
              new-window (split-window nil
                                       requested-size

;;; Customization
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defgroup jail-windows nil
  "Jail-windows is a mode for attempting to maintain a consistent window layout
while working within Emacs. This does not directly prevent creation of new
windows or deletion of existing windows; instead, it offers a framework for
defining layout and window selection rules."
  :group 'windows)
(defcustom jail-windows-register-builtin-layouts t
  "Flag to determine whether jail-windows-mode should automatically register
