From 0bc4f4223c13769e732ea279e50d8eededf913a8 Mon Sep 17 00:00:00 2001 From: cxxxr Date: Mon, 18 Nov 2024 00:14:42 +0900 Subject: [PATCH] add :no-split into split-action --- src/window/window.lisp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/window/window.lisp b/src/window/window.lisp index 0753eae53..bcb660e70 100644 --- a/src/window/window.lisp +++ b/src/window/window.lisp @@ -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) @@ -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)) @@ -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))) @@ -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))