From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] icomplete-vertical Date: Tue, 06 Apr 2021 09:20:53 -0400 Message-ID: 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 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18227"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Philip Kaludercic , Eli Zaretskii , emacs-devel@gnu.org To: Gregory Heytings Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 06 15:22:48 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 1lTlfM-0004bs-O5 for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Apr 2021 15:22:48 +0200 Original-Received: from localhost ([::1]:35604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lTlfL-000878-N5 for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Apr 2021 09:22:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lTldd-0006tr-AJ for emacs-devel@gnu.org; Tue, 06 Apr 2021 09:21:02 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:50736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lTlda-0004Z7-S7; Tue, 06 Apr 2021 09:21:00 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 34782100216; Tue, 6 Apr 2021 09:20:57 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 355AE1001FE; Tue, 6 Apr 2021 09:20:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1617715255; bh=08/3XVxsPqZnq1HOKHkoicSAYY+L2kJd2KQ+yLIuZiI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=PsJCZMOGfnS/w9jOdGlJYWBcU9v9xiOrWwzSMDBUJnajJeyp00nrBn9hO/P7XiQWf gMQxLHR4n+jxTXtwQp6Mk88hyW3cTP8CY+TAl1D2a05qus8jG8CLt6yXT8YhwBSKPk 0cEPrR0iBgebIP8/mw0xAbsvW/0nLRO3CgYUtLFOi6uJoXkBApJBswRXy6ejNX2Xe/ Ta/dY0wQGtPSCF7ZaYketQWOUEw+yfMqVwtAlqmcg8KMlJRuVrudQSHvvBvae2zU1e u1ZgsELs+zoHlSXECYFs1x35QW0ULk+aFR1Mh3DazZoY8qTrzux/Fr5sThxI0+Mpo1 RQ1n+VWX+jceA== Original-Received: from alfajor (104-222-126-84.cpe.teksavvy.com [104.222.126.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F14A61200DC; Tue, 6 Apr 2021 09:20:54 -0400 (EDT) In-Reply-To: (Gregory Heytings's message of "Tue, 06 Apr 2021 10:20:02 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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:267469 Archived-At: > 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