From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.help Subject: Re: Canonical way to add a pre-filter to completing-read Date: Thu, 10 May 2018 17:19:52 +0000 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1525972715 21978 195.159.176.226 (10 May 2018 17:18:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 10 May 2018 17:18:35 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 10 19:18:31 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fGpD4-0005bs-1m for geh-help-gnu-emacs@m.gmane.org; Thu, 10 May 2018 19:18:30 +0200 Original-Received: from localhost ([::1]:34887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGpFA-00080z-Uf for geh-help-gnu-emacs@m.gmane.org; Thu, 10 May 2018 13:20:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGpEc-0007uy-Du for help-gnu-emacs@gnu.org; Thu, 10 May 2018 13:20:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGpEa-0007lg-UN for help-gnu-emacs@gnu.org; Thu, 10 May 2018 13:20:06 -0400 Original-Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:44178) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGpEa-0007lM-If for help-gnu-emacs@gnu.org; Thu, 10 May 2018 13:20:04 -0400 Original-Received: by mail-lf0-x244.google.com with SMTP id h197-v6so4021345lfg.11 for ; Thu, 10 May 2018 10:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vUsCKXKnsf4O7smNABAWrpJKlOzihccj6s6LLUHxBc4=; b=n1hdW7OSf6nnlB71s2CJEY0FVLxFzksgCor9307/4IkJE61pJB5KcA4w7I6eN4Q0vW su+9Vd4Zw9oztvq58HM71LpO76VOye0RxPuX7XOHE74f3MVkeCBqrN5HLZO5BDVTxVW4 3RA1ug8mGXA43kzmy31B67pBNtfJ9bUT8XPRhk76dMR8VqtRVBDV92clb30kcDd9cRcA MDCpdnsGPwmPcuWMBIk1rHc9O7QkNwv14UlB9T8UEpsoJnMZ8tqr+GC7ZiC55bcOUtQP X9armFfEDqhLSxGVeSCYy8u64D9oJ1ZrVIhahNZ5BPl3QNAG895X9+MlaI98aDX+yxil KFgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vUsCKXKnsf4O7smNABAWrpJKlOzihccj6s6LLUHxBc4=; b=HlTFF3Q+ZxN0k4ZPn+YCJAso+Fu6Yh8m+tj/vGv1DoeWrWDef+pglp8uI7rLxQ6/73 EKxZ3R+ShTe9srU4/SLppe05y1zmBmYKevIJdt79sVTiwV2vXDZ6OMVjkH0Ogit8knWw U3BHqW6Wwx7FQtVI+PbFB2OUt907whJIMOYVzINZzIaV2jUUY/YmbtM4LxHocRfm6Jq7 +F/PBJN26i7OzIytzgMrCl2frwXsI1OYb6ms8dXXaiVnZIrRf/WB+JLC9cSysOYMqkoG R/eM00M2uI5ZHr02B9Pk2D8ho1nvcSqWsmyZD+gITE1ap9ISA0sPd6WuGZf4J+FwNTrR 5JVg== X-Gm-Message-State: ALKqPwfqOj/R+f384GqNwOxj+UhLdqgSGN8Hd2hPUknXYs/qjMjhwvTr YDPgmBtBdWasJsdk/jjxjADuj4KqaHG+7mJeJSw= X-Google-Smtp-Source: AB8JxZoptppEaeOwn/BrFyscE/or+Uu16Ikf6NFfRizMqcUN1xSxE24Q8tww/SoRkPWVHITlhVSXuLqjXtU0iK4HyR0= X-Received: by 2002:a19:5a57:: with SMTP id o84-v6mr1592270lfb.62.1525972803044; Thu, 10 May 2018 10:20:03 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::244 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116704 Archived-At: Hello, On Thu, May 10, 2018 at 11:22 AM Stefan Monnier wrote: > > Could you clarify exactly here: > - "will show"... when the user does what? > Just calling the above `completing-read` won't show any list of > completions > Hmm. I use the ivy package, that provides a vertical list selection interface even when using completing-read. This is what I meant: https://i.imgur.com/1Ki7uFX.gifv In the GIF, I first set the "bc" value to INITIAL-INPUT. In the later part of the GIF, I set it to DEF, where that "bc" simply gets added to the available entries (and also of no use to me). - When I hit ? at the prompt, I indeed get a list of completions, but > that list only includes `bcd` because the default completion style > does not include `substring`. So your use/test case is different from > the default. > Is there a way to make it behave as you see in the first part of that GIF? i.e. make the "bc" filter the available candidates? Let's say the user does > > M-: (km-completion "Entry: " '("abc" "bcd" "cde") "bc") RET > > and then types `a` (and then hits `?` to see the list of remaining > completions, or maybe he uses icomplete-mode to always see the list of > remaining candidates). What do you want the list of completions to be > at that point? > If I type `a` there, the entry would become "bca", and nothing will match.. but if I do `C-a a`, the entry will be "abc", and will show only that "abc" element. > Some things you can do with the standard completion-UI: > - setup your completion table such that it uses `substring` completion > by default. > That sounds like that would work.. can you please point to an example? > - use `completion-table-in-turn` with the first table being a sub-table > which only includes the entries that match "bc". > I did not understand this suggestion. -- Kaushal Modi