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: 32790@debbugs.gnu.org
Subject: bug#32790: 27.0.50; point jumps unexpectedly after delete-window
Date: Tue, 30 Oct 2018 10:00:07 +0100	[thread overview]
Message-ID: <5BD81D97.2000000@gmx.at> (raw)
In-Reply-To: <87lg6g750v.fsf@mail.linkov.net>

 >> Rather, the function on 'post-command-hook' would have to be more
 >> intelligent - check whether the minibuffer-window is selected and
 >> leave the overriding action untouched in that case.
 >
 > It's possible to implement it with post-command-hook, but the
 > implementation will be more contorted - note that adding a hook
 > to post-command-hook by a command will run it immediately
 > at the end of this command and immediately remove the hook.

The mechanism must be safe in the first place and safety means here to
remove the mechanism before anything bad happens.

 > Whereas window-state-change-functions elegantly checks
 > if the window displays a new buffer.

But it fails when a window gets reused.  In general, any outcome of
'display-buffer' is possible, even 'allow-no-window'.  As soon as
'display-buffer' returns and no change of the window state happened we
are lost.

 >> Moreover, using 'post-command-hook' would automatically fix any
 >> problems when quitting an S-M-up action.  I see no way to catch
 >> quitting via a state change of windows.
 >
 > What do you mean by quitting an S-M-up action?  minibuffer-exit?

Let's say anything C-g does.  I'm not sure whether we can catch that
always via 'minibuffer-exit-hook' though.  But it should not harm to
remove the overriding action in that case as well.

 >> I forgot to ask: If that ffap pops up completions, they will appear
 >> above the selected window.  Right?
 >
 > Right.  Since I agree this is not an expected behavior, here is a better
 > version without this problem.  Instead of display-buffer-overriding-action,
 > it uses display-buffer-alist because only display-buffer-alist
 > supports a condition necessary to check for an active minibuffer.

As a rule, code must never fiddle with 'display-buffer-alist'.  If
anything gets wrong, the user is left with a broken customization.  If
'display-buffer-overriding-action' is not capable of handling this
scenario, then it's useless and we have to provide something better
anyway.

Now 'display-buffer-overriding-action' has the same deficiencies as
'pop-up-frames' and 'pop-up-windows'.  If you bind them around a
minibuffer interaction needed to find the buffer to display, you
affect that minibuffer interaction and any recursive 'display-buffer'
call that interaction emits too.

So what we need is a mechanism that (1) specifies a display action for
a buffer whose identity has not been specified yet at the time
'display-buffer' (or one of its callers) gets called and (2) does not
affect any calls of 'display-buffer' needed to get the identity of the
buffer needed by (1).  I think we agree on that.

So we want to delay the effect of 'display-buffer-overriding-action'
until it applies to the buffer the user had in mind when activating
the key combination.  Since we don't know the name of the buffer yet
(and in the worst case the name of the buffer the user wants to
display in a specific position is that of a buffer needed to find the
name), we need some sort of workaround.  I'm afraid we have to agree
on that as well.

I'm not sure whether checking 'minibuffer-depth' within the function
put on 'display-buffer-overriding-action' is sufficient.  That is,
have the overriding action take effect iff the depth is zero.  Please
check that first (I have no idea why you didn't try that before and
went for setting 'display-buffer-alist' instead).

If it doesn't help, we could equip 'display-buffer' itself with some
sort of recursion depth and allow the S-M- combination to apply only
when the level is zero.  We'd need some sort of escape to reset that
depth when a user aborts the buffer display action.  And it obviously
would disallow recursive application of the S-M- mechanism (like the
'minibuffer-depth' check approach).  So hopefully we find something
better.

But as soon as we have found a solution, we could provide prefixes to
handle all sorts of -same-window/-other-window/-other-frame and the
default display in a similar fashion.

