help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Persistent Window Registers


From: Volkan YAZICI
Subject: Re: Persistent Window Registers
Date: Wed, 7 Jan 2009 05:03:48 -0800 (PST)
User-agent: G2/1.0

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]