From unknown Sat Sep 20 02:38:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#79472: [PATCH] Fix minibuffer-nonselected-mode when using recursive minibuffers Resent-From: Steven Allen Original-Sender: "Debbugs-submit" Resent-CC: juri@linkov.net, bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Sep 2025 18:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 79472 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 79472@debbugs.gnu.org Cc: Juri Linkov X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Juri Linkov Received: via spool by submit@debbugs.gnu.org id=B.175830529014342 (code B ref -1); Fri, 19 Sep 2025 18:09:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Sep 2025 18:08:10 +0000 Received: from localhost ([127.0.0.1]:40979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uzfWj-0003jF-GE for submit@debbugs.gnu.org; Fri, 19 Sep 2025 14:08:09 -0400 Received: from lists.gnu.org ([2001:470:142::17]:47302) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uzfWh-0003ik-2K for submit@debbugs.gnu.org; Fri, 19 Sep 2025 14:08:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uzfWa-0003HV-JQ for bug-gnu-emacs@gnu.org; Fri, 19 Sep 2025 14:08:00 -0400 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uzfWR-0005Au-9d for bug-gnu-emacs@gnu.org; Fri, 19 Sep 2025 14:07:59 -0400 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id 1E6751D00084 for ; Fri, 19 Sep 2025 14:07:26 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Fri, 19 Sep 2025 14:07:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stebalien.com; h=cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1758305245; x=1758391645; bh=G6aHvdJn2Ykc2RDj2OhXfWWdADFtgmR6 XQDShYiwIoY=; b=0YhOWsWuqjPgCqDr5yXG1LyHQITktxyMc/A3saAwPiyjNTFP xNQzIHntNz+rM8rWERE4Ic6586iuP9XpsC1hxf25+yDpn7UJqmmXEuHnm9B0vO0r Ny35eydyC96BBNP1WqkEBlvi7J1QydKQrs9vanq4wUfcxMF6F9Hl1uP7c/Zx3e5q buk2D8DuCYIixHLjOk4wh4H2KdQWmCu3VLuowKMcBnXBoxuLAmj/spuxeEBGpUz+ SsdZZj7ewfG6kEM8DlefEEW8bYRwfLBWD8mitbRN4L4Z1wlEtiy4+LzXV+pp0LXB NMyQTlX9PJa4976wLLVcxsiBtamxhTB1biiBTQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1758305245; x= 1758391645; bh=G6aHvdJn2Ykc2RDj2OhXfWWdADFtgmR6XQDShYiwIoY=; b=m xy3l55M2OktHQaTJXUcqbzAMi4wIYtviyS04QEGngDLL0S3H7HBTl/oGCYjScd2k tVZ7k8NcCB8OranQgRNPDDR7YNSCUscu7beraUZ5lyi6CncGJhgV7DtqI7mzoi94 wGuCxaLvksD5k7JIgQyrZMxt6hm+ZSJqbPL2qticb1MsPpWItyeG8O+DOAvToEDq 2MOI/zq/Vu4P2RuFIeRb/VGt8cy066NX3iXD+rTRKv+XVeckZHOGqLwuvpni3/+j DKDECV/BR54QJThbDb2TVhMDfrRjFn0U/TpY9AZmBsshm+HLwT+joMoZ+w0dyTJ6 6Uwa2Yku2aIGiph1pd3GQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdegleeklecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesmhdtreertddttdenuc fhrhhomhepufhtvghvvghnucetlhhlvghnuceoshhtvghvvghnsehsthgvsggrlhhivghn rdgtohhmqeenucggtffrrghtthgvrhhnpeekffffgfevteehtdeiffelffegkedvieeige ehfedtteejkeefhfevtddtkeefffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehsthgvvhgvnhesshhtvggsrghlihgvnhdrtghomhdpnhgspg hrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsghughdqghhn uhdqvghmrggtshesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: ie8a146a7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 19 Sep 2025 14:07:25 -0400 (EDT) From: Steven Allen Date: Fri, 19 Sep 2025 11:07:22 -0700 Message-ID: <87ldma1fl1.fsf@stebalien.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=202.12.124.147; envelope-from=steven@stebalien.com; helo=fout-b4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) --=-=-= Content-Type: text/plain Tags: patch When recursive minibuffers are enabled and minibuffer window restoration is disabled, minibuffer-nonselected-mode fails to "unhighlight" the minibuffer prompt. The fix is to use window-state-change-functions instead of window window-selection-change-functions. To reproduce: 1. Run: emacs -Q --eval '(setopt enable-recursive-minibuffers t read-minibuffer-restore-windows nil)' 2. M-x 3. C-x o 4. M-x 5. C-g At this point (once the "Quit" message disappears) you'll be left at a focused M-x prompt that's highlighted as if it were unfocused. In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, cairo version 1.18.4) of 2025-09-11 built on Laptop Repository revision: 819574e13e5dcefdff136033012d6d34f8940848 Repository branch: makepkg Windowing system distributor 'The X.Org Foundation', version 11.0.12101018 System Description: Arch Linux Configured using: 'configure 'CPPFLAGS=-I/run/user/1000/build/emacs-git/src/mps-git/build/include ' 'LDFLAGS=-L/run/user/1000/build/emacs-git/src/mps-git/build/lib -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto' --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games --with-modules --without-m17n-flt --without-selinux --without-pop --without-gconf --disable-gc-mark-trace --with-mps=yes --enable-autodepend --enable-link-time-optimization --with-native-compilation=yes --with-xinput2 --with-x-toolkit=no --without-toolkit-scroll-bars --without-xaw3d --without-gsettings --with-cairo-xcb --without-xft --with-sound=no --with-tree-sitter --without-gpm --without-compress-install '--program-transform-name=s/\([ec]tags\)/\1.emacs/' 'CFLAGS=-march=native -mtune=native -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fomit-frame-pointer -fno-math-errno -fno-trapping-math -Os -fno-math-errno -fno-trapping-math -Os -flto=auto'' --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-minibuffer-nonselected-mode-when-using-recursive.patch >From 0485d70f58695a3d71c392af92861055ca03b4fa Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 19 Sep 2025 10:34:47 -0700 Subject: [PATCH] Fix minibuffer-nonselected-mode when using recursive minibuffers * lisp/minibuffer.el (minibuffer-nonselected-setup): Use window-state-change-functions instead of window-selection-change-functions to detect changes from one recursive minibuffer to another within the same minibuffer-window. --- lisp/minibuffer.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ff1b68b49a4..5aa491fa4c4 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -5623,7 +5623,7 @@ minibuffer-nonselected-check (setq minibuffer-nonselected-overlay ov)))))) (defun minibuffer-nonselected-setup () - (add-hook 'window-selection-change-functions + (add-hook 'window-state-change-functions 'minibuffer-nonselected-check nil t)) (define-minor-mode minibuffer-nonselected-mode -- 2.51.0 --=-=-=--