From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: `isearch-complete1' should use `completion-at-point' or `completion-in-region' Date: Wed, 15 Jan 2020 01:51:54 +0200 Organization: LINKOV.NET Message-ID: <87pnfl1wj9.fsf@mail.linkov.net> References: <7da1738e-1e8a-3c12-31bf-741ee171db5c@Alexander.Shukaev.name> <8736ckl015.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="117180"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu) Cc: Alexander Shukaev , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 15 01:10:14 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1irWGD-000Tyo-9w for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Jan 2020 01:10:13 +0100 Original-Received: from localhost ([::1]:47498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irWGB-0006oQ-5a for ged-emacs-devel@m.gmane-mx.org; Tue, 14 Jan 2020 19:10:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45066) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irWFS-0006Ho-Sc for emacs-devel@gnu.org; Tue, 14 Jan 2020 19:09:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irWFR-00045r-HO for emacs-devel@gnu.org; Tue, 14 Jan 2020 19:09:26 -0500 Original-Received: from bonobo.elm.relay.mailchannels.net ([23.83.212.22]:18938) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1irWFR-00042d-8v for emacs-devel@gnu.org; Tue, 14 Jan 2020 19:09:25 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 058228C240B; Wed, 15 Jan 2020 00:09:22 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a39.g.dreamhost.com (100-96-87-46.trex.outbound.svc.cluster.local [100.96.87.46]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 7FEC78C2160; Wed, 15 Jan 2020 00:09:17 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a39.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Wed, 15 Jan 2020 00:09:21 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Descriptive-Lettuce: 5040559339d66f00_1579046961665_4104745646 X-MC-Loop-Signature: 1579046961665:3607082047 X-MC-Ingress-Time: 1579046961665 Original-Received: from pdx1-sub0-mail-a39.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a39.g.dreamhost.com (Postfix) with ESMTP id 32C8094634; Tue, 14 Jan 2020 16:09:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=TR8pxFKxmGGJzaW8/yCtt6VrNJQ=; b= T2GOjKdMYApZON1OhCO0uV1iYEJhzurk7tDdrOkTnvZiDeGeb0yFi5q5x4Nt7J2L CLk3RWwACGpJE1eThzlSPOHyG+MZr6/SkRd0LaR25uCOqZrErx8a/NjlbPilpqoU iqiTfx9fAsNMtCoKP7qDHYRPzvxrMInzYBUV3tb8DIg= Original-Received: from mail.jurta.org (m91-129-104-253.cust.tele2.ee [91.129.104.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a39.g.dreamhost.com (Postfix) with ESMTPSA id BA38D9436B; Tue, 14 Jan 2020 16:09:09 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a39 In-Reply-To: (Stefan Monnier's message of "Mon, 13 Jan 2020 14:38:12 -0500") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrtddvgddujecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddtgedrvdehfeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutdegrddvheefpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggrnecuvehluhhsthgvrhfuihiivgeptd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 23.83.212.22 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.org gmane.emacs.devel:244263 Archived-At: > First, there are 2 different cases: `isearch-complete-edit` and `isearch-complete`. > > For `isearch-complete-edit` we could indeed use `completing-read`, but > I don't think I like this idea (e.g. I think it'd be odd for Icomplete > to kick in when in `isearch-edit`). But the original request was just about allowing completion packages to kick in when in `isearch-edit`, and Icomplete is one kind of such packages. > So I think the better solution is to set `completion-at-point-functions` > and then turn `isearch-complete-edit` into an alias for `completion-at-point`. Maybe something like this: (defun isearch-completion-at-point-function () (list (minibuffer-prompt-end) (point-max) (if isearch-regexp regexp-search-ring search-ring))) (defun isearch-completion-at-point () (interactive) (let* ((completion-ignore-case case-fold-search) (completion-at-point-functions '(isearch-completion-at-point-function))) (completion-at-point))) (define-key minibuffer-local-isearch-map "\M-\t" 'isearch-completion-at-point) But I'm not sure whether this could help completion packages like swiper to hook into isearch completion. > For `isearch-complete`, it's a bit more tricky because it's a form of > completion that is performed on a text that's kept inside a string > rather than inside a buffer, so I think we'll still need some ad-hoc > code, but it could better use our completion framework. `isearch-complete` already activates the minibuffer conditionally when there are completions. It could activate the minibuffer always, then immediately exit the minibuffer when completion-at-point finds no completions.