From: Michael Bach <phaebz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Save and load window states
Date: Tue, 20 Dec 2011 17:00:26 +0100 [thread overview]
Message-ID: <4ef0b02d.0d0a0e0a.60bc.080d@mx.google.com> (raw)
I am trying to get saving and loading window states to work. I am using
the new `window-state-get' and `window-state-put' functions from emacs
24:
--8<---------------cut here---------------start------------->8---
(defun my-save-frame ()
(interactive)
(let ((buf (find-file-noselect (concat *emacs-path* ".emacs-layout"))))
(set-buffer buf)
(erase-buffer)
(print (window-state-get) buf)
(save-buffer)
(kill-buffer)))
(defun my-load-frame ()
(interactive)
(let ((buf (find-file-noselect (concat *emacs-path* ".em1acs-layout"))))
(set-buffer buf)
(window-state-put (read buf))))
--8<---------------cut here---------------end--------------->8---
Saving works this way. The file has the same contents shown in the
*Messages* buffer when doing a manual `window-state-get'. On loading, I
get either "Invalid read syntax #" or "End of file during parsing". In
the documentation of the `window-state-get' function it says:
"The return value can be used as argument for `window-state-put' to put
the state recorded here into an arbitrary window. The value can be also
stored on disk and read back in a new session."
I am thinking that this has something to do with how emacs reads and
evaluates objects.
Can someone give me a hint on how to make it work?
Best Regards,
Michael Bach
next reply other threads:[~2011-12-20 16:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-20 16:00 Michael Bach [this message]
2011-12-20 18:53 ` Save and load window states Drew Adams
-- strict thread matches above, loose matches on Subject: below --
2011-12-21 15:29 martin rudalics
2011-12-21 20:13 ` Michael Bach
2011-12-21 21:20 ` martin rudalics
2011-12-23 11:02 ` Michael Bach
2011-12-23 11:13 ` martin rudalics
2011-12-23 12:24 ` Michael Bach
2011-12-23 13:46 ` martin rudalics
2011-12-28 14:10 ` Michael Bach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ef0b02d.0d0a0e0a.60bc.080d@mx.google.com \
--to=phaebz@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.