all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@wmi.amu.edu.pl>
To: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: What exactly are "window configurations"?
Date: Wed, 28 Jan 2015 00:58:04 +0100	[thread overview]
Message-ID: <87fvavepyr.fsf@wmi.amu.edu.pl> (raw)

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,

-- 
Marcin Borkowski               This email was proudly sent
http://mbork.pl                from my Emacs.



             reply	other threads:[~2015-01-27 23:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27 23:58 Marcin Borkowski [this message]
2015-01-28  0:08 ` What exactly are "window configurations"? Drew Adams
2015-01-28  2:03 ` Tory S. Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fvavepyr.fsf@wmi.amu.edu.pl \
    --to=mbork@wmi.amu.edu.pl \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.