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 00:10:27 +0100 Message-ID: <20220317231027.65clapwxz5qtnpm4@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="31466"; 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 00:12:25 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 1nUzI8-00081d-KL for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Mar 2022 00:12:24 +0100 Original-Received: from localhost ([::1]:33644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUzI6-0001Lj-HA for ged-emacs-devel@m.gmane-mx.org; Thu, 17 Mar 2022 19:12:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUzH1-0000aP-Oy for emacs-devel@gnu.org; Thu, 17 Mar 2022 19:11:15 -0400 Original-Received: from sonic311-15.consmr.mail.bf2.yahoo.com ([74.6.131.125]:37224) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nUzGy-00009e-Dv for emacs-devel@gnu.org; Thu, 17 Mar 2022 19:11:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1647558670; bh=prsibiMGhge5HAKMwQQdvQ8S3XI3ZqhTvYQtLWoMCD0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=oGAwk2oe9n3zwd1wG2Ouxxkanz+OA8jlEt6df5mhdG5mMn4yeeWw+BkInLogmwHZCwmk+slWsYraIUxIgg6WK7+/ZZlOV+kg2UQOZNsvpybZlxSrqseTRHwyFwypefrRz+Le+lgCExVT3gOJYedVK4VYe/PyUdPz/PlDHpGcXTLaUxHG8NDbhI+szFSNIMDJVs+eiDHNB8PWSW6VDpJnqt5v83YjLVxl6nPp8sYitsRTiLtyqyg8LK5UGKkVoxy4IPBSGDuh/7VIlchuPd7yMl0LUXvEwmtiEBWtjrRSNSdYK+9Y6n5wNb1vsQpZWZtgObq1snuLIBO4RWtkAdt4/g== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1647558670; bh=RQtsdWIuEV+Izvjhi1bo8ydoaxPEzZc1fQ/pb3FSXXD=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=nJ3ajlFV7MJpeO/CqDuXfjGw2DtSiASSAGBLv+Y/gXZk/iO49HeQJIFqDDuaI9ebnZIGuG7PDCDPJ/ee5mMQVEVj3wzSBvrOwBe+gpgPMGMLEsOQSfXVdmukA1/wImvq3Fy/vdwWKYSj+F33BVWawQjNoMw89Yy8w35fqRWdC6rd3fAL5Y3ns3laqEK9dDrPPV3D2VpkvV7HoryXEtkvtUo5cnBrN1WkVB+TxMpGa0kVPgsUXytwgj8ICnII1Rf1hj0dZU3PBbQqqlxISgbh2AWMaCS4O+izuw2nv7abcggVMw+rPdc1eBFM8OBYis0TA8xy+iAcvCaujefPgFdMyw== X-YMail-OSG: YWoNFdQVM1lQSepIFUFIrISJi_OmqOEvCG4rsna.AiMoCGtKUUQC3zGq2DA.kzH ngHU.TwmIQyNDt423AJQAh9lU1bOq6Za72ZUFPL4E0LAFbXA6HYR.WecY7EkAdOuKJmmPV3XkTat TYjuFBRvMnrfhEsNQuv0v95BbDHaYreI4VRFtYXbvfn379Cn9REzkq6K8roGC35jEtcvmMSVQc48 gWxQJ9gezePVDNVQCuPb7jKw.QF9hnC7gs37N.TAVdkR1gfzJq1e2k72OmxgCPSw_mViJIn3avOu on9ffyrRWAlUcN8YUDGQVQefpA2OKXYYTcDOapEB3x9d44a3kci8i6fqmCd3oQ7Ju8__U1VGtjov SAGt5PDLw8fjVGvl34ssd_TIljWsuT0bPivizK8_gFTqFXOE1gQZDOiFxxBKN86jniQPT4jNAb.W PgoAFnfRrcFAo1bi4e3X8gKG2vdXJ1zFxtD0_7SFaV4m6R77Sc3OSKBVC0t5HVsfjIXthxhyBh93 WAbxXL8cWNDRX.cp__1iqkgC5sqM_twWkqTruggZUm8jBYFcxH8sadnnmKX_oRlf2BVpwtC5prXz tfYE8dzbQGVbRS1VCVu8agv7vUb7Juc.0jzV2_j8QjZAS7cV38c1gXC1uoN6LDo.EsgQGP9b_omV UzCepxsPPCv6l1RpRQfOSYhcad7O8yAcs24yzxuFy2EUrGWK7TRWrNZZLkNxyz5ZgOM.euyXLQdd YPJuw181r8MXL7XqOX.gLvMq6oBvjzqJshTK5a5CV8dnhhZAL2t0YCxAlUGLqtQUCsYJPwPez65G 4o8TlhVDSJLKFgskOmUW1eoQJkrY6oi6kTadwzbul. X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Thu, 17 Mar 2022 23:11:10 +0000 Original-Received: by kubenode515.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 80a7fe9d47b1aaa087d0a7adfe5d018e; Thu, 17 Mar 2022 23:11:08 +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.131.125; envelope-from=spacibba@aol.com; helo=sonic311-15.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:287265 Archived-At: Hi Juri: Yes I just confirmed, actually the pre-redisplay-function is not called for simple commands like self-insert or moving the point and in your case neither. 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? 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) >