unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-devel@gnu.org
Subject: Understanding atomic window groups
Date: Wed, 22 May 2019 10:50:57 -0700	[thread overview]
Message-ID: <87tvdmqsxq.fsf@ericabrahamsen.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-atomic-windows.diff --]
[-- Type: text/x-patch, Size: 1819 bytes --]

commit 80e9ac12529016a69926dfdc0b1ff6cf619a0751
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
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	other threads:[~2019-05-22 17:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 17:50 Eric Abrahamsen [this message]
2019-05-23  8:39 ` Understanding atomic window groups martin rudalics
2019-05-23 20:14   ` Eric Abrahamsen
2019-05-24  8:01     ` martin rudalics
2019-05-24  8:24       ` Eli Zaretskii
2019-05-24 21:32       ` Eric Abrahamsen
2019-05-25  7:59         ` martin rudalics
2019-05-25  8:13           ` Eli Zaretskii
2019-06-03  9:11             ` martin rudalics
2019-06-03 15:10               ` Eli Zaretskii
2019-05-25 16:26           ` Eric Abrahamsen
2019-05-25 17:54             ` Eric Abrahamsen
2019-06-03  9:13               ` martin rudalics
2019-06-03  9:12             ` martin rudalics
2019-06-03 21:03               ` Eric Abrahamsen
2019-06-04  8:20                 ` martin rudalics
2019-06-04 17:28                   ` Eric Abrahamsen
2019-06-11 21:07                   ` Eric Abrahamsen
2019-06-15  8:16                     ` martin rudalics
2019-06-15 15:47                       ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tvdmqsxq.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).