I also implemented C functions to save window configurations
in Lisp expressions that could be used later to save tabs
in the desktop file. For example,
(current-window-configuration-to-sexp)
=>
(window-configuration
(frame-cols . 80)
(frame-lines . 41)
(frame-menu-bar-lines . 1)
(frame-tool-bar-lines . 4)
(frame-tab-bar-lines . 4)
(current-buffer . "*scratch*")
(minibuf-scroll-window)
(minibuf-selected-window)
(saved-windows
. (saved-window
(current-window . t)
(buffer . "*scratch*")
(left-col . 0)
(top-line . 5)
(total-cols . 86)
(total-lines . 35)
(hscroll . 0)
(min-hscroll . 0)
(display-table)
(orig-top-line)
(orig-total-lines)
(left-margin-cols)
(right-margin-cols)
(left-fringe-width)
(right-fringe-width)
(fringes-outside-margins)
(scroll-bar-width)
(vertical-scroll-bar-type . t)
(dedicated)
(resize-proportionally)
(pointm . 236)
(start . 1)
(start-at-line-beg . t)
(mark . 192)
(next
. (saved-window
(buffer . " *Minibuf-0*")
(left-col . 0)
(top-line . 40)
(total-cols . 86)
(total-lines . 1)
(hscroll . 0)
(min-hscroll . 0)
(display-table)
(orig-top-line)
(orig-total-lines)
(left-margin-cols)
(right-margin-cols)
(left-fringe-width)
(right-fringe-width)
(fringes-outside-margins)
(scroll-bar-width)
(vertical-scroll-bar-type . t)
(dedicated)
(resize-proportionally)
(pointm . 1)
(start . 1)
(start-at-line-beg))))))