unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Persistent Window Registers
@ 2009-01-04 16:10 Volkan YAZICI
  2009-01-05 10:17 ` Volkan YAZICI
  2009-01-08  7:50 ` Volkan YAZICI
  0 siblings, 2 replies; 7+ messages in thread
From: Volkan YAZICI @ 2009-01-04 16:10 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

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.

[1] http://emacs-session.sourceforge.net/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Persistent Window Registers
  2009-01-04 16:10 Persistent Window Registers Volkan YAZICI
@ 2009-01-05 10:17 ` Volkan YAZICI
  2009-01-05 10:50   ` Lennart Borgman
       [not found]   ` <mailman.3999.1231152658.26697.help-gnu-emacs@gnu.org>
  2009-01-08  7:50 ` Volkan YAZICI
  1 sibling, 2 replies; 7+ messages in thread
From: Volkan YAZICI @ 2009-01-05 10:17 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 4, 6:10 pm, Volkan YAZICI <volkan.yaz...@gmail.com> wrote:
> 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.

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Persistent Window Registers
  2009-01-05 10:17 ` Volkan YAZICI
@ 2009-01-05 10:50   ` Lennart Borgman
       [not found]   ` <mailman.3999.1231152658.26697.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Lennart Borgman @ 2009-01-05 10:50 UTC (permalink / raw)
  To: Volkan YAZICI; +Cc: help-gnu-emacs

On Mon, Jan 5, 2009 at 11:17 AM, Volkan YAZICI <volkan.yazici@gmail.com> wrote:
> On Jan 4, 6:10 pm, Volkan YAZICI <volkan.yaz...@gmail.com> wrote:
>> 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.
>
> 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?

See winsav.el in nXhtml




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Persistent Window Registers
       [not found]   ` <mailman.3999.1231152658.26697.help-gnu-emacs@gnu.org>
@ 2009-01-07 13:03     ` Volkan YAZICI
  2009-01-07 22:26       ` Lennart Borgman
       [not found]       ` <mailman.4299.1231367204.26697.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Volkan YAZICI @ 2009-01-07 13:03 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 5, 12:50 pm, "Lennart Borgman" <lennart.borg...@gmail.com>
wrote:
> 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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Persistent Window Registers
  2009-01-07 13:03     ` Volkan YAZICI
@ 2009-01-07 22:26       ` Lennart Borgman
       [not found]       ` <mailman.4299.1231367204.26697.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Lennart Borgman @ 2009-01-07 22:26 UTC (permalink / raw)
  To: Volkan YAZICI; +Cc: help-gnu-emacs

On Wed, Jan 7, 2009 at 2:03 PM, Volkan YAZICI <volkan.yazici@gmail.com> wrote:
> On Jan 5, 12:50 pm, "Lennart Borgman" <lennart.borg...@gmail.com>
> wrote:
>> 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


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?


> 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.
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Persistent Window Registers
       [not found]       ` <mailman.4299.1231367204.26697.help-gnu-emacs@gnu.org>
@ 2009-01-08  6:48         ` Volkan YAZICI
  0 siblings, 0 replies; 7+ messages in thread
From: Volkan YAZICI @ 2009-01-08  6:48 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 8, 12:26 am, "Lennart Borgman" <lennart.borg...@gmail.com>
wrote:
> 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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Persistent Window Registers
  2009-01-04 16:10 Persistent Window Registers Volkan YAZICI
  2009-01-05 10:17 ` Volkan YAZICI
@ 2009-01-08  7:50 ` Volkan YAZICI
  1 sibling, 0 replies; 7+ messages in thread
From: Volkan YAZICI @ 2009-01-08  7:50 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 4, 6:10 pm, Volkan YAZICI <volkan.yaz...@gmail.com> wrote:
> 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.)

I just give it a quick & dirty start: http://www.emacswiki.org/emacs/SavingWindowConfigurations


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-01-08  7:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-04 16:10 Persistent Window Registers Volkan YAZICI
2009-01-05 10:17 ` Volkan YAZICI
2009-01-05 10:50   ` Lennart Borgman
     [not found]   ` <mailman.3999.1231152658.26697.help-gnu-emacs@gnu.org>
2009-01-07 13:03     ` Volkan YAZICI
2009-01-07 22:26       ` Lennart Borgman
     [not found]       ` <mailman.4299.1231367204.26697.help-gnu-emacs@gnu.org>
2009-01-08  6:48         ` Volkan YAZICI
2009-01-08  7:50 ` Volkan YAZICI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).