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: feature/icomplete-vertical Date: Sun, 20 Sep 2020 15:04:35 +0200 Message-ID: <20200920130435.heye7bk73pm252km@Ergus> References: <20200912133311.6ujtgczj6wyclufy@Ergus> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3414"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gregory Heytings , Eli Zaretskii , Yuan Fu , emacs-devel To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 20 15:07:20 2020 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 1kJz3m-0000m9-2h for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Sep 2020 15:07:18 +0200 Original-Received: from localhost ([::1]:56976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJz3l-0005zB-65 for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Sep 2020 09:07:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJz1O-0004aA-GB for emacs-devel@gnu.org; Sun, 20 Sep 2020 09:04:50 -0400 Original-Received: from sonic314-13.consmr.mail.bf2.yahoo.com ([74.6.132.123]:45679) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJz1M-0000mn-Cd for emacs-devel@gnu.org; Sun, 20 Sep 2020 09:04:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1600607087; bh=//HAaIaiRlkaJzktw5TLHfu2EeJ9BeIISiOJ4YI9fhY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=hXmZVir/iqLvnlgEQn1Esjut3LVVTDIeY0+XbkoJYbxV8y5Nv8oB0nvtxWo6xi0tPreDk3zls4oDHv5aDlEIMOPbsZklabH6F0R8qkIbMIAzSU1TRHBvUuri5vxz/Ke+/7BNzixObqzZcRv7bmdgIILzk0ubrLf6FFh8u4j7m5kizd7tXwgKfqE7Wx47t3B6PlXNnUwAWXmhNa0MH07oKX7j6Ma/Vfog9c5R1kxeLb1pW5u7WW4uOCBUos9pAoMSWkxylNCkUcv/fir5oNGr9s0dQrBE9HM1dEP7mXvJWCrRgfgYoNdex5xm4Qh8f7m/IitrEse34Lys1so98yqefw== X-YMail-OSG: 1LKBLJgVM1mJ660ZO6C1XMERGorWk4fnq9C1tFjfE.ckgcQcmdDxWmnUluqXsPa w4W76IXcK9DPUy9uzHx1HTmExRjW5CW3inU5V.72Kffk_c.c.Xduk8GQCpANAar6vys1tkAVpf.E J7AWeoPYzR2PyZ_VRpGOe1Ghuk4_Fk_oKRT6DJr7SlbNUh8PpLVgdCzB8FfCHIBJNn0_q1Glz_8l 3lGFzYWvn3lzl1IupNuZQctzIbXYySkXMwxE8m4UJlUUhcqeYyvaTRHDj.9ctvmVkE4DZyuGX3JG Wez55tXyZ70pSxmTjMNtaAuiJh_rofFbreEwCYlMullxa5fbteJ8bIbjwJ1VGGZTdBABEVP63_pL aJhCf1k9Zva9FkrVNnOk1hIpVFn_5fZvEIRvWarnKDcrQyJiWI.QKISs6wP9FsIEBC5tpUKcvL_z OxmsuoWuZzjZeUqUj_i1PHqABZNsCJQxProCGvBPxg47654HDHOasX3HnqxBl488Kk1F.xx2a6sD vBTSwIwSD7zehFjoSpPUjaECE8sdu_kbfeejebd0SL8zcuaM72diwLUO7jB9wnv.YSjb9Z9fcYtl Ak7GL9JqDpirGmM7NHGzAYleGjwyJjLxrRFoEtnNBpp8q2EAA87nHIpdREBzv2SfuN4WCbN1eWiR Me1cswx1EsgfdYuNh0QoBK8MIDN95h4qo4F9ZBXqlZpMfHJEiuG.ZJ9ir60qtiGadbMflFH9mMu5 kogHsMSiHig.GBZNh5DLoBZnDGeJZ_tbjou7ADgmuAewPvQ.SrRrUIVebCN3KT.pYKHg_Y1TQ2cE 1OBVvTgFiU_ChIqe04QNFJYPtQHZXSoP36E0U0HrNW Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.bf2.yahoo.com with HTTP; Sun, 20 Sep 2020 13:04:47 +0000 Original-Received: by smtp421.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 33e4d008dba7e745e46d0e3660a52f5c; Sun, 20 Sep 2020 13:04:42 +0000 (UTC) Content-Disposition: inline In-Reply-To: X-Mailer: WebService/1.1.16583 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Apache-HttpAsyncClient/4.1.4 (Java/11.0.7) Received-SPF: pass client-ip=74.6.132.123; envelope-from=spacibba@aol.com; helo=sonic314-13.consmr.mail.bf2.yahoo.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/20 09:04:47 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:256246 Archived-At: Hi Joao: The problem was that I was trying to avoid calling enlarge-window from icomplete and rely on the internal resize mechanism (maybe that was the main error) to avoid calculating the height in general. And of course the prompt issue that came out when using different fonts as a surprise. I tried to solve that without the enlarge to respect also the resize-mini-windows either when t or grow-only. Initially I separated icomplete--prospects only, but then all the height calculation complexity came and that's why I ended with the complex approach. I didn't know that the prompt issue disappeared with (setq resize-mini-windows nil) What I wonder about this is the potential conflicts when another package or function relies on resize-mini-windows. And that the ... is not shown to indicate that there are more candidates. OTOH: My main goal (more than the vertical) was to implement a sort of zsh like completion. (similar to what I did for *Completions* buffer) so at least I will request to avoid using only and advise. On Sun, Sep 20, 2020 at 11:55:52AM +0100, Jo�o T�vora wrote: >I'm late to the party here, but I'd just like to add that >Gregory's solution based on advice can easily be be integrated into >icomplete-mode directly. I do like that it's such a simple solution, >doesn't include new defcustoms, modes and such. I didn't have >a in-depth look, but it looks like your solution Ergus, is quite a bit >more complex. Why? What extras does it bring to the table? >And are we sure we need those extras in the first version of this? > >Or am I missing something and is Gregory's solution fundamentally >unusable? > >My 2c, >Jo�o > >On Sat, Sep 12, 2020 at 2:33 PM Ergus wrote: > >> On Sat, Sep 12, 2020 at 01:10:57PM +0000, Gregory Heytings wrote: >> > >> >> >> >>>If there was a built-in vertical mode it would be better / more >> >>>intuitive. >> >> >> >>Could you try the branch feature/icomplete-vertical? I need some >> >>testers before adding it to master. >> >> >> > >> >Alas no, I have been using the following to have icomplete-vertical >> >for quite some time, it works perfectly well, so I don't see why a >> >more complex implementation would be necessary. >> > >> >(setq icomplete-prospects-height 6) >> >(setq icomplete-separator "\n") >> >(defun icomplete-vertical-minibuffer-setup () >> > (setq truncate-lines t) >> > (setq-local completion-ignore-case t) >> > (setq-local read-file-name-completion-ignore-case t) >> > (setq-local read-buffer-completion-ignore-case t) >> > (setq icomplete-hide-common-prefix nil)) >> >(add-hook 'icomplete-minibuffer-setup-hook >> #'icomplete-vertical-minibuffer-setup) >> >(defun icomplete-vertical-reformat-completions (completions) >> > (save-match-data >> > (let ((cnp (substring-no-properties completions))) >> > (if (string-match "^\\((.*)\\|\\[.+\\]\\)?{\\(\\(?:.\\|\n\\)+\\)}" >> cnp) >> > (format "%s \n%s" >> > (or (match-string 1 cnp) "") >> > (replace-regexp-in-string "^" (make-string >> (current-column) ? ) (match-string 2 cnp))) >> > cnp)))) >> >(defun icomplete-vertical-adjust-minibuffer-height (completions) >> > (let* ((comp (icomplete-vertical-reformat-completions completions)) >> > (complen (length (split-string comp "\n")))) >> > (if (> complen 1) (enlarge-window (- icomplete-prospects-height (1- >> (window-height))))) >> > comp)) >> >(advice-add 'icomplete-completions :filter-return >> #'icomplete-vertical-adjust-minibuffer-height) >> >> 1) Internal functionalities try not to use advises. >> 2) The branch is not actually more complex, it just generates the >> formatted vertical output form the beginning. >> 3) It does more or less the same you are doing but with a simpler >> config: >> >> (icomplete-mode t) >> (icomplete-format 'vertical) >> >> 4) We add arrow bindings to move >> 5) Add completion matching faces is also coming. >> >> > >-- >Jo�o T�vora