From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: Patch: prefer-window-split-horizontally Date: Wed, 15 Aug 2007 17:49:36 +0200 Message-ID: <87odh8vlv3.fsf@baldur.tsdh.de> References: <87bqdajcr1.fsf@baldur.tsdh.de> <87vebij5p8.fsf@jurta.org> <87eji5wear.fsf@baldur.tsdh.de> <42925.128.165.123.18.1187191448.squirrel@webmail.lanl.gov> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1187193003 25558 80.91.229.12 (15 Aug 2007 15:50:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Aug 2007 15:50:03 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 15 17:49:59 2007 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 1ILL89-0001ab-J5 for ged-emacs-devel@m.gmane.org; Wed, 15 Aug 2007 17:49:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ILL88-0003KW-VR for ged-emacs-devel@m.gmane.org; Wed, 15 Aug 2007 11:49:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ILL86-0003KH-7V for emacs-devel@gnu.org; Wed, 15 Aug 2007 11:49:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ILL84-0003K5-NQ for emacs-devel@gnu.org; Wed, 15 Aug 2007 11:49:52 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ILL84-0003K2-Du for emacs-devel@gnu.org; Wed, 15 Aug 2007 11:49:52 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ILL83-0006HF-Qq for emacs-devel@gnu.org; Wed, 15 Aug 2007 11:49:52 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1ILL7w-0004Q5-35 for emacs-devel@gnu.org; Wed, 15 Aug 2007 17:49:44 +0200 Original-Received: from dslb-084-063-029-201.pools.arcor-ip.net ([84.63.29.201]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 15 Aug 2007 17:49:44 +0200 Original-Received: from tassilo by dslb-084-063-029-201.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 15 Aug 2007 17:49:44 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 52 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: dslb-084-063-029-201.pools.arcor-ip.net Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAD1BMVEU8PDyjo6P5+fm+v8F/ gIO4imEzAAAACXBIWXMAAArrAAAK6wGCiw1aAAAATnRFWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYA CmV4aWYKICAgICAgMjAKNDU3ODY5NjYwMDAwNGQ0ZDAwMmEwMDAwMDAwODAwMDAwMDAwMDAwMAqJ uBZbAAAACXZwQWcAAAAwAAAAMADO7oxXAAABnklEQVQ4y6WU0YGDIAyGozIAFAY4iAM0iQNAZf+Z LkBrr1f7cseDIp8JyZ8ApA8D/gaiI/9cQne5A6wAcJCYwcwdIEEbbqyH/tGBZHjZ6apgbuALgF/2 XQfArK826CB5gGGA3gUNr9taMApkGLQIbIYeatRNQVcaiBbgCG6ADRadu77aqJo07w3M3W0bdQIo /a+HBQ4/pT1Y/2pRhZaeNTsRBTvlAlPMD6C+kS2UIEvZN7hnHsckwkT+koyjh1ZxTK5QZPdozEWl W7qIum60CJVMIcnGX7um0DWbVIy6Wc+ca6WeGHTNluTIiBNJa65yO0oLN/Q0sTAjglExj2ZglOvC CZNgzvUHQJE8tSIThzTqcy+qBFN6TTz9bB+kAE5rtBo2ifkJKM+roIK8EOPlAGg1GWFJuAEz3V5a tAHxuDmXf/WuZ4w7Ct1b5gmcYJo1ujcQVahNMxf7+xgUlnXHYOYTwMGY/HZwnIalnuobiF4VoxOL VCQ++vsVRKfBLmfA+O3UIgXv8ilIJcD5OQ92PgcrfLgZvvKnK2P9zyXzDWhiiUxowX0ZAAAAGnpU WHRqcGVnOmNvbG9yc3BhY2UAAHjaMwIAADMAM4k4IzUAAAAmelRYdGpwZWc6c2FtcGxpbmctZmFj dG9yAAB42jOqMNIxrDAEYQARgwLpPZcvTwAAAABJRU5ErkJggg== User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:fy3pLRqrXb0jXzgRrVYhPnw7UgY= X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) 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:76576 Archived-At: "Davis Herring" writes: Hi Davis, >> I think your approach would do that. This example function would split >> horizontally as long as all windows are 80 or more columns wide. >> >> --8<---------------cut here---------------start------------->8--- >> (defun th-split-window-function () >> (save-window-excursion >> (save-excursion >> (split-window-horizontally) >> (balance-windows) >> (if (>= (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 >> edges))) 80) >> 'split-window-horizontally >> 'split-window-vertically)))) >> --8<---------------cut here---------------end--------------->8--- >> >> Would you try to implement that? > > Splitting one window should not involve destroying all Lisp references > to existing windows (as `save-window-excursion' must). Unless > redisplay would somehow be supressed here (I'm not sure), this would > also involve calling `window-size-change-functions' twice for each > split, which would be wasteful and perhaps confusing. Is there another way to figure out how wide the windows that would result from a horizontal split would be? And if you want to avoid the problems you mentioned, you could go with: --8<---------------cut here---------------start------------->8--- (defun th-split-window-function () (if (>= (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))) 162) 'split-window-horizontally 'split-window-vertically)) --8<---------------cut here---------------end--------------->8--- I don't use scroll bars, so if the current window is 162 columns wide a horizontal split will result in two 80 column wide windows. Two columns will be occupied by the additional fringe. Anyway, I like Juri's suggestion because it gives the user a very good control over splitting decisions. Bye, Tassilo -- A morning without coffee is like something without something else.