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: Fri, 18 Mar 2022 12:53:36 +0100 Message-ID: <20220318115336.77oa6k6wfsdk5csd@Ergus> References: <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> <20220317231027.65clapwxz5qtnpm4@Ergus> <86y217d2j3.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="34906"; 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 Fri Mar 18 12:55:13 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 1nVBCK-0008vu-AI for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Mar 2022 12:55:12 +0100 Original-Received: from localhost ([::1]:33884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVBCJ-0000zN-1R for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Mar 2022 07:55:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVBBZ-0000IP-0k for emacs-devel@gnu.org; Fri, 18 Mar 2022 07:54:25 -0400 Original-Received: from sonic312-20.consmr.mail.bf2.yahoo.com ([74.6.128.82]:43366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVBBV-0002VJ-Kc for emacs-devel@gnu.org; Fri, 18 Mar 2022 07:54:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1647604459; bh=v5JwaLFTRyyAV+o6CKKIDty7hdaMP3RRd1fwNJ877KI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=iCDudnXi4ZrsnckdrhH+qyMc2XKe5TnsjqzettvPaN2rvlOYhVN1qjaZj9HNofnujrepVpqmQLLPmdm3qjNFKIfYwQxj4dEUW9vxoKXuxg/gOx4sAuT9ZxycK4FyCeKwqiQL7kkGKlumDLUx6he7O4tQMg/28GyExxm94zOZheERf3Y8w6v3QFFuCIAyuMAsAfjfHVheQZPHbQpLI6MDmV0rm870Njv1lBznfCdoIJu9Io18vUVj3Kz6LDixiszjICawmCU9hEIN+gdTIZC6Brk/RjlY8+ZcBzxKvWU0HOxYGHY/I4rIhW1PpFgsLXuPKTq//xXcaNG6OSN3AAsBoQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1647604459; bh=S32ZOs53HQZrz/Pw5KYm8F3P47xcI9Pfl2OWEvbJ6vK=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=V7Ur8+t2FjrF8nHQZA6rdekdLBgZaaK1Ah2sybA5CrW/UloJciTRDWrjX8izMEknsI09F7jYOs1D57JxQd4Y2saxWSK/es95hAiKEyY4QHZjCdNr1wHMBVdpDtg5cPkyvUGFL5Q4jKrkiKInLm/vdG8DhSd4UCedE2VZMs3y4uqB5rWxHFvGsNV9dfUW2/+jfz5Fgun0ZM6yhQAI3pTHzdqJk+mtjm20V6urClc2f8gItgoAnrs6QvyNT0U/oaFwmEMiW7YzVVYvkF3RJCulah63gX64+fhBicQQqh7Jhc1s41hzTkAm4YgE74Zpj1hDKhBzXrVGGvS/kqDnU+ugVQ== X-YMail-OSG: EPm8k14VM1l1uqmgF.ZoMwzW7IsYxWh3orwwTTsf6_aEcE_bBc9oYP_Wu2zfGCW 0jQs0oy8PR8teg.GhEx_wfJ2c5X0Cdyzlu_zwp991a2TdVgTzHyIMMoTqcFwfLBZ0_skT18E3ZR7 cM4bFutCYO3O3UMi9XkBK7._vzwfw8b7FJSY4osZTMCSyoIH1GkZrG9YywlHCcjZi4vHszie9YuD gPFWcCXC6ThxNtEyReNVhj6jbjzj8753wxYVLXxPOvF_x7GMCKO0Zpy_OuS7BU9jo74x0cqH2x39 pQOxYtU7kEaFW3nAQiCZetvC9.9ox3J24NNl9JkydY1DgrYMMExMul.RQ7f0AWfzt86m.KIPEnra vezFJGAooTDn94w8QvbNU7HTXpVflUV7xEElECInVH5vSI7nyjPeL.9P68PV0kDmSqzPz06Ru53y iH7U5l2JQSXjsCqlomIbEOv8QW4pQlmYf10_MxXkGxeUGEoq2CjJwKfi35cSKL1mw2BT_Yaj1vs2 qn96roJQQPtGe83jgB4bViKPH32I7VhXfamQita2qZCnipzFWu3tBJVMQg1LcyQTlSdCExqsppIM 5vpfxUT9tlb.dipK4Toc9y0xBlfe_Z9OhlnEBLbLdEHSKJDpRaX775jSal0J8NXLOwOeHTafBtAS tzk4uHozje87BgXUIbVascBGEnNxTfV70..Lp6BfXtreZCpF4p4XAHeOMb3crkj.IwvnPCGzCtmr GWDWaSJv3x7nX8blLSspVMuarXS0jDPlPEmQOKmkg4HLbb8StwdRt1gnvopF31wbENt2BX_y.ovV qXAJ.0jYePzTjz5paNr8CwzY.g6i9DJB.1wZ0SC8AI X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.bf2.yahoo.com with HTTP; Fri, 18 Mar 2022 11:54:19 +0000 Original-Received: by kubenode500.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 3d9b6db40f898ba81940dad577d03e13; Fri, 18 Mar 2022 11:54:16 +0000 (UTC) Content-Disposition: inline In-Reply-To: <86y217d2j3.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.128.82; envelope-from=spacibba@aol.com; helo=sonic312-20.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:287276 Archived-At: On Fri, Mar 18, 2022 at 11:27:52AM +0200, Juri Linkov wrote: >> Looking at the last line in `deactivate-mark` it seems like it is a >> known issue and changing such optimization in the display engine may be >> probably undesirable (Eli will confirm soon hopefully), so in your case >> maybe is better to force the update on demand like in deactivate-mark: >> >> ``` >> (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 >> (redisplay--update-cursor-face-highlight window))))) >> ``` >> >> This seems to work. >> >> Is it enough? > >Thanks, I confirm such forcing the update fixes highlighting. > >But still when cursor-face-highlight-nonselected-window is nil by default, >let-binding it to t has no effect: > >``` >(defun minibuffer-next-completion (&optional n) > "Run `next-completion' from the minibuffer in its completions window." > (interactive "p") > (with-minibuffer-completions-window > (let ((cursor-face-highlight-nonselected-window t)) > (next-completion n)))) >``` > Hi Juri: This should be because when you force the redisplay--update-cursor-face-highlight; then the display engine detects that something more important than a point move changed (an overlay moved) and it passes *Completions* to redisplay--pre-redisplay-functions. Then it calls redisplay--update-cursor-face-highlight once again (yes now it calls redisplay--update-cursor-face-highlight 2 times instead of none) but the second call is from outside of your function; so it gets the buffer local value of cursor-face-highlight-nonselected-window. In general (setq-local cursor-face-highlight-nonselected-window t) should go into the completion-setup-function because you don't have a full control for when the display engine calls redisplay--pre-redisplay-functions for *Completions* window. For example, in a resize the highlight may disappear too. So you need: (when completions-highlight-face (setq cursor-face-highlight-nonselected-window t) (cursor-face-highlight-mode 1)) in completion-setup-function OR add another function to completion-setup-hook only to do the setq-local. Eli: If there is a way to force the display engine to detect a change in a window and use it to pass *Completions* in the next call to redisplay--pre-redisplay-functions? I mean to avoid the need to do a redundant explicit call to redisplay--update-cursor-face-highlight which doesn't really take effect? Best, Ergus