Hi, I tried with following code, in scratch 

(defun window-toggle-side-windows (&optional frame)
  "Toggle display of side windows on specified FRAME.
FRAME must be a live frame and defaults to the selected one.

If FRAME has at least one side window, delete all side
windows on FRAME after saving FRAME's state in the
FRAME's `window-state' frame parameter.  Otherwise,
restore any side windows recorded in FRAME's `window-state'
parameter, leaving FRAME's main window alone.  Signal an
error if FRAME has no side windows and no saved state for
it is found."
  (interactive)
  (let* ((frame (window-normalize-frame frame))
         (window--sides-inhibit-check t)
         state)
    (cond
     ((window-with-parameter 'window-side nil frame)
      ;; At least one side window exists.  Remove all side windows after
      ;; saving FRAME's state in its `window-state' parameter.
      (set-frame-parameter
       frame 'window-state (window-state-get (frame-root-window frame)))
      (let ((ignore-window-parameters t))
        (delete-other-windows (window-main-window frame))))
     ((setq state (frame-parameter frame 'window-state))
      ;; A window state was saved for FRAME.  Restore it and put the
      ;; current root window into its main window.
      (let ((window-combination-resize t)
            (main-state (window-state-get (frame-root-window frame))))
        (window-state-put state (frame-root-window frame) t)
        (window-state-put main-state (window-main-window frame)))
      (window--sides-reverse-frame frame))
     (t
      (error "No side windows state found")))))
(setq display-buffer-alist
      '(
        ("\\*Info\\*"
        (display-buffer-reuse-window display-buffer-in-side-window)
        (window-width . 0.40)
        (side . right)
        (slot . 0))
        ("\\*Help\\*"
        (display-buffer-reuse-window display-buffer-in-side-window)
        (window-height . 0.40)
        (side . top)
        (slot . 0))
       )
      )


And also without `window—-sides-reverse-frame`

(defun window-toggle-side-windows (&optional frame)
  "Toggle display of side windows on specified FRAME.
FRAME must be a live frame and defaults to the selected one.

If FRAME has at least one side window, delete all side
windows on FRAME after saving FRAME's state in the
FRAME's `window-state' frame parameter.  Otherwise,
restore any side windows recorded in FRAME's `window-state'
parameter, leaving FRAME's main window alone.  Signal an
error if FRAME has no side windows and no saved state for
it is found."
  (interactive)
  (let* ((frame (window-normalize-frame frame))
         (window--sides-inhibit-check t)
         state)
    (cond
     ((window-with-parameter 'window-side nil frame)
      ;; At least one side window exists.  Remove all side windows after
      ;; saving FRAME's state in its `window-state' parameter.
      (set-frame-parameter
       frame 'window-state (window-state-get (frame-root-window frame)))
      (let ((ignore-window-parameters t))
        (delete-other-windows (window-main-window frame))))
     ((setq state (frame-parameter frame 'window-state))
      ;; A window state was saved for FRAME.  Restore it and put the
      ;; current root window into its main window.
      (let ((window-combination-resize t)
            (main-state (window-state-get (frame-root-window frame))))
        (window-state-put state (frame-root-window frame) t)
        (window-state-put main-state (window-main-window frame)))
      )
     (t
      (error "No side windows state found")))))
(setq display-buffer-alist
      '(
        ("\\*Info\\*"
        (display-buffer-reuse-window display-buffer-in-side-window)
        (window-width . 0.40)
        (side . right)
        (slot . 0))
        ("\\*Help\\*"
        (display-buffer-reuse-window display-buffer-in-side-window)
        (window-height . 0.40)
        (side . top)
        (slot . 0))
       )
      )

In both cases, after doing following:

1. `C-x 3`
2. `C-h i`
3. `C-h m`
4. `M-x window-toggle-side-windows RET`

emacs still hangs.

Indrajeet.


On 04-Oct-2021, at 11:52 PM, martin rudalics <rudalics@gmx.at> wrote:

(setq display-buffer-alist
      '(
        ("\\*Info\\*"
        (display-buffer-reuse-window display-buffer-in-side-window)
        (window-width . 0.40)
        (side . right)
        (slot . 0))
        ("\\*Help\\*"
        (display-buffer-reuse-window display-buffer-in-side-window)
        (window-height . 0.40)
        (side . top)
        (slot . 0))
       )
      )