From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#26513: 25.2; pop-up-frames and *Completions* buffer Date: Thu, 17 Feb 2022 14:21:12 -0500 Message-ID: References: <877d9wpg9z.fsf@gnus.org> <066f0fac-2ce9-fe9a-355f-e148953fc6f0@gmx.at> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1262"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , "Charles A. Roelli" , 26513@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 17 20:22:45 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nKmMW-00007Z-Mh for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Feb 2022 20:22:44 +0100 Original-Received: from localhost ([::1]:51934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKmMV-0008Lx-11 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Feb 2022 14:22:43 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKmM5-0008Le-Iv for bug-gnu-emacs@gnu.org; Thu, 17 Feb 2022 14:22:17 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKmLq-0004hW-B3 for bug-gnu-emacs@gnu.org; Thu, 17 Feb 2022 14:22:17 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nKmLq-0001JM-4F for bug-gnu-emacs@gnu.org; Thu, 17 Feb 2022 14:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Feb 2022 19:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26513 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch confirmed Original-Received: via spool by 26513-submit@debbugs.gnu.org id=B26513.16451256834996 (code B ref 26513); Thu, 17 Feb 2022 19:22:02 +0000 Original-Received: (at 26513) by debbugs.gnu.org; 17 Feb 2022 19:21:23 +0000 Original-Received: from localhost ([127.0.0.1]:52711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKmLD-0001IW-Hu for submit@debbugs.gnu.org; Thu, 17 Feb 2022 14:21:23 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5008) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKmLB-0001IH-LY for 26513@debbugs.gnu.org; Thu, 17 Feb 2022 14:21:22 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0853880626; Thu, 17 Feb 2022 14:21:16 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7E666805CE; Thu, 17 Feb 2022 14:21:14 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1645125674; bh=3ZJ79S/4DR183oxFLX4SgZYvePBskwn3k+u6QxOye0Y=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=cnT5HbpM28gA83F/tixNzPBBx2JiuWHzbQIYT4Gf2p7CcuCRR5aRhMUsnuolQMcbG 2yoA8paWFBNLcWFXQJyROvkiUuobP+Kj4vjxx4Wj3mPC94KKFm0B4IP3unyU7hTpN3 K3qJxUlLNkOwa+cpkPtY0EIiPXkURm8bRpLgDJ/HMEqbpxQ6IbaIJAWtFbCjPLajX4 aLIz0yNiA0MxWVbYtHeY0ytabqwIxAjbocdVVqpEJm/1hcsDtu83fTM8iby+tJV7M3 o9aTLuEo4RDydSv2p3/ZYmbj/m9K8tt379Q6IxN2SI3ZvTl3uzz5K2n2IUbPxnx/Bn 7EavClsyi3jHw== Original-Received: from pastel (unknown [45.72.237.157]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 31880120434; Thu, 17 Feb 2022 14:21:14 -0500 (EST) In-Reply-To: (martin rudalics's message of "Thu, 17 Feb 2022 17:02:52 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:227113 Archived-At: >> I have a `display-buffer-alist` entry that does all kinds of funny >> things for *Completions* ;-) > Please post it here. Sorry, top secret. >> No objection to the patch, but the amount of code duplication in it >> (both in the new lines and in the surrounding code) suggests we may want >> to refactor some of that code so that the options processing code is >> written at a single place "once" rather than >> once-per-display-buffer-function. > Agreed. But I profoundly dislike the sole idea of abusing > 'redirect-frame-focus' for fixing this kind of problems. FWIW, my code also uses `redirect-frame-focus` but I agree it's not a great solution. AFAIK, this all comes down to the fact that when `display-buffer` creates a new frame, it will all too often end up being selected by the window manager, even though Emacs doesn't want that window to be the selected window. I sadly don't think we have a good answer for that problem. I also don't think there's a good reliable way to do that in general, currently. I suspect what we'd need to do is wait for the new frame to be "fully" created (not just by us but also on the window manager side) and when that is settled we should request to focus back to the frame that had focus before the creation. I'm sadly not well enough versed in that kind of GUI code to know how to do it. And its asynchronous nature makes it worse. Stefan