From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: moving window handling into lisp Date: Tue, 11 Aug 2009 21:29:52 +0200 Message-ID: References: <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=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1250019153 22637 80.91.229.12 (11 Aug 2009 19:32:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Aug 2009 19:32:33 +0000 (UTC) Cc: martin rudalics , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 11 21:32:25 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 1Max56-00076S-0C for ged-emacs-devel@m.gmane.org; Tue, 11 Aug 2009 21:32:24 +0200 Original-Received: from localhost ([127.0.0.1]:58118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Max54-0008Hk-9B for ged-emacs-devel@m.gmane.org; Tue, 11 Aug 2009 15:32:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Max2k-0007ie-A5 for emacs-devel@gnu.org; Tue, 11 Aug 2009 15:29:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Max2f-0007gb-Go for emacs-devel@gnu.org; Tue, 11 Aug 2009 15:29:57 -0400 Original-Received: from [199.232.76.173] (port=59903 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Max2f-0007gW-BX for emacs-devel@gnu.org; Tue, 11 Aug 2009 15:29:53 -0400 Original-Received: from mail-yw0-f186.google.com ([209.85.211.186]:33890) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Max2e-0001A7-Vp for emacs-devel@gnu.org; Tue, 11 Aug 2009 15:29:53 -0400 Original-Received: by ywh16 with SMTP id 16so6203551ywh.24 for ; Tue, 11 Aug 2009 12:29:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=t/r22t8sQgfnTMkDRrgJVXtlVZsO6Klcnu6BdLAGCkM=; b=hcM4m77g7uTRhnHN13tYvP8fAy8+LbhbGU45KIX4qWs606AHPiKJknuOi9yYdbujr6 lAyDX9YqQbtH6kVX7iw4ID984pVjKX4iLU6FkKKA+tLvGeIlD6UoiuMvhEjTbylHhduP sohthkA5wJCh/FC61vKNjewqNI3JyfS0TygNs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=fnTxJZIO8ajEQDbxxijTeqAw2Sz/onorAW+zIEWQrVhOhglPuL7RYnf2KOkOT3rNOc JPwD/uWdMp4rx68EvjprpadKAdY94qE97xZYMH1UnRqeWeC3em3W67jreFT/TEURSxAz ILtf6odBfvkETvqntGrvOmoTQ15j/fC3SxTBE= Original-Received: by 10.100.252.13 with SMTP id z13mr5921099anh.24.1250018992155; Tue, 11 Aug 2009 12:29:52 -0700 (PDT) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:114095 Archived-At: On Tue, Aug 11, 2009 at 9:16 PM, Stefan Monnier wrote: >>> Another approach is to have a transactional interface, like >>> start-window-configuration and end-window-configuration: >>> - during the transaction, windows can be resized to too-large/too-small >>> sizes (but maybe window-fixed-size should stil be obeyed?). > >> This would still rely on some predictable behavior of `enlarge-window', >> `adjust-window-trailing-edge' and `size_window'. > > 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. > >> 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 on siblings and/or children. > It can't fail and cannot result in an invalid window-tree. I promised Martin a recipe that I belive could avoid making the problem np-complete. It is very simple, and maybe along the lines Stefan is thinking. It is just like this: Note: This recipe is for doing it logically, so "split" means a logical thing in a logical tree. The actual window splitting is done later after computation. 1) Make a logical representation of the window tree where you split as necessary. 2) Walk this logical tree bottom up collecting minimum required window sizes. 3) Walk top bottom-wise applying the sizes as they could be. 4) Apply the splitting and the computed sizes to the window tree. Step 3 could of course fail if the minimum sizes does not fit. Step 4 should be know problem in itself (fi the needed primitives are available of course). I "forgot" taking some things into account above, perhaps. Is the description of the algorithm structure clear? Am I misunderstanding this, or?