From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Help with windows and 'quit-restore Date: Mon, 27 Feb 2017 17:01:41 -0800 Message-ID: <87shmz86x6.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488243753 32552 195.159.176.226 (28 Feb 2017 01:02:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 28 Feb 2017 01:02:33 +0000 (UTC) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/26.0 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 28 02:02:26 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciWBM-0007aM-SD for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Feb 2017 02:02:24 +0100 Original-Received: from localhost ([::1]:57937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciWBS-00042S-Sw for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Feb 2017 20:02:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciWAz-00042M-PY for help-gnu-emacs@gnu.org; Mon, 27 Feb 2017 20:02:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciWAw-0003sF-Mp for help-gnu-emacs@gnu.org; Mon, 27 Feb 2017 20:02:01 -0500 Original-Received: from [195.159.176.226] (port=45260 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ciWAw-0003s0-GR for help-gnu-emacs@gnu.org; Mon, 27 Feb 2017 20:01:58 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ciWAm-0004VR-CS for help-gnu-emacs@gnu.org; Tue, 28 Feb 2017 02:01:48 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 51 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:e4fHHdSAfnFlb1E8BzmuvXnc6Xs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:112395 Archived-At: I'm having a heck of a time understanding how the 'quit-restore window parameter actually works. I've got a pop-up window that goes into special-mode, and I'm trying to get the right level of control over both the window splitting, and the behavior of "q" (quit-window). First it was the "manual way": #+BEGIN_SRC elisp (let* ((buf (get-buffer-I-want-to-pop-up)) (window (get-window-I-want-to-split)) (buffer-window (split-window window 0.5 'right))) (set-window-buffer buffer-window buf) (display-buffer-record-window 'window buffer-window buf)) #+END_SRC The SIZE and SIDE args to `split-window' are calculated elsewhere, just hard-coded in my cut-down example. This allows me to split windows exactly as I want. This call to `display-buffer-record-window', however, does *not* set up the `quit-restore parameter correctly: when I hit "q" in the buffer, the buffer quits but the popped-up window remains, displaying some other buffer, usually a copy of a buffer that's already visible. I can get a perfect 'quit-restore with the "automatic way": #+BEGIN_SRC elisp (display-buffer buf `(display-buffer-pop-up-window . ((window-height . 0.5)))) #+END_SRC Again, cut down to show the final effect. This gives me exactly the quit-restore behavior I want, but the window splitting is erratic: Emacs tries to DTRT, but it isn't TRT, and no amount of fiddling with the `split-*-threshold' variables works. It's forever splitting the wrong window, or splitting it the wrong way. So I think what I want is to stick with the former incantation, but learn how to call `display-buffer-record-window' correctly. I followed `display-buffer-pop-up-window' as far as I could, but really can't see how it builds its 'quit-restore. Can anyone point me to the correct call for that? Or reveal some better solution to the problem? Thanks, Eric