emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Understanding atomic window groups


From: Eric Abrahamsen
Subject: Understanding atomic window groups
Date: Wed, 22 May 2019 10:50:57 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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?

commit 80e9ac12529016a69926dfdc0b1ff6cf619a0751
Author: Eric Abrahamsen <address@hidden>
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)))))))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]