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: [PATCH] icomplete-vertical Date: Tue, 6 Apr 2021 16:25:50 +0200 Message-ID: <20210406142550.n3yllbw7cigsia6w@Ergus> References: <87h7kkwcy1.fsf@posteo.net> <83tuokb0uk.fsf@gnu.org> <87o8er3i8z.fsf@posteo.net> <87blar3glt.fsf@posteo.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="8796"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gregory Heytings , Philip Kaludercic , Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 06 16:27:22 2021 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 1lTmfp-00029v-4W for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Apr 2021 16:27:21 +0200 Original-Received: from localhost ([::1]:37786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lTmfo-0002jZ-2i for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Apr 2021 10:27:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lTmek-0001RS-GH for emacs-devel@gnu.org; Tue, 06 Apr 2021 10:26:14 -0400 Original-Received: from sonic303-2.consmr.mail.bf2.yahoo.com ([74.6.131.41]:43893) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lTmeh-0001Un-Sq for emacs-devel@gnu.org; Tue, 06 Apr 2021 10:26:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1617719170; bh=XvAFKJ06xP/C3rWJ060bkNBW9GlyJTFVu8BALqbizrk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=LSGk/TE+uUnP43h7R4XATw+qyvfqeP71crKDD1aBHnZpQ2FxOvu+Q2AeqV+5QI20brUUGji+2RVXsCGDJWPRrvd8xEIApu6WAms5fQQmQeu8wKG1Vt9wiGRVIYbUL2xvWDUh/hhQEmh8FKFVK7Qy2a2TLAzST9jfydHVod1/ECQqvUFjBQ3EBIA8NCzty53apL98W4CJNKPiwq7Nx+qJ6tSEjzKXYKi7KL1bBIMWXKAZ0xeaZW7037HFjARQ9jcnXz6EZ7eAWLW9rpxJ9OgCTiFdVQRqq1gUBMqLnMbfA86ZRJ60qjT/ecY9g/Sv4QvDHGRlDAfHVo1Ua6kScE/Rtw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1617719170; bh=qm4QbROwqMWTqbZLdo2i+QR/WIwQ6B8Fwz1IN5iQ67e=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=FErJBgSbYonz7O6rUGdFRUiJ696wLov+eJ5GPELOiIsX0Q3T6Y7FG50ScaEl9wMyvu+cQREQU38wl9ttDN4cIcmltoJCc5mn5znUzzDxEicU6OnvIPSnE8300Yf0h4Zioum+CNcoPKah4Wpx0V35RCDJtyZf36WdAFN8HDCJaDZvbBB62wbSoM4eyQI/RaNzQR1A8v0v5ABLQ5lfCuNXQTJSRLzcqAU0ls8zAJiQHghardRES9PF9OLBptJuPM+2Z6lZFVi1pxLjqe2zYqWPtFIxk+boe3T+xJ/C3MOok2lFToJmh7Wi13rrQUzjGvdl6oeOzLv5VJlFsCX4Kaqv1A== X-YMail-OSG: O64sVE0VM1lhE2gbETB2J21LN6ppjCxCQBB3RJnBeXwq5OLloh35anxvSAsrf1I 78AtF.e6v1ZY2RQ2yFPq6AW9QBXi.gOVAUsFNkNi7L.9HTBSFB1RGyqSZVVzR9xbh5F4JLbD53XR KlK0JZEEXrQtzrVcskDPtvorXu_C6vQ2Y_ekYdblp2eFNXb78djNwr0ECi91hwZ.h5w.p1dokVor .vvd4GpFcTAjgQzCegp1ofQ7wQPaWnONsYb6Zmp6we.U6kPtL9Y.xkMHddRAK8N0En6brXZ46Yl. MA.RJht2ixuLQSlPpQUmVHtm5ZOElRGCa6Ml3dxD5VTkpvOB7U.cWvQHzOe.z0thxaETHyn0w6pP jRMyXU.76FAeFjyURoQ5pNF86bD4otGvBUXceTRHfFnbtTVe5Erog6dRJYq2W2RXa6.6nOR9QSLc ngEDFr6_B3Wj3SPRb4oGNKeNW2EwVeg9aeMt4PvLJhiQ2.fDrnwYFfCshggEigs8Hvb8fpcxyeUj vKh2FBz6fjHyQpcZ4pzqR7JKvc0D_6nOgGAYF0ETDq5wBEm6IUIEqtbRTSqtxV_kwFUeBw_1b0pI cNeNKlSBkNW3pN8OCsKbx2sWE6jJ45wKgCVrs1KRkvhuQm0tAvdxICxQ2.4kwIkPe5FCFGvs3jPc TUsahL3moZ4HbiXAaMfsQVNwcpBsM300NjlRx.iR1fuxkH00WlftRpaY4Jy.tZLig._xFpZ.1LgJ riF1s_G2o9IOvSE7gjmqnCIQNPzj9YK6Rf0DHZ4HIp7DH5Iso4H6sSwJ6.F4c7QKIKQ4K9pj1zXX pqSB4.HeSBxWVFhxuRU.WdEeaNY6.Oh_cJf_pEqROf X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.bf2.yahoo.com with HTTP; Tue, 6 Apr 2021 14:26:10 +0000 Original-Received: by kubenode531.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID bfb9d0e307099e6f7a17d5ad4a2900a8; Tue, 06 Apr 2021 14:26:08 +0000 (UTC) Content-Disposition: inline In-Reply-To: X-Mailer: WebService/1.1.17936 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Apache-HttpAsyncClient/4.1.4 (Java/16) Received-SPF: pass client-ip=74.6.131.41; envelope-from=spacibba@aol.com; helo=sonic303-2.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 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:267476 Archived-At: On Tue, Apr 06, 2021 at 09:20:53AM -0400, Stefan Monnier wrote: >> As I said, it's meant to be a derived minor mode, much like lisp-data-mode >> is derived from prog-mode. > >FWIW, we don't have a notion of "derived minor-mode" yet. > >> A similar example (in the same file) is >> fido-mode which is derived from icomplete-mode, and (in another file) >> whitespace-newline-mode which is derived from whitespace-mode. > >The example of `fido-mode` is actually the one I would put forward to >argue that icomplete-vertical should not itself activate >`icomplete-mode` but should just change the way completion are >displayed, so it can be combined wither with `fido-mode` or with the >normal `icomplete-mode`. > >> Moreover, I think that in general local changes to code are better than >> global ones whenever that is feasible. Using a user option would do the >> same thing as the minor mode, except that the changes would be scattered >> through the existing code. > >I don't see how. I'd imagine a code like: > > ;;;###autoload > (define-minor-mode icomplete-vertical-mode > "Toggle the use of vertical display in `icomplete-mode`. > > As many completion candidates as possible are displayed, depending on > the value of `max-mini-window-height', and the way the mini-window is > resized depends on `resize-mini-windows'." > :global t > (remove-hook 'icomplete-minibuffer-setup-hook > #'icomplete-vertical-minibuffer-setup) > (remove-hook 'icomplete-completions-filter-hook > #'icomplete-vertical-reformat-completions) > (when icomplete-vertical-mode > (setq icomplete-separator "\n") > (setq icomplete-hide-common-prefix nil) > ;; ask `icomplete-completions' to return enough completions candidates > (setq icomplete-prospects-height 25) > (add-hook 'icomplete-minibuffer-setup-hook > #'icomplete-vertical-minibuffer-setup) > (add-hook 'icomplete-completions-filter-hook > #'icomplete-vertical-reformat-completions))) > >[ BTW, in the above code (which I basically copy/pasted from your > patch), we should save&restore the values of `icomplete-separator`, > `icomplete-hide-common-prefix`, and `icomplete-prospects-height`. > Also, I'd recommend to use "--" in the names of the new hook > functions. And while I'm nitpicking I might as well mention that > comments should be capitalized and punctuated. ] > > > Stefan Just to remind. Some months ago I actually asked here about the possibility/complexity to add a parameter to the define-minor-mode function so we could do something like: (icomplete-mode 'vertical) (icomplete-mode 'horizontal) (icomplete-mode 'fido) (icomplete-mode nil) And so on... in order to set the proper hooks and initializations The use case I had in mind was exactly that. Because I was working on icomplete-vertical, icomplete-tabular, and some others that in general just require minimal differences between each other. I don't actually like the idea of adding a new mode for every different implementation and would prefer an option; but I understand why Gregory needed a new mode to do this (as well as fido-mode did.)