unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Juri Linkov <juri@linkov.net>
Cc: 32672@debbugs.gnu.org
Subject: bug#32672: 27.0.50; image resize on window resizing
Date: Sun, 28 Oct 2018 09:59:05 +0100	[thread overview]
Message-ID: <5BD57A59.2070502@gmx.at> (raw)
In-Reply-To: <87zhuzgx9u.fsf@mail.linkov.net>

 >>> Your proposed window-state-change-functions would match window-state-get
 >>> very well, e.g. it could call the hook with an argument containing alist
 >>> of values that really changed, where elements of the alist could have
 >>> the same keys as in alist returned from window-state-get,
 >>
 >> Retaining the nomenclature of 'window-state-get' is part of the plan.
 >> But I'm not sure whether we want to retain all of what is recorded in
 >> a window state.
...
 > Here is a complete implementation that works well when tested
 > on display-buffer-directionally in bug#32790

But tying this to the execution of commands misses the point that we
would have to react to state changes whenever a frame is redisplayed.
That is, we would miss all asynchronous, non-command-bound changes in
a frame.

What 'window-state-change-functions' would have to do IMO is:

(1) Record, for each frame, whether window states might have changed
     since the last redisplay of the frame.  That means to set a
     frame's flag whenever the buffer of a window, its selectedness or
     its start point changed.  The reason I'd do this is to avoid the
     costly pre-analysis in (2), for example, after each self-insertion
     or any other change of buffer text.

(2) During redisplay, check whether that flag was set and if so
     compare all windows on that frame with the state recorded during
     last redisplay.  As we do for 'window-size-change-functions'
     already now but also check all window related things like those
     from (1).  If and only if something changed, run the functions on
     'window-state-change-functions' providing them information of what
     has changed - a new window w was made, the buffer of window w has
     changed and b was its buffer during last redisplay, w was selected
     and ww was the window selected during last redisplay and so on.
     Or just give them the old state with, say, window buffers instead
     of window buffer names and the previous and next buffers of each
     window elided (these would be too costly to maintain and analyze,
     I think).  Thereafter, record the new state of the frame and clear
     the flag.

This would improve on the current 'window-configuration-change-hook'
in two regards: We'd run it less often (remember the number of calls
you cited earlier) and we'd run it more accurately (that is, only when
and always when something did really change).

The hard part to code such a thing is _how_ to provide the information
of what has changed.  There are three major elements:

(a) Windows that were added.  Trivial.

(b) Windows that were deleted.  Trivial.

(c) Windows where something changed (size, buffer, start position,
     dedicatedness, a window parameter, 'quit-restore' ???, ...).
     Non-trivial.

Note that not providing that information will mean that the function
run by the hook would have to manually compare the old state with the
present one in order to find out what has changed, much as what they
would do for size changes already now.

 > (it doesn't handle
 > window-point because then the hook is called too often):

I suppose we could but only when it's written back, that is, changing
point of the buffer shown in the selected window wouldn't count but
writing it back into 'window-point' when selecting another window
would.  But in principle I agree with what you mean here.

martin





  reply	other threads:[~2018-10-28  8:59 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-09 15:54 bug#32672: 27.0.50; image resize on window resizing Juri Linkov
2018-09-11 23:53 ` Juri Linkov
2018-09-12  6:33   ` martin rudalics
2018-09-12 23:18     ` Juri Linkov
2018-09-13  7:46       ` martin rudalics
2018-09-13 23:20         ` Juri Linkov
2018-09-14  8:33           ` martin rudalics
2018-09-15 23:35             ` Juri Linkov
2018-09-16  9:10               ` martin rudalics
2018-09-16 23:49                 ` Juri Linkov
2018-09-17  6:46                   ` martin rudalics
2018-09-17 22:35                     ` Juri Linkov
2018-09-19  8:22                       ` martin rudalics
2018-09-19 23:15                         ` Juri Linkov
2018-09-20  7:34                           ` martin rudalics
2018-09-20 23:15                             ` Juri Linkov
2018-09-21  6:34                               ` martin rudalics
2018-09-22 22:15                                 ` Juri Linkov
2018-09-23  8:26                                   ` martin rudalics
2018-09-23 20:39                                     ` Juri Linkov
2018-09-24  8:22                                       ` martin rudalics
2018-09-24  8:35                                         ` Eli Zaretskii
2018-09-24 12:25                                           ` martin rudalics
2018-09-24 12:46                                             ` Eli Zaretskii
2018-09-24 17:37                                               ` martin rudalics
2018-09-24 17:53                                                 ` Eli Zaretskii
2018-09-25  7:26                                                   ` martin rudalics
2018-09-25  9:19                                                     ` Eli Zaretskii
2018-09-25 17:56                                                       ` martin rudalics
2018-09-25 18:31                                                         ` Eli Zaretskii
2018-09-24 18:38                                           ` Juri Linkov
2018-09-24 19:31                                             ` Eli Zaretskii
2018-09-25  7:27                                             ` martin rudalics
2018-09-25 19:24                                               ` Juri Linkov
2018-09-26  8:51                                                 ` martin rudalics
2018-10-27 19:38                                                   ` Juri Linkov
2018-10-28  8:59                                                     ` martin rudalics [this message]
2018-09-24 18:31                                         ` Juri Linkov
2018-09-25  7:27                                           ` martin rudalics
2018-12-26 23:42 ` Juri Linkov
2018-12-27  9:36   ` martin rudalics
2018-12-27 21:41     ` Juri Linkov
2018-12-28  8:34       ` martin rudalics
2018-12-27 15:48   ` Eli Zaretskii
2018-12-27 20:58     ` Juri Linkov
2018-12-28  4:51       ` Eli Zaretskii
2019-09-26 13:27   ` Lars Ingebrigtsen
2019-11-27 21:53     ` Juri Linkov
2019-11-28  9:20       ` martin rudalics
2019-11-28 22:50         ` Juri Linkov
2019-11-29  9:24           ` 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

  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=5BD57A59.2070502@gmx.at \
    --to=rudalics@gmx.at \
    --cc=32672@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /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).