From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Understanding atomic window groups Date: Wed, 22 May 2019 10:50:57 -0700 Message-ID: <87tvdmqsxq.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="124474"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 22 19:51:17 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTVOW-000WFV-Dp for ged-emacs-devel@m.gmane.org; Wed, 22 May 2019 19:51:16 +0200 Original-Received: from localhost ([127.0.0.1]:48950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTVOV-0007XI-FI for ged-emacs-devel@m.gmane.org; Wed, 22 May 2019 13:51:15 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTVOO-0007XC-RE for emacs-devel@gnu.org; Wed, 22 May 2019 13:51:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTVON-0005CR-Qz for emacs-devel@gnu.org; Wed, 22 May 2019 13:51:08 -0400 Original-Received: from [195.159.176.226] (port=38994 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTVON-0005Bn-Iv for emacs-devel@gnu.org; Wed, 22 May 2019 13:51:07 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1hTVOM-000W1s-5g for emacs-devel@gnu.org; Wed, 22 May 2019 19:51:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:lv7plSYZvJqx2dvNCnyHtjYqWas= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236908 Archived-At: --=-=-= Content-Type: text/plain I'm playing around with adding atomic window support to Gnus, so that help/completion/other-pop-up buffers don't end up squished between the *Summary* and *Article* windows, but instead shift the whole window composition over temporarily. All of Gnus' window configuration goes through one function, `gnus-configure-windows', so it's relatively easy to target. The patch below seems to do the trick. My question is about quitting/removing atomic window compositions. Gnus switches through many different compositions, so it's necessary to be able to quit atomic windows. As you can see in the diff, I've had to manually, and recursively, remove the 'window-atom parameter before reconfiguring windows. Is that the way it's supposed to work? I guess I would have thought there would be an easier way of getting rid of an atomic configuration -- like `quit-window' in any of the windows would quit all of them, or something like that. Instead, `quit-window' seems to just signal an error. Is this how it's supposed to work? Should I be doing this differently? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=gnus-atomic-windows.diff commit 80e9ac12529016a69926dfdc0b1ff6cf619a0751 Author: Eric Abrahamsen Date: Sun Apr 21 11:04:20 2019 -0700 WIP on making Gnus windows atomic diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el index 5f7154c545..d30c8b84ad 100644 --- a/lisp/gnus/gnus-win.el +++ b/lisp/gnus/gnus-win.el @@ -38,6 +38,10 @@ gnus-use-full-window :group 'gnus-windows :type 'boolean) +(defcustom gnus-use-atomic-windows t + "If non-nil, Gnus' window compositions will be atomic." + :type 'boolean) + (defcustom gnus-window-min-width 2 "Minimum width of Gnus buffers." :group 'gnus-windows @@ -401,6 +405,15 @@ gnus-configure-windows (unless (gnus-buffer-live-p nntp-server-buffer) (nnheader-init-server-buffer)) + ;; Remove all 'window-atom parameters, as we're going to blast + ;; and recreate the window layout. + (when-let ((parent (window-parent (selected-window)))) + (when (window-parameter parent 'window-atom) + (walk-window-subtree + (lambda (win) + (set-window-parameter win 'window-atom nil)) + parent t))) + ;; Either remove all windows or just remove all Gnus windows. (let ((frame (selected-frame))) (unwind-protect @@ -422,6 +435,13 @@ gnus-configure-windows (set-buffer nntp-server-buffer) (gnus-configure-frame split) (run-hooks 'gnus-configure-windows-hook) + + ;; If we're using atomic windows, and the current frame has + ;; multiple windows, make them atomic. + (when (and gnus-use-atomic-windows + (window-parent (selected-window))) + (window-make-atom (window-parent (selected-window)))) + (when gnus-window-frame-focus (select-frame-set-input-focus (window-frame gnus-window-frame-focus))))))))) --=-=-=--