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#74019: [PATCH] Optionally preserve selected candidate across *Completions* update Date: Mon, 28 Oct 2024 10:21:49 -0400 Message-ID: References: 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="8456"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74019@debbugs.gnu.org, Juri Linkov To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 28 15:22:49 2024 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 1t5Qdt-0001wi-Bb for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Oct 2024 15:22:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5Qdb-00065P-Rf; Mon, 28 Oct 2024 10:22:32 -0400 Original-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 1t5QdY-00065D-JX for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2024 10:22:29 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t5QdY-0002vd-Ay for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2024 10:22:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=bB8louqeJ4etWcTtHbvv0sSSZ1eo9WHvEfxkKa9p2p4=; b=AzKHO7FDyFEZcVB80kuRaz2QS84U4eaQra0O27HCcezQDtNyHiLb0AAtSILY2q1gHmP/eJMS4PsCgzaI9kAoSt7zAsihsGBxSs9BiLyFDPp2kSzDnkmQ/MbiVGfdGlfqbhFfbE2NYGVQ59GNetN+xXR0Ver10CV2/2L2jtVbXiXgKHV+25lcF2IO4wVsOja/CJvLjWha+t026KI3w/QuZuvIduXEM95+a1DB5VkaNoBJNoaFoRMaXpSNjrXB05iGt34S/GIayebTQnqw48/1aVldKIi3Vwrw5Opu/WON2RP5BE8laxi48YcWetJt6g+VGtUzaR+oJkHXfdtjzwAJyg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t5Qe6-000304-ER for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2024 10:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Oct 2024 14:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74019 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74019-submit@debbugs.gnu.org id=B74019.173012535711496 (code B ref 74019); Mon, 28 Oct 2024 14:23:02 +0000 Original-Received: (at 74019) by debbugs.gnu.org; 28 Oct 2024 14:22:37 +0000 Original-Received: from localhost ([127.0.0.1]:54271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5Qdh-0002zM-B7 for submit@debbugs.gnu.org; Mon, 28 Oct 2024 10:22:37 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:44704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5Qdf-0002z5-6V for 74019@debbugs.gnu.org; Mon, 28 Oct 2024 10:22:36 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 95DAB4411E2; Mon, 28 Oct 2024 10:21:52 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1730125311; bh=lOK9TF0k5UK0nOZ777rZyyMmVj/+K3lJPJWl50U77Dg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=VbfpTtTuUQqWwBpi5PS0Xw8vimWjVGB5oy7M7VRPi4PgF0e5N57cYJkwhpyLnCya2 YMuKMOo+A0hT5mFho+04CJbav04dRpPYT8fUIFiQAoIZIJKDIjXwcc+rGMyUaMVDqY 0DQosbD1yEbg9VBzm47JYi4RelTKJZ2nZLrUSZTg8uHVN1I1N/qFnEd7MGypgUePBf 2W+Ja+g36PDRJ463dUL365F8ErDg8mLyKkRl3ee0Z9C20KExjGro5wbI/vJr7UraKT xvy6lEaz3RRKw+8a3+yq3KxZzmC2ZOlRQSQwjoYr9AoPQdcQNa06R6fMd8HvP6uEHF tajuwhZgta5Vw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 78CA1440B1D; Mon, 28 Oct 2024 10:21:51 -0400 (EDT) Original-Received: from pastel (69-196-161-60.dsl.teksavvy.com [69.196.161.60]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4C1E412038D; Mon, 28 Oct 2024 10:21:51 -0400 (EDT) In-Reply-To: (Spencer Baugh's message of "Mon, 28 Oct 2024 09:51:40 -0400") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294425 Archived-At: >> Hmm... are we sure here that the `*Completions*`s content is related to >> the current completion session? I don't think we want to preserve the >> selection when it came from an unrelated use of completion half an >> hour earlier. > > That's why I'm doing get-buffer-window here - I figure that if > *Completions* is currently displayed in a window, it's reasonable to > preserve the selected candidate. > > (The selected candidate in that window, I guess - so maybe I should use > window-point here?) > > It still might not be related to the current completion session, since > the user might have just manually switched buffers to *Completions*, but > I wasn't sure there was a good way to determine that... any suggestions? Indeed, it might not be related. E.g in my setup, `*Completions*` is placed in a dedicated window&frame that is simply iconified/deiconified as needed, so your heuristic would fail. I think we need to store in the *Completions* buffer some info about the completion session for which it was last used. Or set some buffer-local var that indicates that the corresponding completion session is "done" (we can do that when we hide the *Completions* buffer, when we exit the minibuffer or the `completion-in-region-mode`). > This is kind of an unrelated improvement, since this is probably nicer > anyway - if the user moves point around manually in *Completions*, IMO > that should have the same behavior as minibuffer-next-completion, but > currently it doesn't highlight the same way if they leave *Completions* > because cursor-face-highlight-nonselected-window doesn't get set. I see, thanks. Stefan