Subject: bug#10348: 24.0.92; Save and load window states

From: Juri Linkov <[email-masked]>
Date: Sat, 24 Dec 2011 21:04:23 +0200

> FWIW, maybe like something general like that should be autoloadable or, better
> perhaps, somewhere other than desktop.el?  Just a thought - why need to load
> desktop.el if you are not necessarily interested in saving/restoring desktops
> and you just want to serialize something?

It is tied to desktop functionality.  For example, see how it serializes
markers, and delays restoration of their values in `desktop-delay-hook'
until the desktop is completely loaded:

(desktop-value-to-string (window-state-get nil t))
=>
(list '((min-height . 4)
        (min-width . 10)
        (min-height-ignore . 2)
        (min-width-ignore . 9)
        (min-height-safe . 1)
        (min-width-safe . 2))
      'leaf
      '(total-height . 61)
      '(total-width . 227)
      '(normal-height . 1.0)
      '(normal-width . 1.0)
      '(combination-limit)
      '(parameters
        (clone-of . "Unprintable entity"))
      (list 'buffer "*scratch*"
            '(selected . t)
            '(hscroll . 0)
            '(fringes 9 9 nil)
            '(margins nil)
            '(scroll-bars 16 3 t nil)
            '(vscroll . 0)
            '(dedicated)
            (desktop-list* 'point
                           (let ((mk (make-marker)))
                             (add-hook 'desktop-delay-hook
                                       (list 'lambda '()
                                             (list 'set-marker mk 243
                                                   (get-buffer "*scratch*"))))
                             mk))
            (desktop-list* 'start
                           (let ((mk (make-marker)))
                             (add-hook 'desktop-delay-hook
                                       (list 'lambda '()
                                             (list 'set-marker mk 1
                                                   (get-buffer "*scratch*"))))
                             mk))
            (desktop-list* 'mark
                           (let ((mk (make-marker)))
                             (add-hook 'desktop-delay-hook
                                       (list 'lambda '()
                                             (list 'set-marker mk 192
                                                   (get-buffer "*scratch*"))))
                             mk))))