From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#32790: 27.0.50; point jumps unexpectedly after delete-window Date: Tue, 30 Oct 2018 00:38:08 +0200 Organization: LINKOV.NET Message-ID: <87lg6g750v.fsf@mail.linkov.net> References: <87efdnsp2k.fsf@mail.linkov.net> <87a7nedidg.fsf@mail.linkov.net> <5BC5A558.9010401@gmx.at> <87zhvd7mg9.fsf@mail.linkov.net> <5BC6E52F.2070209@gmx.at> <87woqgw9a7.fsf@mail.linkov.net> <5BC83EC9.1090808@gmx.at> <877eiena58.fsf@mail.linkov.net> <5BC98A26.1030901@gmx.at> <87woqcnwas.fsf@mail.linkov.net> <5BCC3757.9020204@gmx.at> <87bm7njk2f.fsf@mail.linkov.net> <5BCD934D.4070906@gmx.at> <878t2owo8i.fsf@mail.linkov.net> <5BD03F4D.1000900@gmx.at> <87in1phhx2.fsf@mail.linkov.net> <5BD2C52E.2060607@gmx.at> <87ftwrgwp2.fsf@mail.linkov.net> <5BD57A8D.8080408@gmx.at> <875zxmx95h.fsf@mail.linkov.net> <5BD70F14.8080509@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1540853533 28288 195.159.176.226 (29 Oct 2018 22:52:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 29 Oct 2018 22:52:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 32790@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 29 23:52:09 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHGOD-0007CH-7r for geb-bug-gnu-emacs@m.gmane.org; Mon, 29 Oct 2018 23:52:05 +0100 Original-Received: from localhost ([::1]:49435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHGQJ-0006Dk-KV for geb-bug-gnu-emacs@m.gmane.org; Mon, 29 Oct 2018 18:54:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHGQA-0006BY-SM for bug-gnu-emacs@gnu.org; Mon, 29 Oct 2018 18:54:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHGQ6-0001Vz-KP for bug-gnu-emacs@gnu.org; Mon, 29 Oct 2018 18:54:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48043) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHGQ6-0001Vt-AR for bug-gnu-emacs@gnu.org; Mon, 29 Oct 2018 18:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gHGQ6-0004np-5L for bug-gnu-emacs@gnu.org; Mon, 29 Oct 2018 18:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Oct 2018 22:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32790 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32790-submit@debbugs.gnu.org id=B32790.154085359718386 (code B ref 32790); Mon, 29 Oct 2018 22:54:02 +0000 Original-Received: (at 32790) by debbugs.gnu.org; 29 Oct 2018 22:53:17 +0000 Original-Received: from localhost ([127.0.0.1]:52295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHGPN-0004mT-9G for submit@debbugs.gnu.org; Mon, 29 Oct 2018 18:53:17 -0400 Original-Received: from giraffe.birch.relay.mailchannels.net ([23.83.209.69]:28568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHGPK-0004mI-G7 for 32790@debbugs.gnu.org; Mon, 29 Oct 2018 18:53:15 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id B2AC4123C80; Mon, 29 Oct 2018 22:53:12 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (unknown [100.96.33.121]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 6568F121F47; Mon, 29 Oct 2018 22:53:12 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Mon, 29 Oct 2018 22:53:12 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Bored-Eight: 2370b9c9574785fe_1540853592546_1944013306 X-MC-Loop-Signature: 1540853592545:2611984032 X-MC-Ingress-Time: 1540853592545 Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTP id 1D1BB80834; Mon, 29 Oct 2018 15:53:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=93DXcZEoc/dX8ffL0GOYH8wvgJY=; b= Tpiid3EU33n1nopdtMT+oIQhJyZBlMJ8KWb8Fxv2II8UBra0Oof34pD8e1AyXRCF WUneKrG/ft7hjaW2YE/7WwVDhdHlD2liYmnMTQbbmQr8CarMaYEtui9O9Vng0EEP 71gk3kaF5RaclskPsl224tMf+4Fkh3mXhhDT9Rp1MXw= Original-Received: from mail.jurta.org (m91-129-101-157.cust.tele2.ee [91.129.101.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTPSA id A389980831; Mon, 29 Oct 2018 15:53:10 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a54 In-Reply-To: <5BD70F14.8080509@gmx.at> (martin rudalics's message of "Mon, 29 Oct 2018 14:45:56 +0100") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrheelgddtfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddtuddrudehjeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutddurdduheejpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtoheprhhuuggrlhhitghssehgmhigrdgrthenucevlhhushhtvghrufhiiigvpedt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151792 Archived-At: > 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. Whereas window-state-change-functions elegantly checks if the window displays a new buffer. > 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? > 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. (defun display-buffer-directionally () "Specify in which direction the buffer should be displayed. Arrows show the direction. Mod-0 forces to display in the same window." (interactive) (let* ((dir (event-basic-type (aref (this-command-keys) 0))) (win (if (eq dir ?0) (selected-window) (or (window-in-direction dir) (split-window nil nil dir))))) (let ((hook (list 'lambda))) (setcdr hook `((window alist) (when (and (eq window ,win) (not (eq (nth 1 (assq 'buffer alist)) (nth 2 (assq 'buffer alist))))) (setq display-buffer-alist (cdr display-buffer-alist)) (remove-hook 'window-state-change-functions ',hook)))) (add-hook 'window-state-change-functions hook)) (setq display-buffer-alist (cons `((lambda (_buffer-name _action) ; condition (= (minibuffer-depth) 0)) (lambda (buffer alist) ; action (window--display-buffer buffer ,win 'reuse alist))) display-buffer-alist))))