I'm using session.el[1] for persistence of configurations between
different emacs sessions. But I also want to assign persistent window
registers to some of my window configurations. For instance, I want
below configurations be persistent across different sessions:
- C-x r j 1 (*Group*)
- C-x r j 2 (#postgresql and #lisp buffers divided vertically)
- ...
How can I do that? (Actually, I don't want to hard-bind "C-x r j 1" to
*Group*. I just want my "C-x r w"ed configurations be remembered in
later sessions.)
Regards.
I find out that "saving window configurations" is on the TODO list of
both session.el and desktop.el packages. When I check register.el of
emacs, I see that one can manually initialize `register-alist' as he/
she desires, but the components for #<window-configuration> and
#<marker at 1 in *Group*> are -- if I am not mistaken -- defined in C
code and I don't know a way to create one from elisp or serialize an
existing one and read it at the next session. Any ideas?
Regards.
See winsav.el in nXhtml
After spending some time, I found out that there is no easy way to
save window configurations. Instead, as nXhtml, people
1. Walk through available window configurations they are interested
in,
2. Copy attributes (buffer name, buffer start/end position, etc.) of
the walked windows,
And in later sessions, using saved window attributes
3. Open same buffers one by one in specific windows,
4. Then resize opened windows according to the saved attributes.
On Jan 4, 6:10 pm, Volkan YAZICI <volkan.yaz...@gmail.com> wrote:
> - C-x r j 1 (*Group*)
> - C-x r j 2 (#postgresql and #lisp buffers divided vertically)
To summarize, here is the solution I came up with:
(defun erc-register-window-configuration ()
"Register vertically split `#postgresql' and `#lisp' channel windows
into
configuration 2."
(let ((psql-buf (get-buffer "#postgresql"))
(lisp-buf (get-buffer "#lisp")))
(cond ((and psql-buf lisp-buf)
(switch-to-buffer psql-buf)
(delete-other-windows)
(recenter)
(select-window (split-window-horizontally))
(switch-to-buffer lisp-buf)
(recenter)
(window-configuration-to-register ?2))
(t (warn "Couldn't find buffers `#postgresql' and `#lisp'.")))))
(add-hook 'erc-join-hook 'erc-register-window-configuration)
(defun gnus-register-window-configuration ()
"Register a whole `*Group*' buffer window into configuration 1."
(let ((group-buf (get-buffer "*Group*")))
(when group-buf
(switch-to-buffer group-buf)
(delete-other-windows)
(beginning-of-buffer)
(window-configuration-to-register ?1))))
(add-hook 'gnus-started-hook 'gnus-register-window-configuration)
Regards.
Hi Volkan,
I am not sure what you mean and it is a long time since I wrote
winsav.el. Are the things you need missing in winsav.el?
No, actually I was looking for some internal hacks to easily serialize
#<window ...> objects. But instead, I saw that, people serialize the
environment variables forming that #<window ...> object and in later
sessions, using that variables they are creating same #<window ...>
objects from scratch.
Regards.
I just give it a quick & dirty start: http://www.emacswiki.org/emacs/SavingWindowConfigurations