emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: moving window handling into lisp


From: Stefan Monnier
Subject: Re: moving window handling into lisp
Date: Wed, 29 Jul 2009 10:05:51 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]