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

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

Re: Saving window config using desktop globals


From: Emanuel Berg
Subject: Re: Saving window config using desktop globals
Date: Sun, 13 Dec 2015 23:47:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Tim Johnson <tim@akwebsoft.com> writes:

> I use the following method (add-to-list
> 'desktop-globals-to-save 'current-project-directory)
> (add-to-list 'desktop-globals-to-save 'kill-ring) to
> save certain variables.
>
> How may I extend this method to save and retrieve my
> window configuration?

It is much easier to understand what you mean and thus
give help if you don't describe the problem in terms
of technology, but rather from a human POV - what is
it, that you want to do, that you cannot? In what
situation will it solve what problem? Etc.

This is one easy way to store and load one window
configuration. I never found much use for it, but it
works, so perhaps it can be useful to you.

If you use it interactively with no prefix argument
(i.e., just M-x <function> RET) then that should
provide basic functionality. More advanced usage than
that, tho possible in principle, I don't see how that
won't get out of hands before anything good can
be riped.

What I recommend are even more simple functions that
will take you to specific buffers, or instances
thereof, for example the one *Article* buffer, and
then shortcuts to those commands (the below will
benefit from shortcuts as well, as always). But it is
your call.

Anyway:

(defvar *default-window-configuration-register* ?0)

(defun save-window-configuration (&optional register)
   (interactive "P")
   (window-configuration-to-register
    (or register *default-window-configuration-register* )))

(defun restore-window-configuration (&optional register)
  (interactive "P")
  (jump-to-register
   (or register *default-window-configuration-register* )))

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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