From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: Select completions from the minibuffer Date: Thu, 17 Mar 2022 23:44:33 +0100 Message-ID: <20220317224433.oiocm6da6tzmrq6e@Ergus> References: <87v8wl35wg.fsf@gnus.org> <86k0d06dik.fsf@mail.linkov.net> <87ee3714li.fsf@gnus.org> <86r1773sb4.fsf@mail.linkov.net> <87pmmquew4.fsf@gnus.org> <86ee357wob.fsf@mail.linkov.net> <20220314090826.gyc42227jpvh4efa@Ergus> <86zglsiazs.fsf@mail.linkov.net> <20220317184701.ani7k3clp3impqwn@Ergus> <865yoc47d2.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6682"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 17 23:50:40 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nUyx5-0001bc-60 for ged-emacs-devel@m.gmane-mx.org; Thu, 17 Mar 2022 23:50:39 +0100 Original-Received: from localhost ([::1]:51710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUyx3-0000lx-ON for ged-emacs-devel@m.gmane-mx.org; Thu, 17 Mar 2022 18:50:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUyrx-0005gZ-JK for emacs-devel@gnu.org; Thu, 17 Mar 2022 18:45:21 -0400 Original-Received: from sonic305-3.consmr.mail.bf2.yahoo.com ([74.6.133.42]:45759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nUyru-0004sJ-KG for emacs-devel@gnu.org; Thu, 17 Mar 2022 18:45:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1647557116; bh=lShX5JOkkkFSyspQqqcMZN+JyT/2VMKg4jBz10T7qlA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=Mde06bhuV85OY6mVyb93aVXs4SkoFYch+sjf5kIsHdldA6u2cEg21PYUPNTRRzHJXodQRVio6+SffqJ4w/SGiJ6izZetN/j7MIcTHsPdcLc4sgzqQ9NisE7AjX6phQumaYaYdP8Q7HIWBFo+XJaSsQABz+1LWDmU9OEdr9sRZgjZOddQegLd1+aM93y2YzGEgZRlJzuwy8XV8XYYoOvP8s5FRoD2IDFijIFvbeQs7xvzXmTPnlj+CmUQwG7lZWclzE/txF1DWoscIC0/ur9ZJdcXiVMhyfO2tk2bl69zHV2Re3w62/KDX0lHcJahQZOcjYnwQwRm6ncnhRkrvp86Mg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1647557116; bh=ywwmRYyxmKgSc0ss6BvddfosKLRdVDgP5SeWC2/DjQM=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=qZMSKvBPTjT+ABnutmV2jrodM5YrF00qc9TCryC4yPoQJdlU08SzvM1fUpfI5otcVu0Cb9yK/zAFHB6kKjoPCS6l3XboPhaTw/IrAJY+gtikmCU97E92U3q5Mv2wWQJfFNBtiHhbH83si6gkOdXhM4w7trtF6TaZsXAF1BZmqBtI33YDbEkpNjMkmX9tNQ3LT+hgyzhHi2sKHuC+x3koh2llEZ1qUhSlJnI+uP51CS33aJAqH400MuiZzTz6F2FRunzK90JDStvC39SRQW7m23PysYh4qbK3eGiWC4/DoHEPH+BS1rpc1AxH6Rci/PSjq21H5mrSMaebHqlxW73MBg== X-YMail-OSG: xGPZ_xgVM1nY6Ki5_zaIJNxlfxFy9xn6pji2qYFsceH77X1Pn.9nOG8tCMWih90 7WlJhG4XduUonu2D9RLNer0PGrhI4G657.coKKF253z6w4MfKH3oN05iMylXQAcvWQRWOVtonOrQ 2iM_kOwOZ3ceJjLinFNnFrHtqhFmWl3HZaYg7gWut8Lcl_OuNeUuf5KVhv4cMxl.MPn1BrQGvN9h nlcBWW6u0frxdZ.gDjqJWEN7Ax7nLCrjRDun_guxnbTkY7LPumzsF.T4R4UU_IU23M1BfjdGxjdO W103tWN8Wy2y_8j5FmY269jrxpzqLKDqs0B3drpwpSyWAGHvAOKiYySSi4SIEI4ZAsMG6R_Aj5u6 JkwiOf7GoiVBuS57CeG3kPTkcbzRbK5NYUVMKh5KUwqKvXwxga0LUSYBQrRCftng17pjZS.IQ2YK TA_r1B.Ag9Tm1BDZ0iEgyWKoYHUbolqKPZtaroP0RR_Z9kEexjuaf6JAbtkYOEu3hJ8diWPJcLPC PtyjEPsMr0m4zXuoaxaDyzpWzcjc9uWrIDFtTvUtj0vqC82VsD2uc076RwJf.Gx5qax6iVn_pnSa u5DNTt6.8D9XAO982qVPg1N6BCANaJ5AJfsaL.rKVzpbWgZ5__HBzA00fLIN_d42X.TwuiIH4bQB WSKsahl0yDoMEbqgukUGYkvv5pY9EwmtxYbTpUAbJoReU5bhsGhgaWAUMXKX8zvSyTvRsDR2SFoL fNvJc3MPrP7uB6UMgb81P8vTCnJwd6xGrBx3G8A2Xqcwz_4pwPzg5yIz5l_iBkhOMmx.IwAmrakj Wn4e7D6PgGBdYiJhPYLIWB3aPF0tSeIN1Q4RbAyOKg X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.bf2.yahoo.com with HTTP; Thu, 17 Mar 2022 22:45:16 +0000 Original-Received: by kubenode503.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 68ece8fc7fa0ba7f7c75fd8693c4426c; Thu, 17 Mar 2022 22:45:14 +0000 (UTC) Content-Disposition: inline In-Reply-To: <865yoc47d2.fsf@mail.linkov.net> X-Mailer: WebService/1.1.19894 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.133.42; envelope-from=spacibba@aol.com; helo=sonic305-3.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:287264 Archived-At: Looking around it seems like with your function the *Completions* window is not passed to redisplay--pre-redisplay-functions, but only the minibuffer. So basically the window is not updated and the overlay not moved. Probably there is some optimization that is affecting us... Eli? On Thu, Mar 17, 2022 at 10:56:01PM +0200, Juri Linkov wrote: >>> But cursor-face is not highlighted in *Completions* when the current buffer >>> is the minibuffer. Such highlighting is necessary when completions >>> are navigated from the minibuffer. > >> Please check the change and try to set >> cursor-face-highlight-nonselected-window unconditionally in >> *Completions* to t when using your mode. > >Now it keeps highlighting in *Completions* after switching to the minibuffer, >but still doesn't move the highlighting in *Completions* when >completions are navigated from the minibuffer with > > (defmacro with-minibuffer-completions-window (&rest body) > "Execute the forms in BODY from the minibuffer in its completions window. > When used in a minibuffer window, select the window with completions, > and execute the forms." > (declare (indent 0) (debug t)) > `(let ((window (or (get-buffer-window "*Completions*" 0) > ;; Make sure we have a completions window. > (progn (minibuffer-completion-help) > (get-buffer-window "*Completions*" 0))))) > (when window > (with-selected-window window > ,@body)))) > > (defun minibuffer-next-completion (&optional n) > "Run `next-completion' from the minibuffer in its completions window." > (interactive "p") > (with-minibuffer-completions-window > (next-completion n))) > >> If you could improve the initialization in order to use >> cursor-in-non-selected-windows unless the user sets another value >> manually it may be nicer (because in the general scenario the user could >> set cursor-in-non-selected-windows latter so this variable may have an >> outdated value) otherwise consider if this may be simply t or nil by >> default. But at the moment it works fine for the current use cases. > >I think it's unrelated to cursor-in-non-selected-windows >because the cursor in non-selected windows is displayed as >a hollow box, but cursor-face stays the same. >So you can set cursor-face-highlight-nonselected-window >to nil by default. Then commands could let-bind it like > > (defun minibuffer-next-completion (&optional n) > "Run `next-completion' from the minibuffer in its completions window." > (interactive "p") > (let ((cursor-face-highlight-nonselected-window t)) > (with-minibuffer-completions-window > (next-completion n)))) > >(but this currently doesn't work for the same reason as above) >