自动竖直分割成三window执行错误

希望的功能是自动竖直分割当前buffer同时各自打开三个文件,左右window固定是4个字符

代码如下:

(defun my-split-layout ()
  (interactive)
  (find-file "~/test.txt")
  (setq window-min-width 4)
  (setq my-split-main-window (get-buffer-window))
  (split-window nil 4 'right)
  (with-selected-window (selected-window)
    (setq my-split-keya-window (selected-window))
    (find-file "~/a.txt")
    (setq window-size-fixed t
          cursor-type nil))
  (select-window (next-window))
  (split-window nil 4 'left)
  (with-selected-window (selected-window)
    (setq my-split-keyb-window (selected-window))
    (find-file "~/b.txt")
    (setq window-size-fixed t
          cursor-type nil)))

奇怪的是朋友的电脑执行正常,版本是emacs29,我的报错,版本是emacs30

设一下 debug-on-error 吧(似乎是这个名字

详细报错信息:

debugger entered--lisp error:
wrong type argument: stringp, #<window 9 on *gnu emacs*>
get-buffer-window(#<window 9 on *gnu emacs*>)
my-split-layout()
run-hooks(after-init-hook delayed-warnings-hook)
command-line()
normal-top-level()

就这些了

把get-buffer-window改成selected-window就正常了