Skip to content

Commit

Permalink
add :no-split into split-action
Browse files Browse the repository at this point in the history
  • Loading branch information
cxxxr committed Nov 17, 2024
1 parent cb31a57 commit 0bc4f42
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/window/window.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
(defvar *switch-to-buffer-hook* '())
(defvar *switch-to-window-hook* '())

(defvar *default-split-action* :sensibly)

(defgeneric %delete-window (window))
(defgeneric window-parent (window)
(:method (window)
Expand Down Expand Up @@ -756,7 +758,7 @@ You can pass in the optional argument WINDOW-LIST to replace the default
(run-hooks *window-show-buffer-functions* window)))

(deftype split-action ()
'(or null (member :sensibly :negative)))
'(or null (member :sensibly :negative :no-split)))

(defmethod split-window-using-split-action ((split-action null) window)
(split-window-sensibly window))
Expand All @@ -772,6 +774,9 @@ You can pass in the optional argument WINDOW-LIST to replace the default
(:hsplit (split-window-vertically window))
(:vsplit (split-window-horizontally window))))))

(defmethod split-window-using-split-action ((split-action (eql :no-split)) window)
)

(defstruct pop-to-buffer-state
(split-action nil :type split-action)
(parent-window nil :type (or null window)))
Expand Down Expand Up @@ -837,7 +842,7 @@ You can pass in the optional argument WINDOW-LIST to replace the default
(run-hooks (window-switch-to-buffer-hook (current-window)) buffer)
(%switch-to-buffer buffer record move-prev-point))

(defun pop-to-buffer (buffer &key split-action)
(defun pop-to-buffer (buffer &key (split-action *default-split-action*))
(check-type split-action split-action)
(if (eq buffer (current-buffer))
(return-from pop-to-buffer (current-window))
Expand Down

0 comments on commit 0bc4f42

Please sign in to comment.