From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: moving window handling into lisp Date: Wed, 29 Jul 2009 10:05:51 -0400 Message-ID: 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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248876659 6952 80.91.229.12 (29 Jul 2009 14:10:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Jul 2009 14:10:59 +0000 (UTC) Cc: emacs-devel@gnu.org, Lennart Borgman , Miles Bader To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 29 16:10:51 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 1MW9rm-00071g-OC for ged-emacs-devel@m.gmane.org; Wed, 29 Jul 2009 16:10:51 +0200 Original-Received: from localhost ([127.0.0.1]:50317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MW9rm-0000o4-0h for ged-emacs-devel@m.gmane.org; Wed, 29 Jul 2009 10:10:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MW9nB-0006zf-G6 for emacs-devel@gnu.org; Wed, 29 Jul 2009 10:06:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MW9n7-0006wX-Of for emacs-devel@gnu.org; Wed, 29 Jul 2009 10:06:05 -0400 Original-Received: from [199.232.76.173] (port=46190 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MW9n7-0006wP-IM for emacs-devel@gnu.org; Wed, 29 Jul 2009 10:06:01 -0400 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:7127 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MW9n3-0007Al-S2; Wed, 29 Jul 2009 10:05:58 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAGL0b0pFpZgv/2dsb2JhbACBUtJ3hBEFhxk X-IronPort-AV: E=Sophos;i="4.43,289,1246852800"; d="scan'208";a="42506181" Original-Received: from 69-165-152-47.dsl.teksavvy.com (HELO pastel.home) ([69.165.152.47]) by ironport2-out.teksavvy.com with ESMTP; 29 Jul 2009 10:05:51 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 8237D800B; Wed, 29 Jul 2009 10:05:51 -0400 (EDT) In-Reply-To: <4A7010D7.3050305@gmx.at> (martin rudalics's message of "Wed, 29 Jul 2009 11:05:27 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:113339 Archived-At: >> I'm talking about something else: after having a found a solution >> (i.e. you know exactly the size you want for of each window and it is >> correct for the size of the frame), find a set of calls to >> enlarge/shrink-window (or equivalent) that will bring you from the >> current window configuration to the desired window configuration. > Indeed. Specifying a good interface for that seems tedious. Something > like a function which accepts a list of all windows and their new sizes, > checks whether the sizes add up correctly, and applies them. Yes, that would be basically a set-window-configuration. 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?). - if redisplay happens inbetween, it's an error, and the resulting display will be blank. >> But yes, "finding a solution" is itself a difficult problem. > NP-complete, I suppose. I always wondered whether there are > configurations where your code could produce a suboptimal solution by > stopping to early. If you let my code run longer, you'll see that it often cycles between a few different configurations, but as far as I've been able to tell, those are very similar: it's just a matter of off-by-one issues, usually. Still, there are corner cases where it oscillates a lot more. This is why I put an upper bound rather than "loop until it settles". Stefan