From: Eli Zaretskii <eliz@gnu.org>
To: Pip Cet <pipcet@gmail.com>
Cc: 21333@debbugs.gnu.org
Subject: bug#21333: 25.0.50; window-size-change-functions not called after mini-window resize
Date: Mon, 24 Aug 2015 22:03:13 +0300 [thread overview]
Message-ID: <83twrofr0u.fsf@gnu.org> (raw)
In-Reply-To: <CAOqdjBf_w0OJ-H7N37JwG-jSDdQN-dG7gMZ2AQDnabpxUK5xmQ@mail.gmail.com>
> Date: Mon, 24 Aug 2015 18:13:29 +0000
> From: Pip Cet <pipcet@gmail.com>
> Cc: 21333@debbugs.gnu.org
>
> Sorry this is a long email
There's long, and there's long. I mean, geeez....
> - Redisplay is so slow that it really doesn't matter that we call an
> extra bit of Lisp code before running it.
I'm not worried by performance aspects of this. And this hook doesn't
slow down redisplay anyway, because redisplay just sets a flag.
> - Doing it "my way" is cheap in terms of performance (I benchmarked),
> easy to implement, enables cool but not necessarily useful hacks, but
> requires very slow hook functions to rate-limit themselves in order to
> keep the minibuffer usable.
This is not about performance. It's about utility and complexity.
Having to program for a system where your hook is called in umpteen
unrelated situations makes your program much more complex and fragile
than it could be if the hook was more accurate.
> - Doing it your way is even cheaper in terms of performance, not very
> hard to implement, requires those hacks to hook into
> pre-redisplay-functions instead, and has the questionable benefit of
> allowing badly-written non-rate-limiting hook functions to keep the
> minibuffer usable, but still break drag-resizing.
Once again, this is not about performance.
> >> I cannot reproduce the behavior with other windows.
> >
> > See above: at least one other window is resized in this recipe, so the
> > exemption is not about the mini-window itself, it's about any window
> > involved in resizing in this particular scenario.
>
> I understand what's happening, but wanted to make clear that the
> mini-window involvement is the decisive factor.
No, it's not. The decisive factor is that the way this is implemented
simply doesn't set the flag in this situation. IOW, the code to set
it wasn't written.
> > That said, I wonder whether changing the code now to call these
> > functions due to automatic resizing would make sense. What would be
> > the real-life use cases for using that?
>
> I am beginning to suspect I'm missing something here. Is there another
> way for windows to find out they're resized?
They are not resized, from my POV.
> For example, I don't see another way to implement dynamic
> fit-image-to-window applications.
>
> What I would consider a valid use case is to call
> doc-view-fit-page-to-window if the window has been resized (of course,
> a practical implementation would ensure that such automatic resize
> operations would not cause a full re-rendering to happen upon every
> size change, but that's an implementation detail).
How is this different from something else, like a tooltip or a
drop-down menu, temporarily obscuring a portion of the display?
If you want to make the hook scroll the display when the minibuffer is
resized, you will cause annoying jumpy display when some Lisp program
repeatedly displays echo-area messages and clears the echo area -- for
example, consider a Lisp compilation of a large buffer that produces
many warnings.
Moreover, you are worried by the last line of a PDF text, but what
about the first one? When the window becomes smaller, some part will
have to disappear from display, there's no way around that. Why
should we care about the last portion more than about the first?
> For something that's less far-fetched, I'm thinking of accessibility
> and automation applications: if you want to point a screen reader to
> the right text to read, you're going to need its X coordinates, which
> might change due to a mini-window resize
But the coordinates of the text that stays on screen don't change in
such a resize. Some text is obscured, but what's left doesn't move.
So I see no problem here.
> Use cases:
> 1. X hacks. I want to do something with the Emacs X windows and need
> to know their coordinates to do so. EXWM, accessibility, compositing
> WM hacks (transparency, duplicating windows, rendering them
> upside-down, whatever), VNC clipping. Most of those are possible
> without a reliable w-s-c-f hook, but are much easier to implement with
> one.
I'm not sure I understand the use case, but if I do, it's impossible:
you need to have redisplay finish before you can ask Emacs about
coordinates of some point. So this cannot be done while the
minibuffer is being resized.
> 2. automatic-resize applications. These, strictly speaking, need to
> know only the window size, not its frame-relative position.
Already covered above. I see no problems here that are specific to
this particular resize.
> 3. things I'm too stupid to think of. I think this is the big one:
> let's leave the feature in and see what smart people come up with.
That's not a use case.
> You appear to be arguing for considering the mini-window a temporary
> overlay that obstructs "real" windows while it exists and goes away
> when it's no longer needed. That's fine, you can have that: create a
> minibuffer-only frame and raise or lower it to your heart's content.
>
> I'm arguing that the mini-window should be treated like any other
> window.
I'm not special-casing the mini-window here. I'm special-casing this
particular case of resizing the windows.
> Let's also consider the potential harm done by both options: not
> calling the hook when I think it should be will result in something
> being done to the wrong buffer.
I don't see why it should, not without a more detailed description.
> Calling the hook "too often" will result, well, for most users, in
> twenty lost CPU cycles as a variable is tested and found to be nil.
Once again, this isn't about performance.
> > If you agree, then the current behavior will make sense to you.
>
> I hope I've made it clear so far that I disagree.
Then I guess we will have to agree to disagree.
> > If anything, IMO we should _reduce_ the number of unrelated events
> > that trigger a call to these functions. For example, currently any
> > command that reads from the minibuffer will trigger it, because when
> > read-from-minibuffer exits, it restores the window configuration by
> > calling set-window-configuration, which is documented to trigger these
> > functions. That just doesn't make any sense to me, since most reads
> > from the minibuffer don't resize any windows!
>
> I believe that's a separate issue.
No, it's not. It's the same issue: this hook is already called in
situations where it shouldn't have been, and thus imposes on the
programmers who use it complex ways of deciding whether there was or
wasn't a change they should care about. You suggest to add one more
situation in that class, something that most application that define
this hook shouldn't and don't care. It's the complexity that worries
me.
> I do not understand why you seem so loath to calling a rarely-used
> hook somewhat more often; I conjecture you might be overestimating the
> cost of checking whether a window's size has actually changed and
> returning if it hasn't. I've attached a test file that uses
> benchmark-run to time a million invocations of the test-and-return
> code, and it takes less than two seconds on this very old machine;
> IOW, to take up 1% of one CPU core, you'd need 5000 resize events per
> second. I can run `redisplay' 20,000 times per second, and that's only
> because those calls return without doing anything. It's cheap.
Once again, this is not about performance. Never was. It's about
complexity, IMO gratuitous in this case. Emacs is already too complex
for this kinds of job due to several hooks that are called
indiscriminately, and leave it to the programmer to figure out whether
some change really happened.
Anyway, it's clear we disagree. I just wanted to voice my protest
against such creeping featurism.
next prev parent reply other threads:[~2015-08-24 19:03 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-23 22:06 bug#21333: 25.0.50; window-size-change-functions not called after mini-window resize Pip Cet
2015-08-24 8:18 ` martin rudalics
2015-08-24 11:08 ` Pip Cet
2015-08-24 12:41 ` martin rudalics
2015-08-24 14:35 ` Eli Zaretskii
2015-08-24 18:06 ` martin rudalics
2015-08-24 18:30 ` Eli Zaretskii
2015-08-25 7:25 ` martin rudalics
2015-08-25 10:34 ` Pip Cet
2015-08-25 15:19 ` Eli Zaretskii
2015-08-26 7:08 ` martin rudalics
2015-08-25 15:11 ` Eli Zaretskii
2015-08-26 7:09 ` martin rudalics
2015-08-26 15:29 ` Eli Zaretskii
2015-08-27 7:57 ` martin rudalics
2015-08-27 15:29 ` Eli Zaretskii
2015-08-27 17:05 ` Pip Cet
2015-08-27 17:59 ` martin rudalics
2015-08-27 18:04 ` Pip Cet
2015-08-28 8:03 ` martin rudalics
2015-08-28 8:19 ` Pip Cet
2015-08-28 8:45 ` Pip Cet
2015-08-27 18:35 ` Eli Zaretskii
2015-08-27 17:58 ` martin rudalics
2015-08-24 18:13 ` Pip Cet
2015-08-24 19:03 ` Eli Zaretskii [this message]
2015-08-25 7:25 ` martin rudalics
2015-08-25 15:12 ` Eli Zaretskii
2015-08-26 7:09 ` martin rudalics
2015-08-26 10:07 ` Pip Cet
2015-08-26 13:01 ` martin rudalics
2015-08-26 16:00 ` Pip Cet
2015-08-27 7:59 ` martin rudalics
2015-08-27 15:25 ` Eli Zaretskii
2015-08-27 16:35 ` Pip Cet
2015-08-27 17:59 ` martin rudalics
2015-08-27 18:57 ` Eli Zaretskii
2015-08-27 20:49 ` Pip Cet
2015-08-28 10:02 ` Eli Zaretskii
2015-08-28 12:34 ` Pip Cet
2015-08-28 13:13 ` Eli Zaretskii
2015-08-28 13:26 ` Pip Cet
2015-08-26 15:36 ` Eli Zaretskii
2015-08-27 7:58 ` martin rudalics
2015-08-27 15:24 ` Eli Zaretskii
2015-08-27 17:58 ` martin rudalics
2015-08-27 18:39 ` Eli Zaretskii
2015-08-27 19:00 ` Eli Zaretskii
2015-08-28 8:04 ` martin rudalics
2015-08-28 8:47 ` Eli Zaretskii
2015-08-28 10:51 ` martin rudalics
2015-08-28 12:46 ` Eli Zaretskii
2015-08-28 13:05 ` martin rudalics
2015-08-26 15:32 ` Eli Zaretskii
2015-08-27 7:57 ` martin rudalics
2016-02-22 12:59 ` Fix `window-configuration-change-hook' and `window-size-change-functions' martin rudalics
2016-02-23 11:31 ` 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=83twrofr0u.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=21333@debbugs.gnu.org \
--cc=pipcet@gmail.com \
/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.