From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Dedicated window troubles Date: Thu, 19 Feb 2015 14:32:28 +0100 Message-ID: <878ufujac3.fsf@gnu.org> References: <87lhjujjuy.fsf@gnu.org> <87d256oz82.fsf@gmail.com> <87d256jamm.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1424352778 5323 80.91.229.3 (19 Feb 2015 13:32:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Feb 2015 13:32:58 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Alexis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 19 14:32:49 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YORDk-0007gS-FW for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Feb 2015 14:32:48 +0100 Original-Received: from localhost ([::1]:56356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YORDj-0002cG-RY for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Feb 2015 08:32:47 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YORDX-0002cA-Ix for help-gnu-emacs@gnu.org; Thu, 19 Feb 2015 08:32:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YORDQ-0008U4-Uc for help-gnu-emacs@gnu.org; Thu, 19 Feb 2015 08:32:35 -0500 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:46605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YORDQ-0008Tl-OT for help-gnu-emacs@gnu.org; Thu, 19 Feb 2015 08:32:28 -0500 Original-Received: from thinkpad-t440p (dhcp159.uni-koblenz.de [141.26.71.159]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 8C68B1A844E; Thu, 19 Feb 2015 14:32:28 +0100 (CET) Mail-Followup-To: Alexis , help-gnu-emacs@gnu.org In-Reply-To: <87d256jamm.fsf@gnu.org> (Tassilo Horn's message of "Thu, 19 Feb 2015 14:26:09 +0100") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.15 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102809 Archived-At: Argh, never fiddle with code in an email message. It can only be wrong. So here's a corrected version: --8<---------------cut here---------------start------------->8--- (defun th/split-window-sensibly (&optional window) "Split WINDOW in a way suitable for `display-buffer'. Like `split-window-sensibly' but first try horizontal splits, then vertical splits, and also try not to split dedicated windows." (let ((window (or (and window (not (window-dedicated-p window)) window) (selected-window)))) (or (and (window-splittable-p window t) ;; Split window horizontally. (with-selected-window window (split-window-right))) (and (window-splittable-p window) ;; Split window vertically. (with-selected-window window (split-window-below))) (and (eq window (frame-root-window (window-frame window))) (not (window-minibuffer-p window)) ;; If WINDOW is the only window on its frame and is not the ;; minibuffer window, try to split it vertically disregarding ;; the value of `split-height-threshold'. (let ((split-height-threshold 0)) (when (window-splittable-p window) (with-selected-window window (split-window-below)))))))) --8<---------------cut here---------------end--------------->8--- Bye, Tassilo