all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Andrea Cardaci <cyrus.and@gmail.com>, Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Zoom: a window management minor mode -- best practices and questions
Date: Thu, 03 May 2018 09:11:18 +0200	[thread overview]
Message-ID: <5AEAB616.4040900@gmx.at> (raw)
In-Reply-To: <CACMsj9N_1NhujXZ5r6kAxm6X+4bOTnpjroD2wHaw5jG5vtEFvw@mail.gmail.com>

 > The handler should be triggered in these cases:
 > - a window is resized;
 > - a window is selected;
 > - a window is created (this is actually included in the "a window is resized"
 > case);
 > - a window changes its buffer (because it's possible to exclude certain
 > windows from zooming so the layout should be updated accordingly).

There are probably other ones like when a window gets deleted or the
configuration changes but all these should get caught by your code.
I'm not sure why hooking 'minibuffer-setup-hook' is needed, I suppose
it is not, at least for Emacs 26.  Other than that your code seems
valid to me (even disabling 'window-configuration-change-hook' in
'balance-windows' is OK, that hook should not get called there any
more).

Obviously, 'window-size-change-functions' is meant for applications to
react to size changes and possibly readjust buffer text shown in a
window whose size changed.  You should warn other applications to make
sure they _append_ their functions to this hook in order to be aware
of your adjustments.  Maybe you should re-prepend your function when
you find out that other ones have been prepended in between.

Otherwise, I would use 'buffer-list-update-hook' instead of advising
'select-window' to make sure that all occurences of selecting a window
get caught.  And I would experimentally try to not zoom immediately in
'buffer-list-update-hook' and 'window-configuration-change-hook' but
simply feed these occurrencs to 'pre-redisplay-function' to reduce the
number of times you zoom.  'window-pixel-height-before-size-change'
and 'window-pixel-width-before-size-change' should allow to easily do
the 'window-size-change-functions' part in 'pre-redisplay-function' as
well.  Though my personal experiences with 'pre-redisplay-function'
are not bright enough to recommend it for sure.

martin



  parent reply	other threads:[~2018-05-03  7:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 16:31 Zoom: a window management minor mode -- best practices and questions Andrea Cardaci
2018-05-02 17:32 ` Eli Zaretskii
2018-05-02 18:41   ` Andrea Cardaci
2018-05-02 18:58     ` Eli Zaretskii
2018-05-03  7:11       ` martin rudalics
2018-05-03  9:50         ` Andrea Cardaci
2018-05-03  9:46       ` Andrea Cardaci
2018-05-03  7:11     ` martin rudalics [this message]
2018-05-03  9:47       ` Andrea Cardaci
2018-05-07 12:32         ` Andrea Cardaci
2018-05-07 18:19           ` Eli Zaretskii
2018-05-08 10:40             ` Andrea Cardaci
2018-05-08 14:53               ` Noam Postavsky
2018-05-08 15:03                 ` Andrea Cardaci
2018-05-09 12:33                 ` Stefan Monnier
2018-05-08 17:52               ` Eli Zaretskii
2018-05-09  7:00           ` martin rudalics
2018-05-09 16:06             ` Andrea Cardaci
2018-05-10  6:27               ` martin rudalics
2018-05-10 10:11                 ` Andrea Cardaci
2018-05-10 10:27                   ` martin rudalics
2018-05-10 10:34                     ` Andrea Cardaci
2018-05-10 10:37                       ` martin rudalics

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

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

  git send-email \
    --in-reply-to=5AEAB616.4040900@gmx.at \
    --to=rudalics@gmx.at \
    --cc=cyrus.and@gmail.com \
    --cc=eliz@gnu.org \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.