martin





  reply	other threads:[~2018-10-30  9:00 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20 23:33 bug#32790: 27.0.50; point jumps unexpectedly after delete-window Juri Linkov
2018-09-21  6:34 ` martin rudalics
2018-09-22 22:23   ` Juri Linkov
2018-09-23  5:44     ` Eli Zaretskii
2018-09-23  8:27     ` martin rudalics
2018-09-23 20:57       ` Juri Linkov
2018-09-24  8:33         ` martin rudalics
2018-09-24 18:49           ` Juri Linkov
2018-09-25  7:28             ` martin rudalics
2018-09-25 19:28               ` Juri Linkov
2018-09-26  8:51                 ` martin rudalics
2018-09-26 23:05                   ` Juri Linkov
2018-09-27 18:44                     ` martin rudalics
2018-10-15 21:12                       ` Juri Linkov
2018-10-16  8:46                         ` martin rudalics
2018-10-16 22:20                           ` Juri Linkov
2018-10-17  7:30                             ` martin rudalics
2018-10-17 21:30                               ` Juri Linkov
2018-10-18  8:05                                 ` martin rudalics
2018-10-18 22:49                                   ` Juri Linkov
2018-10-19  7:39                                     ` martin rudalics
2018-10-20 21:27                                       ` Juri Linkov
2018-10-21  8:22                                         ` martin rudalics
2018-10-21 18:17                                           ` Juri Linkov
2018-10-22  9:07                                             ` martin rudalics
2018-10-23 20:55                                               ` Juri Linkov
2018-10-24  9:45                                                 ` martin rudalics
2018-10-25 20:48                                                   ` Juri Linkov
2018-10-26  7:41                                                     ` martin rudalics
2018-10-27 19:51                                                       ` Juri Linkov
2018-10-28  8:59                                                         ` martin rudalics
2018-10-28 19:36                                                           ` Juri Linkov
2018-10-29  8:44                                                             ` martin rudalics
2018-10-29 13:45                                                             ` martin rudalics
2018-10-29 22:38                                                               ` Juri Linkov
2018-10-30  9:00                                                                 ` martin rudalics [this message]
2018-10-30 21:42                                                                   ` Juri Linkov
2018-10-31  8:11                                                                     ` martin rudalics
2018-10-31 21:20                                                                       ` Juri Linkov
2018-11-01  9:03                                                                         ` martin rudalics
2018-11-01 22:42                                                                           ` Juri Linkov
2018-11-02  8:44                                                                             ` martin rudalics
2018-11-02 14:36                                                                               ` Drew Adams
2018-11-04 22:01                                                                               ` Juri Linkov
2018-11-05  9:35                                                                                 ` martin rudalics
2018-11-04 22:21                                                                               ` Juri Linkov
2018-11-05  9:36                                                                                 ` martin rudalics
2018-11-05 22:14                                                                                   ` Juri Linkov
2018-11-06  8:48                                                                                     ` martin rudalics
2018-11-06 22:22                                                                                       ` Juri Linkov
2018-11-07  9:23                                                                                         ` martin rudalics
2018-11-07 21:44                                                                                           ` Juri Linkov
2018-11-08  8:52                                                                                             ` martin rudalics
2018-11-08 21:38                                                                                               ` Juri Linkov
2018-11-09  9:08                                                                                                 ` martin rudalics
2018-11-10 21:25                                                                                                   ` Juri Linkov
2018-12-26  2:04                                                                                                 ` Dmitry Gutov
2018-11-08 21:53                                                                                           ` Juri Linkov
2018-11-09  9:13                                                                                             ` martin rudalics
2018-11-10 21:37                                                                                               ` Juri Linkov
2018-11-11  8:51                                                                                                 ` martin rudalics
2018-11-12 23:24                                                                                                   ` Juri Linkov
2018-11-13  9:08                                                                                                     ` martin rudalics
2018-11-13 23:20                                                                                                       ` Juri Linkov
2018-11-14  8:33                                                                                                         ` martin rudalics
2018-11-15  0:15                                                                                                           ` Juri Linkov
2018-11-15  9:13                                                                                                             ` martin rudalics
2018-11-15 22:59                                                                                                               ` Juri Linkov
2018-11-16  8:53                                                                                                                 ` martin rudalics
2018-11-17 22:18                                                                                                                   ` Juri Linkov
2018-11-18  9:24                                                                                                                     ` martin rudalics
2018-11-18 22:52                                                                                                                       ` Juri Linkov
2018-11-19  9:42                                                                                                                         ` martin rudalics
2018-11-19 22:39                                                                                                                           ` Juri Linkov
2018-11-20  9:28                                                                                                                             ` martin rudalics
2018-11-21  0:12                                                                                                                               ` Juri Linkov
2018-11-21  8:19                                                                                                                                 ` martin rudalics
2018-11-21 23:38                                                                                                                                   ` Juri Linkov
2018-11-22  7:40                                                                                                                                     ` martin rudalics
2018-11-22 22:45                                                                                                                                       ` Juri Linkov
2018-11-23  7:39                                                                                                                                         ` martin rudalics
2018-11-24 23:40                                                                                                                                           ` Juri Linkov
2018-11-25  8:23                                                                                                                                             ` martin rudalics
2018-11-25 21:01                                                                                                                                               ` Juri Linkov
2018-11-26  9:33                                                                                                                                                 ` martin rudalics
2018-11-26 23:47                                                                                                                                                   ` Juri Linkov
2018-11-27  6:00                                                                                                                                                     ` Eli Zaretskii
2018-11-27 23:18                                                                                                                                                       ` Juri Linkov
2018-11-28  8:33                                                                                                                                                         ` martin rudalics
2018-11-28 23:25                                                                                                                                                           ` Juri Linkov
2018-11-29  8:30                                                                                                                                                             ` martin rudalics
2018-11-29 22:50                                                                                                                                                               ` Juri Linkov
2018-11-30  8:22                                                                                                                                                                 ` martin rudalics
2018-12-01 22:43                                                                                                                                                                   ` Juri Linkov
2018-12-02  8:34                                                                                                                                                                     ` martin rudalics
2018-12-03  0:45                                                                                                                                                                       ` Juri Linkov
2018-12-03  7:45                                                                                                                                                                         ` martin rudalics
2018-12-20 23:28                                                                                                                                                                           ` Juri Linkov
2018-12-21  9:14                                                                                                                                                                             ` martin rudalics
2018-12-22 23:34                                                                                                                                                                               ` Juri Linkov
2018-12-23  9:40                                                                                                                                                                                 ` martin rudalics
2018-11-27  8:08                                                                                                                                                     ` martin rudalics
2018-11-04 22:07                               ` Juri Linkov
2018-11-05  9:35                                 ` martin rudalics
2018-11-05 22:12                                   ` Juri Linkov
2018-11-06  8:47                                     ` martin rudalics
2018-11-21 23:35   ` Juri Linkov
2018-11-22  7:40     ` martin rudalics
2018-11-22 22:39       ` Juri Linkov
2018-11-23  7:40         ` martin rudalics
2018-11-24 23:20           ` Juri Linkov
2018-11-25  8:24             ` martin rudalics
2018-11-26 23:53       ` Juri Linkov
2018-11-27  8:08         ` martin rudalics
2018-11-27 23:28           ` Juri Linkov
2018-11-28  8:33             ` martin rudalics
2018-09-21  6:55 ` Eli Zaretskii
2018-09-22 22:34   ` Juri Linkov
2018-09-23  8:28     ` martin rudalics
2018-09-23 10:56     ` Eli Zaretskii
2018-09-23 20:49       ` Juri Linkov
2018-09-24  8:23         ` martin rudalics
2018-09-24  8:30           ` Eli Zaretskii
2018-09-24 12:25             ` martin rudalics
2018-09-24 18:53           ` Juri Linkov
2018-09-25  7:28             ` martin rudalics
2019-11-24 23:19 ` Juri Linkov

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=5BD81D97.2000000@gmx.at \
    --to=rudalics@gmx.at \
    --cc=32790@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).