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:26:09 +0100 Message-ID: <87d256jamm.fsf@gnu.org> References: <87lhjujjuy.fsf@gnu.org> <87d256oz82.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1424352398 31285 80.91.229.3 (19 Feb 2015 13:26:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Feb 2015 13:26:38 +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:26:30 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 1YOR7e-00057W-9I for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Feb 2015 14:26:30 +0100 Original-Received: from localhost ([::1]:56339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOR7Y-0000Ev-Oa for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Feb 2015 08:26:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOR7O-0000Ep-SE for help-gnu-emacs@gnu.org; Thu, 19 Feb 2015 08:26:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOR7L-0002ql-LV for help-gnu-emacs@gnu.org; Thu, 19 Feb 2015 08:26:14 -0500 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:46136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOR7L-0002pd-FA for help-gnu-emacs@gnu.org; Thu, 19 Feb 2015 08:26:11 -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 791F01A844E; Thu, 19 Feb 2015 14:26:09 +0100 (CET) Mail-Followup-To: Alexis , help-gnu-emacs@gnu.org In-Reply-To: <87d256oz82.fsf@gmail.com> (Alexis's message of "Thu, 19 Feb 2015 23:35:57 +1100") 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:102808 Archived-At: Alexis writes: > TH> But since wide displays are so common nowadays, there must be an TH> easy > way to achieve what I'm looking for, no? > > Given my own workflow and preferences, i too am very interested in how > to achieve this! FWIW, since nobody replied within 10 minutes, that's what I'm using now: --8<---------------cut here---------------start------------->8--- (setq split-width-threshold 152 split-height-threshold 60) (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))) (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)))))))) (setq split-window-preferred-function #'th/split-window-sensibly) --8<---------------cut here---------------end--------------->8--- That works fine so far. I also modified it so that it is less likely to split dedicated windows. Bye, Tassilo