From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: What exactly are "window configurations"? Date: Wed, 28 Jan 2015 00:58:04 +0100 Message-ID: <87fvavepyr.fsf@wmi.amu.edu.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1422403120 27459 80.91.229.3 (27 Jan 2015 23:58:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 27 Jan 2015 23:58:40 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 28 00:58:40 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YGG1k-0000gg-Se for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Jan 2015 00:58:37 +0100 Original-Received: from localhost ([::1]:50571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGG1k-0006MH-8W for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Jan 2015 18:58:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGG1T-0006B6-2a for help-gnu-emacs@gnu.org; Tue, 27 Jan 2015 18:58:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGG1P-0005JA-Lc for help-gnu-emacs@gnu.org; Tue, 27 Jan 2015 18:58:19 -0500 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:53739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGG1P-0005Im-Cb for help-gnu-emacs@gnu.org; Tue, 27 Jan 2015 18:58:15 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 269F84AA01 for ; Wed, 28 Jan 2015 00:58:13 +0100 (CET) Original-Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fieaH+WASXDD for ; Wed, 28 Jan 2015 00:58:13 +0100 (CET) Original-Received: from localhost (117-116.echostar.pl [213.156.117.116]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id AF7C942061 for ; Wed, 28 Jan 2015 00:58:12 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:808:114:2::50 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102322 Archived-At: 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.