From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#48572: 28.0.50; Add `passthrough` completion style to minibuffer.el Date: Sat, 22 May 2021 19:20:53 -0400 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8606"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 48572@debbugs.gnu.org, joaotavora@gmail.com To: Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 23 01:22:17 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lkawi-00025F-BB for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 May 2021 01:22:16 +0200 Original-Received: from localhost ([::1]:41890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkawh-0001xs-Do for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 May 2021 19:22:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkawU-0001xk-CY for bug-gnu-emacs@gnu.org; Sat, 22 May 2021 19:22:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lkawT-0003am-QN for bug-gnu-emacs@gnu.org; Sat, 22 May 2021 19:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lkawT-0006eC-JE for bug-gnu-emacs@gnu.org; Sat, 22 May 2021 19:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 May 2021 23:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48572 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, joaotavora@gmail.com Original-Received: via spool by submit@debbugs.gnu.org id=B.162172566325484 (code B ref -1); Sat, 22 May 2021 23:22:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 May 2021 23:21:03 +0000 Original-Received: from localhost ([127.0.0.1]:40239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkavX-0006cy-CA for submit@debbugs.gnu.org; Sat, 22 May 2021 19:21:03 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:57622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkavT-0006cC-GM for submit@debbugs.gnu.org; Sat, 22 May 2021 19:21:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkavT-0001vU-8D for bug-gnu-emacs@gnu.org; Sat, 22 May 2021 19:20:59 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkavR-0003AO-09 for bug-gnu-emacs@gnu.org; Sat, 22 May 2021 19:20:58 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 7922F4411A9; Sat, 22 May 2021 19:20:55 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2D0514411A4; Sat, 22 May 2021 19:20:54 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1621725654; bh=bjqTCU3Oluws2M7nulYK2MQK7wqPgmlms2pBexnkVY8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=DyCcAxqv1gfgjcA4L4U1EJrpqbuwt3vX0zUuxhg3UjthLti4yfVDKY+71M7Xz+1Xj Y+3ZP7jA880YM617EQ1UpDLW5J+iDTy3WbCQ5/IEIrpRNsy5dWP95K/DBB+WEnTbV5 Iyduga5t/HVrZMlaKGmGX8QM2WQdyjPH8s+U4a7eCW8sKjmTQtnzOguKSZlnFDuFne PoqmkJqwcM49MWh/IkSwU9xgFA42q4u4PzLFQCCnAPGqImZqWaLyXte1rG7FXwF/W8 12VkQIHODoWiqQeqol/9QCI9MaKOKks+TwLpMVWlFdIRz+DTNTd7quJ47lALX/G78i uYPLvlTwkb4Qw== Original-Received: from alfajor (69-196-163-239.dsl.teksavvy.com [69.196.163.239]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id EBE1C120B01; Sat, 22 May 2021 19:20:53 -0400 (EDT) In-Reply-To: (Daniel Mendler's message of "Fri, 21 May 2021 20:48:35 +0200") 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: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:207070 Archived-At: > (defun passthrough-all-completions (_str table pred _point) > "Passthrough completion function. > See `completion-all-completions' for the arguments STR, TABLE, PRED and > POINT." > (let ((completion-regexp-list)) > (all-completions "" table pred))) Clearly, this is not right: passthrough completion should pass the `str` and `point` info to the completion table. The completion table may opt to ignore that information, but we shouldn't prevent them from using it. I expect most passthrough uses will want to use `str`. > (defun passthrough-try-completion (str table pred _point) > "Passthrough completion function. > See `completion-try-completion' for the arguments STR, TABLE, PRED and > POINT." > (let ((completion-regexp-list) > (completion (try-completion str table pred))) > (if (stringp completion) > (cons completion (length completion)) > completion))) Same here: I think it's better to pass `point` to the completion table and let the completion table return the `cons` cell. Furthermore, `all-completions` and `try-completion` on a completion table is defined as returning only the prefix completion, so the above code would force `table` to be a "broken" completion table that doesn't obey the normal completion table API. Stefan