From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: moving window handling into lisp Date: Wed, 12 Aug 2009 10:56:56 +0200 Message-ID: <4A8283D8.6070208@gmx.at> References: <4A6DAD94.8040006@gmx.at> <4A6DAF71.6070002@gmx.at> <4A6DBB3A.90001@gmx.at> <4A6DC1A1.2000208@gmx.at> <4A6DDB61.8090403@gmx.at> <4A6EAB02.6080701@gmx.at> <4A7010D7.3050305@gmx.at> <4A81374E.9050401@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1250067547 10442 80.91.229.12 (12 Aug 2009 08:59:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Aug 2009 08:59:07 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 12 10:59:00 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mb9fe-0000hK-LW for ged-emacs-devel@m.gmane.org; Wed, 12 Aug 2009 10:58:58 +0200 Original-Received: from localhost ([127.0.0.1]:60374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mb9fc-0003bi-IQ for ged-emacs-devel@m.gmane.org; Wed, 12 Aug 2009 04:58:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mb9do-0002vh-Om for emacs-devel@gnu.org; Wed, 12 Aug 2009 04:57:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mb9dk-0002u2-4s for emacs-devel@gnu.org; Wed, 12 Aug 2009 04:57:04 -0400 Original-Received: from [199.232.76.173] (port=52976 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mb9dj-0002tu-TZ for emacs-devel@gnu.org; Wed, 12 Aug 2009 04:56:59 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:39407) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Mb9dj-0004a5-59 for emacs-devel@gnu.org; Wed, 12 Aug 2009 04:56:59 -0400 Original-Received: (qmail invoked by alias); 12 Aug 2009 08:56:57 -0000 Original-Received: from 62-47-48-137.adsl.highway.telekom.at (EHLO [62.47.48.137]) [62.47.48.137] by mail.gmx.net (mp053) with SMTP; 12 Aug 2009 10:56:57 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18TG0AJTLwTD/yPlAa84XkSoE+HAd1/d2/hYzFOxJ qvKNPPcuywThRq User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) In-Reply-To: X-Y-GMX-Trusted: 0 X-FuHaFi: 0.66 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114132 Archived-At: > There'd be new low-level functions to resize windows which would work in > simple and predictable ways, but with the end-state being potentially > invalid. And how'd we revert to a valid state? Using `set-window-configuration'? Wasn't that something you wanted to avoid? >> I suppose we should merge these functions into one Elisp function that >> moves the trailing edge of a window and have one C function checking >> whether the resulting window tree is well-formed and, if that is the >> case, apply the change. > > As a "high-level" function, I'd imagine a function that looks like > (window-resize W N) and returns the amount that it was able to resize > (between 0 and N). > It would work by calling itself recursively ... For modeline dragging we need a function which resizes a window by moving _one edge_ only (which can be either the leading or the trailing one). If, in addition, we want to call that function recursively we must be able to specify _which edge_ it should move, that is, it must be able to move trailing _and_ leading edges. Moreover, we probably want to specify whether the function is allowed to delete windows, resize windows below `window-min-height' or `window-min-width', or ignore the value of `window-size-fixed'. Also I think that a call with N > 1 failing to resize the window should be able to result in an abort. An application that can't get a window of the appropriate size might prefer to use a new frame and leave the original configuration unchanged. Should it do that by saving the window configuration and restoring it provided the amount returned by `window-resize' doesn't fit its needs? > ... on siblings and/or children. Including siblings of the window's parent, grandparent, ... I suppose. > It can't fail and cannot result in an invalid window-tree. IMO `window-resize' should be written in Elisp while the check whether a window tree is invalid would reside in C to guarantee that Elisp code never crashes Emacs. I'm not sure about the interface though. I imagine primitives like say `book-window-parent', `book-window-top', `book-window-lines', ... and have a function checking-in the booked values by (1) checking whether the booked values form a valid window tree and, if that is the case, (2) replacing the actual values by the booked values. martin