>From 48b94c157144230f9e955d4b94202ee152f3d820 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Thu, 23 May 2019 13:41:47 -0700 Subject: [PATCH] Add atomic window support to Gnus * lisp/gnus/gnus-win.el (gnus-use-atomic-windows): New option governing behavior, default to nil. (gnus-configure-windows): Add and remove 'atomic-window parameter when switching window configurations. * doc/misc/gnus.texi (Window Layout): Document. --- doc/misc/gnus.texi | 6 ++++++ lisp/gnus/gnus-win.el | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index b9c91a02a3..c09d9dc47f 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -22918,6 +22918,12 @@ Window Layout to fiddle with @code{gnus-tree-minimize-window} to avoid having the windows resized. +@vindex gnus-use-atomic-windows +Lastly, when you've got a multiple-window layout, Gnus can treat them +as one ``atomic window'' with regards to help or completion pop-up +windows (@pxref{Atomic Windows, , Atomic Windows, elisp}). Set @code{gnus-use-atomic-windows} +to a non-@code{nil} value to enable this. + @subsection Window Configuration Names Here's a list of most of the currently known window configurations, diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el index 40c5b42d45..04d9e40884 100644 --- a/lisp/gnus/gnus-win.el +++ b/lisp/gnus/gnus-win.el @@ -39,6 +39,10 @@ gnus-use-full-window :group 'gnus-windows :type 'boolean) +(defcustom gnus-use-atomic-windows nil + "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 @@ -402,6 +406,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 (window-parameter nil 'window-atom) + (let ((root (window-atom-root))) + (walk-window-subtree + (lambda (win) + (set-window-parameter win 'window-atom nil)) + root t))) + ;; Either remove all windows or just remove all Gnus windows. (let ((frame (selected-frame))) (unwind-protect @@ -423,6 +436,11 @@ gnus-configure-windows (set-buffer nntp-server-buffer) (gnus-configure-frame split) (run-hooks 'gnus-configure-windows-hook) + + (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))))))))) -- 2.21.0