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

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

Re: How to pickle split window?


From: Eric Abrahamsen
Subject: Re: How to pickle split window?
Date: Sun, 10 Mar 2013 10:47:40 +0800
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2 (gnu/linux)

Haines Brown <haines@histomat.net> writes:

> Lowell Gilbert <lgusenet@be-well.ilk.org> writes:
>
>> Haines Brown <haines@histomat.net> writes:
>
>>> Sorry I was not clearer. I understand there are commands to restore
>>> previous window layout, but my interest was for it to be automatic,
>>> so that for example when I close gnus, emacs returns automatically to
>>> the prior windows layout. It would even be nice to return
>>> automatically to the the prior buffers displayed in those windows.
>
> Several well-meaning replies assume that I'm up to lisp encoding, but
> I'm a historian by trade and lack the skill. Earlier suggestions to
> pickle the layout in a variable and restore it by command are equivalent
> (in terms of number of key strokes required) to what I now do, which is
> simply to reload emacs. This recovers the split window. But the real
> problem is that I have also to take the further steps to recover the
> previous buffers to display them in the two windows, and that is an
> annoyance.

Hi,

I'll bet your best solution is to use `gnus-other-frame' rather than
plain old `gnus'. That will start a new frame for you, run or visit
gnus, and then delete the frame when you quit gnus.

If you don't want another frame, then saving a window configuration is
definitely the way to go: window confs not only save the window
structure of your frame, but also which buffers are displayed, and even
the location of point in those buffers. Here's the code for what I
mentioned earlier:


(defvar my-pre-gnus-wconf nil
  "A place to store window configuration before starting gnus.")

(defadvice gnus (before save-wconf-start-gnus activate)
  "Save current window configuration before starting gnus."
  (setq my-pre-gnus-wconf (current-window-configuration)))

(defun my-post-gnus-restore ()
  (when (window-configuration-p my-pre-gnus-wconf)
    (set-window-configuration my-pre-gnus-wconf)))

(add-hook 'gnus-exit-gnus-hook 'my-post-gnus-restore)


Untested, but ought to work.

Yours,
Eric




reply via email to

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