[Top][All Lists]

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

Re: What exactly are "window configurations"?

From: Tory S. Anderson
Subject: Re: What exactly are "window configurations"?
Date: Tue, 27 Jan 2015 21:03:50 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Thanks for the tip about window-configuration-to-register! I had no idea. I've 
done the netbook emacs thing, too, and understand the pain. 

Marcin Borkowski <> writes:

> Hi there,
> I'm wondering about `C-x r w' and `C-x r j'.  What I would need is a way
> to restore not only point, but the "state of scrolling" (i.e., the
> position of the buffer in the window, so to speak; IOW, which line is
> displayed at the top).  (This is very handy when using a small, netbook
> screen: I carefully `C-something C-l'ed so that exactly what I need is
> seen, and I have to depart to another place in the buffer for a moment,
> and then I want to get back.)
> To my delight, I discovered that `window-configuration-to-register' and
> `jump-to-register' do exactly that.  Wow!  I've been using Emacs for
> almost 15 years now, people, and I missed /that/!
> OTOH, a simple experiment showed that this does /not/ restore the text
> scale (changed by `C-x C--' and `C-x C-=').  Not that it's a real
> problem (although it /does/ influence what is actually visible), but
> that made me think: what exactly is a "window configuration"?  I found
> out that the docstring for `current-window-configuration' says
>> current-window-configuration is a built-in function in `window.c'.
>> (current-window-configuration &optional FRAME)
>> Return an object representing the current window configuration of FRAME.
>> If FRAME is nil or omitted, use the selected frame.
>> This describes the number of windows, their sizes and current buffers,
>> and for each displayed buffer, where display starts, and the position of
>> point.  An exception is made for point in the current buffer:
>> its value is -not- saved.
>> This also records the currently selected frame, and FRAME's focus
>> redirection (see `redirect-frame-focus').  The variable
>> `window-persistent-parameters' specifies which window parameters are
>> saved by this function.
> This is not extremely precise, though.
> 1. Does it mean that each frame has its own window configuration?
> 2. This mentions "number of windows, their sizes and current buffers";
> apparently, their /positions/ are also saved.
> 3. The sentence "An exception... -not- saved" seems not to be true: in
> my experiments, `C-x r j' restored that also.  (Edit: I've just checked
> the source of `window-configuration-to-register', and that made this
> question redundant.  Still, the manual is ambiguous about this.)
> BTW: the fact that `current-window-configuration' is written in C and
> not in Elisp does not help.  I'd love if more functions were written in
> Elisp; while I admit that the current state of affairs is a nice nudge
> for me to (re)learn some C, it makes /fiddling/ with them more
> cumbersome.  (And I /am/ aware that this is risky -- OTOH, redefining
> e.g. `self-insert-command' /is/ possible[1], so Emacs is not really more
> idiot-proof in this way by means of having it defined in C;-).)
> [1] Don't try this at home, kids. ;-)
> TIA,

reply via email to

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