From unknown Tue Aug 19 10:01:14 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#50459 <50459@debbugs.gnu.org> To: bug#50459 <50459@debbugs.gnu.org> Subject: Status: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. Reply-To: bug#50459 <50459@debbugs.gnu.org> Date: Tue, 19 Aug 2025 17:01:14 +0000 retitle 50459 28.0.50; Python shell completion is incompatible with flex, o= rderless, etc. reassign 50459 emacs submitter 50459 Augusto Stoffel severity 50459 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 07 13:52:33 2021 Received: (at submit) by debbugs.gnu.org; 7 Sep 2021 17:52:33 +0000 Received: from localhost ([127.0.0.1]:57630 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNfGq-00055A-PQ for submit@debbugs.gnu.org; Tue, 07 Sep 2021 13:52:32 -0400 Received: from lists.gnu.org ([209.51.188.17]:60754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNfGp-000553-M8 for submit@debbugs.gnu.org; Tue, 07 Sep 2021 13:52:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNfGp-0007e2-DR for bug-gnu-emacs@gnu.org; Tue, 07 Sep 2021 13:52:31 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:33498) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mNfGn-0000Rf-V9 for bug-gnu-emacs@gnu.org; Tue, 07 Sep 2021 13:52:31 -0400 Received: by mail-wr1-x436.google.com with SMTP id t18so4948166wrb.0 for ; Tue, 07 Sep 2021 10:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=x0+Kn97p03u/tacOLxw0DYrMaIm8EB3xoYfvuC45hOg=; b=ZibuQ2aKp9V53yrhm/3gSOCLYo7TUZSlSV1ijhV4hec0835AU8Z7Cz/9l9KDK9QmV3 ylTSS0CuO/Wil5FCSNEQb0wweOdm65B+Rdz10CIPxpKEVd0SbV9H0IRIifgilpVa/88H slG33OL8pSiSidmHnLDMXhaUZVDkPoSKnUoAFaqQfaqd7pvjIHDCQUx8A1FCafm/2uQW EZ74ISgzDT+C3gn2V6tnUuRSDGHzxo6KhpAg3WrXdmptBlhWAiWxs93uGpEegsVhcWuX 3pg5Qa++/niCfg/Nfoub8WVV0PIAt2QsoCfH55+z933N6B5xs6JyAC/MqNb551Zu5oA9 1Y7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=x0+Kn97p03u/tacOLxw0DYrMaIm8EB3xoYfvuC45hOg=; b=oVAC71mq8vTjnw2f4AgnLSg0mqkbhjU8lHn/sIpNBxyhVQ+1EBmhyMyJ17F6YBrTq/ kv5AagEkLy+KofVOv56/f/UTA2/Yy6H1qufjx6QFEMrKwS4BOGlq6vAXeP2tprwdLNJ6 dFafuXATjXMsg8WtdKbqEdolEaQyf0Dzn6m6At4/Wm0J9byovFTyQIEkCFBMUjyHQPhJ 4OFGa4Kjse7Sg3J8+0wsEC4vpQkYdcThbG2zHJ2UhooWOrCgabU/OzRV8ZZ+XwduSuj/ NEJVazGtn3FxGVI8C0rzG8MqXMaqEDXPbx9kVt9aG72o0V4Gmsu+eG9SvbaJ2WGU+GJK luuA== X-Gm-Message-State: AOAM532bANLmk+S+IXYRFWptLNgD6Ci+jjVGj5wHuiWBO7JgV/hmjQr7 KfL1J09Zo2hXNKwaWXekTf663Cb+XAM3sQ== X-Google-Smtp-Source: ABdhPJwY6+AgRckMyWWl0TA+PS9j/KuyaiBNwTIuR7hw9kNjoI6pgEcJt1Trc/eLwVtJtASKcqHFzw== X-Received: by 2002:adf:b7cd:: with SMTP id t13mr20477554wre.63.1631037148152; Tue, 07 Sep 2021 10:52:28 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id u26sm12489167wrd.32.2021.09.07.10.52.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 10:52:27 -0700 (PDT) From: Augusto Stoffel To: bug-gnu-emacs@gnu.org Subject: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. Date: Tue, 07 Sep 2021 19:52:26 +0200 Message-ID: <87wnnsl1d1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=arstoffel@gmail.com; helo=mail-wr1-x436.google.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) If I start a Python shell on Emacs -Q and type, say ``` x = [] x.c ``` then I see, as expected, ``` Possible completions are: x.clear x.copy x.count ``` Now, if I (setq completion-styles '(flex)), then no completions as reported in the same situation. Same thing with the `orderless' or `substring' completion styles. Moreover, the same observation holds for native completion on or off. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 08 13:45:01 2021 Received: (at 50459) by debbugs.gnu.org; 8 Sep 2021 17:45:01 +0000 Received: from localhost ([127.0.0.1]:33529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mO1d7-0004kR-B6 for submit@debbugs.gnu.org; Wed, 08 Sep 2021 13:45:01 -0400 Received: from mail-ej1-f52.google.com ([209.85.218.52]:45978) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mO1d2-0004k9-4c for 50459@debbugs.gnu.org; Wed, 08 Sep 2021 13:44:59 -0400 Received: by mail-ej1-f52.google.com with SMTP id e21so5768144ejz.12 for <50459@debbugs.gnu.org>; Wed, 08 Sep 2021 10:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=pbBKr/x74wo/OyhVgObk78Lwm5KHcldkX4BydyGpjfM=; b=eZdcgZOCrP6grKItUUurFIfktHNIaiq5BizlIJssP2CN9LcFxmFzJ3YGh5N8osPVx5 GXjgN+qqX0VRX+kbi54KkMe0k+gLgXEell3BRoQ2o5cOFLTRqbrM5GAOvcytjgDphOh+ N4COkZAfocRWYIVFc1zY4gXmUKL52FTiOUwiDlom6dI5ZjSDEmMkq3OESDxRHsaGQAMR 7mgrYV7BFctqwtj/8KtkWlv5tcHECUi0JSUgcvES0xxuqf1qT1T9XIPCVD6A87C/7+cl 3kcCpzJ6ShLDSM7N4l7MaGUzfq+pCEjSCocVv0Y/KQe3pPD/TJ3j7jsdYwzyR1uZvLqe rzqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=pbBKr/x74wo/OyhVgObk78Lwm5KHcldkX4BydyGpjfM=; b=PcFpblgEzSUs+cFGWjz9GOor8I9Hv+M5YWvYB6bTVWa5Ev8YXAqo0K5yJkUd8G5b7i rgrq0myKk3FOZ8JQpsftb5AZyKMYBEIXiLk1MrGIoOV1kBgecfi7LZK7sWMHjj7DQuFM R+xsIt3Nn4zEdgfy67jEHjZh95YT1cEGrisjLKEuWKD0sc/J4UxPPo0Qk5shB+arBE4p y4jCbp4TnmT2Um/TrvdCo7nQEgziXSL0aYLxKaqeX5igw1K1teB1XEwfTo4OTh7K6R+6 ZEJ7EKyxHDbPHJxJztUdrERP1iqNMnG0ZjET0wkK7OaDgFNIRyDl832zgzM7SgsKYWMH rtQA== X-Gm-Message-State: AOAM532vM9HUCrZGL7wd67Q6Xk071mJEZejvUz04ho68/M0Z+g6MBpZ/ QEotE7l2BkEo0sgyCDe4zLKZ2uWwbHviJA== X-Google-Smtp-Source: ABdhPJz4orVNhuw9F5Qw3B0O2J3ZIBU4HA5gHq5LKNI02WFRvix2WVTdUUVvvvg+dydYEQ+N5vPZjw== X-Received: by 2002:a17:906:974a:: with SMTP id o10mr1096681ejy.480.1631123089887; Wed, 08 Sep 2021 10:44:49 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id x11sm1564778edq.58.2021.09.08.10.44.48 for <50459@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 10:44:49 -0700 (PDT) From: Augusto Stoffel To: 50459@debbugs.gnu.org Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> Date: Wed, 08 Sep 2021 19:44:48 +0200 In-Reply-To: <87wnnsl1d1.fsf@gmail.com> (Augusto Stoffel's message of "Tue, 07 Sep 2021 19:52:26 +0200") Message-ID: <87sfyfotbj.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50459 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Tue, 7 Sep 2021 at 19:52, Augusto Stoffel wrote: > If I start a Python shell on Emacs -Q and type, say > > ``` > x = [] > x.c > ``` > > then I see, as expected, > > ``` > Possible completions are: > x.clear > x.copy > x.count > ``` > > Now, if I (setq completion-styles '(flex)), then no completions as > reported in the same situation. Same thing with the `orderless' or > `substring' completion styles. > > Moreover, the same observation holds for native completion on or off. On closer inspection (and discussion with the orderless people), the completion-at-point function in pyhton.el conforms to the completion API. The issue lies in the fancier completion styles, which always send the empty string as the STRING argument to any completion table. There's a workaround for this, which I could provide, but this doesn't seem advisable. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 09 03:12:01 2021 Received: (at 50459) by debbugs.gnu.org; 9 Sep 2021 07:12:01 +0000 Received: from localhost ([127.0.0.1]:34038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOEE5-0002BA-7B for submit@debbugs.gnu.org; Thu, 09 Sep 2021 03:12:01 -0400 Received: from mout.gmx.net ([212.227.17.22]:56167) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOEE2-0002Ar-1b for 50459@debbugs.gnu.org; Thu, 09 Sep 2021 03:12:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1631171511; bh=rNdn0YrtyC3iI8F0caH/Snz9AMUvJ3Jz25N3yfiZxLc=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=P6HZT83gbxHYanjCG9PnC3aS8jqJ5Wr8/NZCNkmmUAc1BH83XaY0l9OzAxcyai7rW RsdamQ9j4HQsjeH2UcPtVUOavMEe2NT92KBcF4fwjK9ECHUiyDqIJskZzKw5bPGE5X vG4YSZobIj5IPa+1PibCsg15xlrO+D6vU5yOsFsE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from gandalf.gmx.de ([213.220.148.40]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M7b2T-1mIRrO0fpV-0086Hp; Thu, 09 Sep 2021 09:11:51 +0200 From: Michael Albinus To: Augusto Stoffel Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <87sfyfotbj.fsf@gmail.com> Date: Thu, 09 Sep 2021 09:11:50 +0200 In-Reply-To: <87sfyfotbj.fsf@gmail.com> (Augusto Stoffel's message of "Wed, 08 Sep 2021 19:44:48 +0200") Message-ID: <87tuiu9qa1.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:G5zD0XZ1/boq9095vR/d8K+T9OwEnChuAh0kUyYI+X2iHb/6FEM iAePprWGF7XPqeI6/Q/5q/CHR4dn6m7OEYubvJ1J6Yee97ZRgrJdnR5P0zMxOXiVkbNwSKF w7FFlx5baxYhup2r7x7l9GkHCgT5oqiZJpTSY5cYypFvg2jTqzWqEwM8ASpRtMdmu/ufLSm 40u7uDThJ3CzDSB1BgtzQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:qACo2txY9qs=:eJkYcb1Sqr7rboAhhOG6e4 CBqgZyWi3pvwEHv74r5/3QO1ZIp3+tqN5ghYqf1nrjNMfY3+FiY/IWcW0BJl+yo383AmFsRwu aRuKZg/0DXfGjglYlnXAYtR9wcAfFBHHGpxI3NedqrzUiAd/j+0flC946FiMca0trymqJrBy3 v5u98RnjaUDs1C7McCzlwBoHE5Zlh5iddY6zR7AnVVYU+guEkAMIvVBuPu8D/QlNosb76XJlK o5r1dD5bj4tumrqvJVJ2aL5BxC0HnlKM4sSESn5glNMeGhj5MsgxjN3qkT3329fPcciv3DXer BvXNDu2to3IG5qSNCVSjn3Um8RBViQNz1/npYYFk8G+2i6/YTj3olpLOq21fcKlPElLDhQZoR NUSgSTTXTthwG+Xlm9fwGXmdnje/nhtsRyHKocrL922g7rR4gCkKJclScq7vpLzkFP0XyuUQG dT2cjKny+IH3fvEXsTfLz5OcPfEUr5e8H1h1d2eXHsKHXUSgXOldZBK7KE8h4S2Vs4p79I1xL jvbpvlK+0d0E5yA44Kt6a8oVS1EEDFmRHU6FibMEqLras4uzidTYHyhAXT/u5CwBXmxK3q1Jv C4nw14kbNFdtPRzuPxzp2VzvlAr/pN1MfJgWSTucQX3ADeHv6coQEHzbtUN6mpcC6vqEFJXUc +9dnP4uLbakHxs8s6pOi3ChgEdKtm+wMHOG1hCJ2oPDQMB9bQuzM8jYLP6zlp1mGqD104/g4X /JD9lVVCt8sEoL3g0iho5dVdbz7SmfJkLnXcpKx4cIVSBN9yEJLfUemSjTeGxpZM6nHYf82d0 802koaWqOfX9smvK4M82S8TtkiR7KGcdFrJB7khWR81gTZhLcdwgHMGJeIPB9/qJkWqQwudCb ftCXhMtQgYg5G1Qa0eOzgi37kLupghqi5Nl+VJ9XckdD57otDp+OK2eh6Gye7RHDc34OPBGlF PHRP4vJo/Lk0rPeYUIyWhebAc8Mn/MB39lMjsPhwXTnaOn2ibUtvTUEwJyqZ0/bRSGDy2DqCQ zl3pZPilwL+vXVzhDzYY0JFvAOXjSozd4kFdnMmyKYNFn/xy14EfYtAzbc0kDKqXkYbZatp/o afH2tTaScV9GII= X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Augusto Stoffel writes: Hi Augusto, > On closer inspection (and discussion with the orderless people), the > completion-at-point function in pyhton.el conforms to the completion API. > > The issue lies in the fancier completion styles, which always send the > empty string as the STRING argument to any completion table. FTR, a similar issue has been discussed recently for remote file names in bug#50387. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 09 03:30:38 2021 Received: (at 50459) by debbugs.gnu.org; 9 Sep 2021 07:30:38 +0000 Received: from localhost ([127.0.0.1]:34043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOEW5-0002fA-QS for submit@debbugs.gnu.org; Thu, 09 Sep 2021 03:30:37 -0400 Received: from heytings.org ([95.142.160.155]:53250) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOEW0-0002ex-K2 for 50459@debbugs.gnu.org; Thu, 09 Sep 2021 03:30:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1631172631; bh=BhVPMclwEY7LQ7RD1iP2pPrfkLD3vjoMb9sFl/nKUj0=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=wwlo/dPalLHXRHuBRNspEr/KB9Sgzp/XJoiErCIaw/gBm5EG0V4JTnJPlIDVd9aA7 KzwVcvVUlcEjqDgdk+/A2uBY+U6FG37JMWgdikMynHzVGgtYHjiRJ7LT++1eSfNfk1 U2Icw+pB0JQfpPI1H7TgZcY0fmivTwjdU93PiS8fIqtEYUnN2Ls5l46fmxnrWhe/kB FAZJovPfLPbxzvxmDhI6VXHuzG3R+D6d5Yxk/JBWHdM3MPULDpk/u/iSgs+29CcAxG apZf0LjoG+U3nDkA/CdDbeB1GSTW6rf3LYFw8uYye+ByvXK6HqPLouCkAvAZMsbSW+ 4HEALmPRKqdnA== Date: Thu, 09 Sep 2021 07:30:30 +0000 From: Gregory Heytings To: Augusto Stoffel Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. In-Reply-To: <87wnnsl1d1.fsf@gmail.com> Message-ID: References: <87wnnsl1d1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > > Now, if I (setq completion-styles '(flex)), then no completions as > reported in the same situation. Same thing with the `orderless' or > `substring' completion styles. > You shouldn't use (setq completion-styles '(flex)), you should use (add-to-list 'completion-styles 'flex). Otherwise the default completion styles are not used anymore. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 09 03:33:04 2021 Received: (at 50459) by debbugs.gnu.org; 9 Sep 2021 07:33:04 +0000 Received: from localhost ([127.0.0.1]:34047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOEYS-0002j1-69 for submit@debbugs.gnu.org; Thu, 09 Sep 2021 03:33:04 -0400 Received: from heytings.org ([95.142.160.155]:53260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOEYN-0002iW-5q for 50459@debbugs.gnu.org; Thu, 09 Sep 2021 03:33:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1631172778; bh=PnIILICnEAix2wfKMjG6IYOQvHnolfDZG310qDYsulI=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=Oy9hk1lRb6milXK+kJVQVQ6pjb1poQlfvsySwvyIP+TBOP4ziTJKDBy5FEN/yQU3Y lrYGOaXM0/mxmSD/aNKzYmP8VTt5YpocLHu8DmP9Ie+L7D6CL9XftqBUD3kj+/mTVv AitPSGsnv7l1zKckhwNZ7pLmyKB+J1re/y4DYYSscZuFPUQAuMAb8xq429SvfI9pSR MprizmEwgNrhaLyeyGsmGch3MtYbJw63oTJ0D2sH/zvhDG+F3pEQyDvGHlSnu3fK4K 8TNJ4e7gWqCVNaMfRY9jDbWanuW0qpqmggWNVYrW6jgpqVVmZSKBOsEUOIrFhP115i XvGc2YTVRwwoQ== Date: Thu, 09 Sep 2021 07:32:58 +0000 From: Gregory Heytings To: Michael Albinus Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. In-Reply-To: <87tuiu9qa1.fsf@gmx.de> Message-ID: References: <87wnnsl1d1.fsf@gmail.com> <87sfyfotbj.fsf@gmail.com> <87tuiu9qa1.fsf@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org, Augusto Stoffel X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> The issue lies in the fancier completion styles, which always send the >> empty string as the STRING argument to any completion table. > > FTR, a similar issue has been discussed recently for remote file names > in bug#50387. > Absolutely not. With (add-to-list 'completion-styles 'substring) or (add-to-list 'completion-styles 'flex), completion works as expected in Python shells, and not in Tramp. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 09 03:40:41 2021 Received: (at 50459) by debbugs.gnu.org; 9 Sep 2021 07:40:41 +0000 Received: from localhost ([127.0.0.1]:34052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOEfo-0002uJ-VK for submit@debbugs.gnu.org; Thu, 09 Sep 2021 03:40:41 -0400 Received: from mail-wr1-f51.google.com ([209.85.221.51]:33543) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOEfj-0002u3-OA for 50459@debbugs.gnu.org; Thu, 09 Sep 2021 03:40:39 -0400 Received: by mail-wr1-f51.google.com with SMTP id t18so1162346wrb.0 for <50459@debbugs.gnu.org>; Thu, 09 Sep 2021 00:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=iljGG/mhoeN/xknUkCJUhNFoJSiKRJOgdc/1k5LsRvo=; b=IAlvWUQtjPgxG81r8hfh3V5+cucQaJFLxpBtH94t7Zs5EPDJQGXt864czQr+pt3emI hx+vYXsb718+Vnl7lOCDssYB7+WGlATvfLXg4Sg6RNQJMOblcpBE3hKwaBLTOj5Lo0Vf 4uc6cyoyv2vWPF0soMMDEAXdOYoyrrHRtbmVkzin6QP87nwrcl67L12KkYFnwdssn9Hs CdQm5UBHr+8E1rFv4+gTR1rcAa63n1NQzyeQkJtXZMqS65d6PYlk1is/+pZBJyMgRhLm QesYblAWg0p8VQ1q4i1ZffBhTkL1fo6YGQMNbbXMFbx6u3yqLJE2HqeE1G7yQD/f+sJv iLnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=iljGG/mhoeN/xknUkCJUhNFoJSiKRJOgdc/1k5LsRvo=; b=heu28apTHZzzyttXI14mjhOxJkxnWLxZGU4x11TI9VY5k0U7/Z5RhtFuKDGWuTa6pN CLcW/5emlvOF2q3jP2DV8AK/qUZfigXHiCwE5e+yrJc6tBgWfl/s63ydKiyY9FrsjkcC p8E7/f4Gx5Kf2bXJMpjRjgJYnnC64sVt14ZbzAQBTTXowymVnOogd1+JsKDLYCTOkVvA DVSUa/iwuRifWNNTH0O1sY8OGkopjq1tsfGc9hKRz4hYDmmhnS+fXP+bFl7gFe/eA5gt G2u7JNyPJy2B4O0M2u2x4LAeoAXqOtwGShcUNTaghVvP+Brc1+9CriXII6EYeVZoPanN KBBQ== X-Gm-Message-State: AOAM530OlmIPsNUMZD9FgfcYd7cRmJRnjz2nD8Fdxzx567egv8L0pun1 iJF35Y1hnLIj+aTmlQr6fix+6lwX0D2s3g== X-Google-Smtp-Source: ABdhPJz4w6y2A0KI1YJEIkS6kscwcyp4T+G14FvX2shzytJRJEHh1Q/r2+9shSK0FEhLRZA929EOZg== X-Received: by 2002:a05:6000:1603:: with SMTP id u3mr1778309wrb.227.1631173229552; Thu, 09 Sep 2021 00:40:29 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id r26sm852605wmh.27.2021.09.09.00.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 00:40:29 -0700 (PDT) From: Augusto Stoffel To: Gregory Heytings Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> Date: Thu, 09 Sep 2021 09:40:23 +0200 In-Reply-To: (Gregory Heytings's message of "Thu, 09 Sep 2021 07:30:30 +0000") Message-ID: <87czpijixk.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Thu, 9 Sep 2021 at 07:30, Gregory Heytings wrote: > You shouldn't use (setq completion-styles '(flex)), you should use > (add-to-list 'completion-styles 'flex). Otherwise the default > completion styles are not used anymore. This doesn't change the issue described in the subject line. I would still not see any flex completions if I did what you suggest. Granted, completion wouldn't be totally broken. But I don't mind letting the brokenness manifest itself. Therefore I use (setq completion-styles '(orderless)). From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 09 03:49:24 2021 Received: (at 50459) by debbugs.gnu.org; 9 Sep 2021 07:49:24 +0000 Received: from localhost ([127.0.0.1]:34063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOEoG-00038E-6Z for submit@debbugs.gnu.org; Thu, 09 Sep 2021 03:49:24 -0400 Received: from heytings.org ([95.142.160.155]:53298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOEoC-000385-Lx for 50459@debbugs.gnu.org; Thu, 09 Sep 2021 03:49:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1631173760; bh=PgcBu92J+TzgN7PRDfy3E3rEvn4xv0PtsYaKZJLY7II=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=IZ6/LlcIkM4NTVeNsqjdmnopHMM5E4tafNLGb5Zi04fxl1xQNiBfIHH6iY0VR0xUZ U9oLsfsaLhoDnXAP8EoVipbWnzSeHMs/bROVnjakHxMCcZh0LzBd6hbg1rdG1ijEZW kegn42m5RSi7I0sAg+JvF5RPLouLkbaka5RA4esN+ZRpGplSWhhTgtPUr920gmfQMu UjwvTgjgIJtjhGVQcxCZiMO1epdY/YZjQZB9Rat1968aaFQe4v1fbqwHGCKGaAj3/W 42lwBx+gTrzxa40ueM9HNdzMqslHd4doGjyAxF9dn5Ryx/QeMIOUJSBAZHTqJ3OUIm 5ZxzUvw6Au7pw== Date: Thu, 09 Sep 2021 07:49:19 +0000 From: Gregory Heytings To: Augusto Stoffel Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. In-Reply-To: <87czpijixk.fsf@gmail.com> Message-ID: References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> You shouldn't use (setq completion-styles '(flex)), you should use >> (add-to-list 'completion-styles 'flex). Otherwise the default >> completion styles are not used anymore. > > This doesn't change the issue described in the subject line. I would > still not see any flex completions if I did what you suggest. > Because the flex completion mechanism returns no completions, and the next completion mechanism is called. What kind of flex completions would you expect to see after x.t TAB in your example? > > Granted, completion wouldn't be totally broken. But I don't mind > letting the brokenness manifest itself. Therefore I use (setq > completion-styles '(orderless)). > It's not broken, it works as designed. Instead of asking each user of the completion mechanism to implement a specific function for substring / flex completion, these mechanisms tell them "please return all possible completions, I'll do the filtering job for you". From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 09 04:45:48 2021 Received: (at 50459) by debbugs.gnu.org; 9 Sep 2021 08:45:48 +0000 Received: from localhost ([127.0.0.1]:34111 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOFgp-0004Wl-Oi for submit@debbugs.gnu.org; Thu, 09 Sep 2021 04:45:47 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]:38434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOFgn-0004WX-DX for 50459@debbugs.gnu.org; Thu, 09 Sep 2021 04:45:46 -0400 Received: by mail-wr1-f41.google.com with SMTP id u16so1384349wrn.5 for <50459@debbugs.gnu.org>; Thu, 09 Sep 2021 01:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=7z7pFkSmubAG+BuI7wFLLQF0rHGlOD1OJ0NU8uV711g=; b=E4nq+wCv8j3UY5w2An2EL4eGdwxISbPFjfTKDXMavEdHuJtJs8wLMz6kOUnowam4W1 BELAHwju+PfCG2ekynLppuaEveLk2qVMQm8vlJHNBHx41znPzFc0RGG+f157IsGTuqoJ iExrYbsLk7RtTb7JSNOAEMTyWQR+63PdQjV4ljD0nze9UetcXOcJ+rE4xar6qp+CWzvG UhPgP6oZa8E+LwQ9j1Rgp8pXXboVVJr2IcKstspFXwRWoBWasyW2d67E2TUfRcjWhINr QfxyqUg7Uk35FyG3dMuUKqWCubQ0lOY18FsqZS+6olS9orvOvCooYIqfUUiy/M5ZG6WH rUGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=7z7pFkSmubAG+BuI7wFLLQF0rHGlOD1OJ0NU8uV711g=; b=7AFk50SU75IQ/qdkH3B1fA+dGnVuH7l3OxKjii6W937xyjfXyt5pFHQ2TujH7Ev9Rn og3RVAsr1l/2AO68NGew2NqPxu+x6pV3F2jNtqSS9hRuW6Bav7d0zHQBibNVCB9fZIG1 kb9inZ9M0DoyUjyOnPFyHD8j+gcDqi/9hZsrmM5i4yYi/YiSsZ2amvCLkwjylSq9QHTm HXXkQT3Hk0Kz7inlzduYZeI/Pb/1ruVgjN8GMGWpXSUQYfCl/fkD7E/K/pn+qaoOxowo A7tLclE65WIQQQ/Shx3AE3T0S3AYOYdriK81pApiCYRGFUWFgBdTvKsKxTpSDu91QVn+ /BmQ== X-Gm-Message-State: AOAM5336kQlo6q3OxX37hqZOJmI5zl7UJzN00vfR66Vaot/JyM9Uzulf iDDk+vTx1cuB3vocDlVRg/Ddf3WU5WolRQ== X-Google-Smtp-Source: ABdhPJxnnbUVkx71LAfN5LteBYkojKXbaycdCyI8lBLjMvzG0uUNS5IPi7qu8vibl7Q+pN2Iqci5bg== X-Received: by 2002:adf:d1ab:: with SMTP id w11mr2097682wrc.372.1631177139047; Thu, 09 Sep 2021 01:45:39 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id t14sm1079914wrw.59.2021.09.09.01.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 01:45:38 -0700 (PDT) From: Augusto Stoffel To: Gregory Heytings Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> Date: Thu, 09 Sep 2021 10:45:37 +0200 In-Reply-To: (Gregory Heytings's message of "Thu, 09 Sep 2021 07:49:19 +0000") Message-ID: <877dfqjfwu.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Thu, 9 Sep 2021 at 07:49, Gregory Heytings wrote: >>> You shouldn't use (setq completion-styles '(flex)), you should use >>> (add-to-list 'completion-styles 'flex). Otherwise the default >>> completion styles are not used anymore. >> >> This doesn't change the issue described in the subject line. I >> would still not see any flex completions if I did what you suggest. >> > > Because the flex completion mechanism returns no completions, and the > next completion mechanism is called. What kind of flex completions > would you expect to see after x.t TAB in your example? For sure 'x.count' should be a candidate, just like in Elisp 'set' shows up as a possible completion after typing '(t TAB'. Whether or not your example should allow 'fix.it' as a completion is up to debate. > >> >> Granted, completion wouldn't be totally broken. But I don't mind >> letting the brokenness manifest itself. Therefore I use (setq >> completion-styles '(orderless)). >> > > It's not broken, it works as designed. Instead of asking each user of > the completion mechanism to implement a specific function for > substring / flex completion, these mechanisms tell them "please return > all possible completions, I'll do the filtering job for you". Right, this is not a problem with the flex style, it's a problem with the Python completion table. More specifically, with its notion of "all completions". From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 09 04:51:03 2021 Received: (at 50459) by debbugs.gnu.org; 9 Sep 2021 08:51:03 +0000 Received: from localhost ([127.0.0.1]:34115 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOFlv-0004ea-Dq for submit@debbugs.gnu.org; Thu, 09 Sep 2021 04:51:03 -0400 Received: from heytings.org ([95.142.160.155]:53362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOFlt-0004eA-2G for 50459@debbugs.gnu.org; Thu, 09 Sep 2021 04:51:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1631177460; bh=4GrbAxOWBee/2ciPyQMEG46MtEmL67lta+Nnv1aXxmY=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=bcz/hb96GL73U6TXFOAJKziX5IzbOFPW8xT6m+5FQ3tDPS1J8cpgOCJuTZokP2jPT n723HCxt3bDCfF8vKd5XPWI6Ym1B7DvdILiM92Rom8yDNI1WkNix109UF81eOavuE1 ZQaLwh7qlb7hITn26WfrBfiwR1OEC/5JpJs+K/cWxyvgXa0DAHVfJc/eZ4BKZkDkcu tSG9vR79BerwhZt8C1S0KSp2dcmWKMYIDz22bmKAfaydcTMRcBNj/Iv6cgudAXpcVR Tfw/Xu8xA9nWZuImh+Mk/GbTjnTIIzuhe2gdM+8/oLLpQRW9ME0GCxZMwy1Do41rX5 T4VjLZrGVoDvw== Date: Thu, 09 Sep 2021 08:50:59 +0000 From: Gregory Heytings To: Augusto Stoffel Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. In-Reply-To: <877dfqjfwu.fsf@gmail.com> Message-ID: References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> It's not broken, it works as designed. Instead of asking each user of >> the completion mechanism to implement a specific function for substring >> / flex completion, these mechanisms tell them "please return all >> possible completions, I'll do the filtering job for you". > > Right, this is not a problem with the flex style, it's a problem with > the Python completion table. More specifically, with its notion of "all > completions". > Exactly. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 09 12:47:11 2021 Received: (at 50459) by debbugs.gnu.org; 9 Sep 2021 16:47:12 +0000 Received: from localhost ([127.0.0.1]:36102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mONCh-0005j4-Kk for submit@debbugs.gnu.org; Thu, 09 Sep 2021 12:47:11 -0400 Received: from mail-wm1-f49.google.com ([209.85.128.49]:34307) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mONCf-0005ir-OA for 50459@debbugs.gnu.org; Thu, 09 Sep 2021 12:47:10 -0400 Received: by mail-wm1-f49.google.com with SMTP id v20-20020a1cf714000000b002e71f4d2026so1486457wmh.1 for <50459@debbugs.gnu.org>; Thu, 09 Sep 2021 09:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=fuUNL1sKHeWShB55rBBO0cs7/sPgKMk5+Rh9dwuYriQ=; b=gyIbVyU+/3PoJYJ+JgATCMf2VPj7z+c+/Rmwv1nMGNarCqS1s7mws64sSj1Ldf2j+s TzYWTZOqNsOAIm1f3dPMMaNJyr4XDibCDjxQ+y8El9CU3KaBHywwQ8Vsg0BcvLL+txb2 dsDgtKo9lrIJrQVGqgH/dUfUc8itPr6xEPyCAGAsNfJaLG+5krz53/a45TQLKU1YkPXH Q3B3vlXLsADUrENQasH5B0s3L0sN2oK/opZCSuWPYRNNE4s91LY1C9SS6EGZvi08Yihg P+ZEJEFnmMp2JLgGS/p0SEb+hAQOSyyBxvFxout2c10/DEsjl9ukva4oVaO+VppPcV60 bZjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=fuUNL1sKHeWShB55rBBO0cs7/sPgKMk5+Rh9dwuYriQ=; b=oKwRWGs7Bhu1Kjuti+An2OVEk2nGTXBHF31WMU7PNOx7V4uxlhE8/QviiGJ2TQj4Mw 1y1YTJ75Rgzl9VYIbtVH2pT9G30GJGcIu7IrIMfDBrZTjbe+C6iy2dQ8Y6HsjfW3R5Is kjJkZ8HLL7DYqjiPmvAilOercYoB9aoPzC9EfsIOs+oR133f416bwqjiKN6QqfMljkw+ J3RX8zheOCc3UFBvvsWG7kCzdef9N0C2lURxbbpNRJ1jxch5Z4oQDLKcDKau1iAn6ljZ 8Tr2UaBx0gwWpS8WVVktrX2K8D/8I1yt7P3uyFKfZ8iXBqSWaubNNdnk6YRVI6N5/9am mMFA== X-Gm-Message-State: AOAM531lOHM+Xp3waNL2EReZBzNT27wpUbxoHAmpMjA700bXS/DXHWG/ sM10xlyvhjs1nEn4Xxdvksw= X-Google-Smtp-Source: ABdhPJxz4BoEzXAikTA9mIx9OJxwJ8LnVZL/Fzu/E25DTLIPoJXc+z5w5dxcCz60+Src05fqeDyj6g== X-Received: by 2002:a7b:c4d2:: with SMTP id g18mr4079804wmk.135.1631206023698; Thu, 09 Sep 2021 09:47:03 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id m3sm2856791wrg.45.2021.09.09.09.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 09:47:02 -0700 (PDT) From: Augusto Stoffel To: 50459@debbugs.gnu.org Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> Date: Thu, 09 Sep 2021 18:46:57 +0200 In-Reply-To: (Gregory Heytings's message of "Thu, 09 Sep 2021 08:50:59 +0000") Message-ID: <87mtolr91a.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: Gregory Heytings , Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain After more discussions elsewhere [1], I noticed another problem with the dynamic completion table from python.el. Each call to the completion table requires communication with the inferior process. If called frequently enough, the comint input filters can get confused, and some garbage gets printed to the shell. If the inferior is running over Tramp, the problem gets amplified. Now, this is not likely to cause much trouble when calling `completion-at-point' manually, but it is a problem with any of continuously-updating completion UIs like Company or Corfu. To alleviate this, the completion-at-point function could implement some sort of caching. The difficult question is when to invalidate the cache. I've attached one possiblility as a draft patch. If the approach seems reasonable, then I'll format it properly. As a side effect, the patch also solves the original issue described in this ticket. Please let me know what you think. [1] https://github.com/oantolin/orderless/issues/79 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=python-capf.diff diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4f222b4cf5..3239722981 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3841,6 +3841,8 @@ python-shell-completion-get-completions (split-string completions "^'\\|^\"\\|;\\|'$\\|\"$" t))))) +(defvar-local python-shell--capf-cache nil) + (defun python-shell-completion-at-point (&optional process) "Function for `completion-at-point-functions' in `inferior-python-mode'. Optional argument PROCESS forces completions to be retrieved @@ -3895,11 +3897,13 @@ python-shell-completion-at-point #'ignore #'python-shell-completion-get-completions)) (t #'python-shell-completion-native-get-completions))))) - (list start end - (completion-table-dynamic - (apply-partially - completion-fn - process import-statement))))) + (let ((re (or (car python-shell--capf-cache) regexp-unmatchable)) + (prefix (buffer-substring-no-properties start end))) + (unless (string-match re prefix) + (setq python-shell--capf-cache + (cons (concat "\\`" (regexp-quote prefix) "\\(?:\\sw\\|\\s_\\)*\\'") + (funcall completion-fn process import-statement prefix))))) + (list start end (cdr python-shell--capf-cache)))) (define-obsolete-function-alias 'python-shell-completion-complete-at-point --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 07:38:11 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 11:38:11 +0000 Received: from localhost ([127.0.0.1]:37111 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOerD-00021n-67 for submit@debbugs.gnu.org; Fri, 10 Sep 2021 07:38:11 -0400 Received: from quimby.gnus.org ([95.216.78.240]:54026) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOerA-00021V-Iv for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 07:38:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hJsE41yYNBSXMuVp9xfw34boNSOoZJRBC9DJO1LbuwM=; b=qAS0BGJPe5HQ96JoCVmjipUKGR 74U/TkoWwpA1nrVkWtxEfgCLqLx1icVXfPmzR4gXJZjFZGiwFklR3+4jAn1HNZEdVfwWDw2RIPOfG hXMAFIduGOVfMGiS1YDGzQ0JmRtlx6ieepJRNoK1RpZ7hd3zUc6Lh+M/fSvS8Cm8BV6g=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mOer0-0003IE-C1; Fri, 10 Sep 2021 13:38:00 +0200 From: Lars Ingebrigtsen To: Augusto Stoffel Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> Date: Fri, 10 Sep 2021 13:37:57 +0200 In-Reply-To: <87mtolr91a.fsf@gmail.com> (Augusto Stoffel's message of "Thu, 09 Sep 2021 18:46:57 +0200") Message-ID: <877dfopsoa.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Augusto Stoffel writes: > To alleviate this, the completion-at-point function could implement some > sort of caching. The difficult question is when to invalidate the > cache. I've attached one possiblility as a draft patch. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50459 Cc: Michael Albinus , Gregory Heytings , 50459@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Augusto Stoffel writes: > To alleviate this, the completion-at-point function could implement some > sort of caching. The difficult question is when to invalidate the > cache. I've attached one possiblility as a draft patch. If the > approach seems reasonable, then I'll format it properly. Would it be possible to do caching at a lower level instead of in python-mode? > As a side effect, the patch also solves the original issue described in > this ticket. [...] > - (list start end > - (completion-table-dynamic > - (apply-partially > - completion-fn > - process import-statement))))) > + (let ((re (or (car python-shell--capf-cache) regexp-unmatchable)) > + (prefix (buffer-substring-no-properties start end))) > + (unless (string-match re prefix) > + (setq python-shell--capf-cache > + (cons (concat "\\`" (regexp-quote prefix) "\\(?:\\sw\\|\\s_\\)*\\'") > + (funcall completion-fn process import-statement prefix))))) > + (list start end (cdr python-shell--capf-cache)))) I'm not sure I understand this patch -- it's not using `completion-table-dynamic' at all now? (But my understanding of the completion functions in Emacs is pretty lacking.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 07:50:42 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 11:50:42 +0000 Received: from localhost ([127.0.0.1]:37120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOf3K-0004T8-GA for submit@debbugs.gnu.org; Fri, 10 Sep 2021 07:50:42 -0400 Received: from mail-wm1-f42.google.com ([209.85.128.42]:53823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOf3J-0004Sv-6Y for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 07:50:41 -0400 Received: by mail-wm1-f42.google.com with SMTP id i3so1011319wmq.3 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 04:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=hG6PROL6ZaFVoQ9FSuDWLR0BZkf40qaZAK4UgLUJiE4=; b=Zrj3Ty5OS7CewZr9e8XtOz3h3G4lEDW5vC138bbEjo5YvKmxBZvSHlqx/273hvOgZo O+7OL2UWH5rNS8nEpKwx1rYu3DggEsFjh4EPAn4fj9P6MNlSyfTfIL+Dd2yHl8janHjq dKXUB5St57beXdvP6fI4Pe+HgvNEb5G/Fzm+Q2JZH/8SNI1NiXLUFcA89J83LZvX0KZK oGZO5uK876VQJC3CnOf+3r86F3DAN8C1A21js6Gepw8m7ASAbCDT4sjSv/vEKLMaSpuN rhl2TrZuoTxYJBtNa9U/XH+hedsQefDH72a4O4uqxi+EQjMkv6xxrh1NaBRy5iZiO9/S YRuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=hG6PROL6ZaFVoQ9FSuDWLR0BZkf40qaZAK4UgLUJiE4=; b=vYOYPtk5+DveVrk8aFGh/JxHH9Wxpcu+VUlIXPzb459zsRmwfrRUORHlmC1jU14/Rt lskjcimgYzChUz+bEQGGhFV0jEu04UvQCiqcc8i8VpQtoFTBq0o3DAeOTLb7FpvQ9rXA OS6IKzshQak2Tcb0iBvPL4nboIJeq8g9K3K7O//Sq/Tlnr9iegzxoUpFAD893BLN3qux U+g340LL7jeyF+lP4Cjg1XDfOmQzypxOkCyYiKUscSIjAEwqtEwjJsUKIwADbQw0En8F 7x87wVoaNNa0/mmdcQOXsti2GK1GUTrBj01vb4xwsvc1baHQ6QkpbKtzJc1KrdKHwoyJ lamA== X-Gm-Message-State: AOAM532sP4YJlf6ON/kwfvwUnbzwGJYCQYDlZUdzysGO/kUHmctsHYgg AMneZ9sIDK0n+RqJVuKQKgc= X-Google-Smtp-Source: ABdhPJzr7AWCMKVY6vlFQ6upXRvUgWbTZTcSI37bzUNngoghM/ZPfSAufsa+nx0h8mv48jpCp0rQtQ== X-Received: by 2002:a05:600c:4ba2:: with SMTP id e34mr2387347wmp.50.1631274635240; Fri, 10 Sep 2021 04:50:35 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id t18sm4284829wrp.97.2021.09.10.04.50.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 04:50:34 -0700 (PDT) From: Augusto Stoffel To: Lars Ingebrigtsen Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> Date: Fri, 10 Sep 2021 13:50:33 +0200 In-Reply-To: <877dfopsoa.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 10 Sep 2021 13:37:57 +0200") Message-ID: <87zgskejjq.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: Michael Albinus , Gregory Heytings , 50459@debbugs.gnu.org, joaotavora@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, 10 Sep 2021 at 13:37, Lars Ingebrigtsen wrote: > Augusto Stoffel writes: > >> To alleviate this, the completion-at-point function could implement some >> sort of caching. The difficult question is when to invalidate the >> cache. I've attached one possiblility as a draft patch. If the >> approach seems reasonable, then I'll format it properly. > > Would it be possible to do caching at a lower level instead of in > python-mode? I'm not an expert in this either, but I think the caching mechanism would be pretty particular to the circumstances of each completion table, so it indeed belongs here. Maybe Jo=C3=A3o can say more? Since this comint-based completion is not super smart (it's not context-dependent at all), the rather naive caching invalidation used here seems sufficient to me. > >> As a side effect, the patch also solves the original issue described in >> this ticket. > > [...] > >> - (list start end >> - (completion-table-dynamic >> - (apply-partially >> - completion-fn >> - process import-statement))))) >> + (let ((re (or (car python-shell--capf-cache) regexp-unmatchable)) >> + (prefix (buffer-substring-no-properties start end))) >> + (unless (string-match re prefix) >> + (setq python-shell--capf-cache >> + (cons (concat "\\`" (regexp-quote prefix) >> "\\(?:\\sw\\|\\s_\\)*\\'") >> + (funcall completion-fn process import-statement prefix))))) >> + (list start end (cdr python-shell--capf-cache)))) > > I'm not sure I understand this patch -- it's not using > `completion-table-dynamic' at all now? (But my understanding of the > completion functions in Emacs is pretty lacking.) That's true: the logic here is that the completions are computed eagerly, and then cached until still valid. So if you type foo.bar.baz the inferior process is contacted 3 times: after the , and after each dot. Before, a lazy table was returned, but the inferior would be contacted after each character anyway (if using Company or similar). From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 09:14:37 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 13:14:37 +0000 Received: from localhost ([127.0.0.1]:37246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOgMW-0006ZD-Vk for submit@debbugs.gnu.org; Fri, 10 Sep 2021 09:14:37 -0400 Received: from mail-wm1-f48.google.com ([209.85.128.48]:43549) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOgMS-0006Yw-Fx for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 09:14:35 -0400 Received: by mail-wm1-f48.google.com with SMTP id n7-20020a05600c3b8700b002f8ca941d89so1367347wms.2 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 06:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=1qGfUO8INha7qUjNEKrk7//XVXUy7RK3ku4+lStyv+M=; b=cUQE8Nx4DYwAi2ZNwUjWau/gQTEdOxDo8ws8tFABgdaAywhtuXhZwRaFHb6lc9ueQw 99zcJzr+VfhUFbqEHJ+7cpRfgb7XzHjV08V0C+NE0lmYd9skjUjqnEsY/ainyyb12cEn r9CIcZQhFoMm3bgtHUwnsvft4Rpi9bJvG3DNfJfiECPugsS7gIUHLWZdFIci6ABI1YBX WVz93xnXVw97YYyHaxJAF0DheUgUd6FB7DOM/lW67IiMMzRnixLrMXf+Zh3LmrpbvwqO p0i5D/HXeeg3whRW80LLoRwutnWb5VnEra6NPq0PrNe+UqD5GEH1R+FqywT/8Zr+F80R 0lIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=1qGfUO8INha7qUjNEKrk7//XVXUy7RK3ku4+lStyv+M=; b=S1eFyquTClVbrV+uEpKGbo7Nn1wt8j8fboEebema6/+fkZ0slh6fM3bWVRoqZetcVD fLG3yBfU9DCDYkonOJ5CDWRJHL9GwNG1xIAIJE7Ut2r19l58KWnwOmbrvGbioYILwjCl frjAXZLBHbEleJHZ8kD9WeWO/ZKV0J6a10NqrkV2MfxqQro4sIhDCAPTblBGSeRjBU77 svG0nqfzpPMdqYRFwBdczs+QEqhBYJELJQS6C9WvlmzhWBtXQWdMTWu1NUj1DM0NiqYL tp2Dxgdlvc3Zhiz43qBXdc7lLuD77QtTBpXgVG+ckkOlqqOy5Z5L0aOaCxJ44Zc/2Dm7 f/ZQ== X-Gm-Message-State: AOAM531pbnsj1fQvHBvxVcyV1KZ3Lx4whMwr8F4jz6JlbiUD1u0mT6TX H8F8CYtjX183X81op/SBWR0= X-Google-Smtp-Source: ABdhPJxN7q/HFK6a3qOxSwzKV2enBziMjR4a17fUBuzNE/vhGNRxQuvE0Nsot1gzxRmy8sW5wGu1+Q== X-Received: by 2002:a7b:c4d2:: with SMTP id g18mr8439054wmk.135.1631279666433; Fri, 10 Sep 2021 06:14:26 -0700 (PDT) Received: from krug ([62.48.174.238]) by smtp.gmail.com with ESMTPSA id c14sm4353590wme.6.2021.09.10.06.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 06:14:25 -0700 (PDT) From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= To: Augusto Stoffel Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> Date: Fri, 10 Sep 2021 14:14:23 +0100 In-Reply-To: <87zgskejjq.fsf@gmail.com> (Augusto Stoffel's message of "Fri, 10 Sep 2021 13:50:33 +0200") Message-ID: <87ee9wa7yo.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: Michael Albinus , Lars Ingebrigtsen , 50459@debbugs.gnu.org, Gregory Heytings X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Augusto Stoffel writes: > On Fri, 10 Sep 2021 at 13:37, Lars Ingebrigtsen wrote: > >> Augusto Stoffel writes: >> >>> To alleviate this, the completion-at-point function could implement some >>> sort of caching. The difficult question is when to invalidate the >>> cache. I've attached one possiblility as a draft patch. If the >>> approach seems reasonable, then I'll format it properly. >> >> Would it be possible to do caching at a lower level instead of in >> python-mode? > > I'm not an expert in this either, but I think the caching mechanism > would be pretty particular to the circumstances of each completion > table, so it indeed belongs here. Maybe Jo=C3=A3o can say more? I'm sorry, I'm quite overloaded lately and can't read this long thread. I've been participating in a few discussions about this and all I can add here are generic comments, like the intepretation that I make from the docstring of completion-at-point-functions Special hook to find the completion table for the entity at point. Each function on this hook is called in turn without any argument and should return either nil, meaning it is not applicable at point, or a function of no arguments to perform completion (discouraged), or a list of the form (START END COLLECTION . PROPS), where: START and END delimit the entity to complete and should include point, ^^^^^^^^^^^^^^^^^^^^^^=20=20=20=20=20 COLLECTION is the completion table to use to complete the entity, and ^^^^^^^^^^^^^^^^^^^ PROPS is a property list for additional information. As I've underlined, it's _that_ entity, not some other entity that the "backend" aka "capf" should complete. So: a) while the entity is "the same" (START and END are the same and POINT is somewhere in between) then the backend can do caching inside COLLECTION (Eglot does caching between calls to try-completion, all-completions, and others, for example). b) if the entity changes because the buffer has been changed, by any means -- including the means of an completion UI -- then the completion UI should re-invoke the capf to get a the new entity to complete and the new COLLECTION to complete it. Emacs's default completion UIs do this, and so does Company, if I'm not mistaken. If the backend is super smart and can be faster about responding to this new capf invocation validly given the previous respose that's fine. But my point is this other caching is much more difficult to do accurately because of buffer changes and assumptions about the filtering strategy. For example, a cache that assumes that adding a character to the end of entity will always produce a subset of previously obtained completions will fail if the completion style is some kind of "regexp-based" thing, or if that character is '.', for example But it might work decently in some situations. Anyway, another generic point that I've been trying to make is that filtering/completion-styling should be done as close to the source of completions as possible. In Elisp this is easy to do (completions are basically lists of strings or the big cheap-to-access obarray). If the source of the completions is removed from Emacs by some latency, the experience is never going to be as good as Elisp. - If you want to fully honour `completion-styles` which is an Elisp facility, you need to know most complete set of completions possible at all necessary times. That's going to be slow (but read my final paragraph). - If you're OK with letting the server do the filtering and the highlighting, you can make a "backend" style like I did for SLY, for example. It's going to be faster, but `completion-styles` won't be honoured. That's doesn't mean you give up 100% on "flex". In SLY, there is flex implemented on the Common Lisp side, and for Eglot, many LSP server do their own flex matching. In any case, it is generally possible to design responsive backends systems that let the user interact with Emacs while the "slow requests" are ongoing, by having these backends cancel themselves when input is available. This uses while-no-input and sit-for. See jsonrpc.el's jsonrpc-request for an example. I've been using these kinds of systems very successfully over the past 4-5 years with SLY, Eglot as backends and Company UI as a frontend. Hope this helped, Jo=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 09:29:07 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 13:29:07 +0000 Received: from localhost ([127.0.0.1]:37265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOgaZ-0006ux-5p for submit@debbugs.gnu.org; Fri, 10 Sep 2021 09:29:07 -0400 Received: from mail-wm1-f54.google.com ([209.85.128.54]:46024) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOgaT-0006uV-JR for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 09:29:05 -0400 Received: by mail-wm1-f54.google.com with SMTP id j17-20020a05600c1c1100b002e754875260so1392879wms.4 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 06:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=BK5mTMNA00U26UwFBN3on27YYbCYb2J2mtINoiyDAOk=; b=FbHLl6trdPmXH9CkOJEytU4ddw24Gfru/qDR3HF77/rZeTcGQSAYcGly7986qxTJ/E SP5Iog9IpqJbrqaE5E/SmYgzbNSPZUNSJ0CiwNjGQxS3vvz55r8hhcMiDkGAQPPkt17w dEnSQtUEe5ZGVHY8/uPjA+fjokjRDibYPKEMAEPzU6AtxFbTZz5wjEJg3cquLKIxgkKo bvbqjUvTt/Kp00ef3xvpxFrDfqNHeTTdJiXJClAx5NcPQnJzAgeIF+Cwej4X6PSJ6yUP jSoGIpTqhCAD7rPGUrvh2+C1x94g2e5oM2JufftoSzSOzcI6WD0zpO+mZVq5ZurJwPIM +lbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BK5mTMNA00U26UwFBN3on27YYbCYb2J2mtINoiyDAOk=; b=BGng6GJ4Ab2aQaxTyxbo6TZBcvjU2iEUVIy0EO/+Dhd6sG/4x2Uob5nSCoNwHe8GTd /EUAUbsi8Ck6fyH6+KoctKFTHhzLzkUOq385kCc3/HEaOFZaE3XIA5To7EJ1485mpVAH ZLP1GHcbqYD+hU0wNfV6syPWRe1nOvU+g0F6TdX/cAjJNLrNxddUFv3CVoQlK/Ft0J/L hdpd9dALTZjjkWlpcsKDP8O6T5k4SWY388X+FBKpobX8uRTqXN3kohJhvC1WFq+sUmDi OvDwS82IIpq0Y5Y02teNapVIDzjh5iA6z3948QRyzlla6kz4Vyq0Mi7ssSGM51911B5b gjjQ== X-Gm-Message-State: AOAM531a03WZWDTnlT/iTmuck7wkTXEzUOaj4tTQd7n5PXVDjAzrEKnd Rg7NhsnLr07fiepbccXsCZY= X-Google-Smtp-Source: ABdhPJyxPaNbAJQIZtrvClAM5+47VVb52b45Ou7RGBCm30zlZbJxdncLHIdSXrre7aJewcd08GORBA== X-Received: by 2002:a05:600c:3b13:: with SMTP id m19mr1707244wms.135.1631280535650; Fri, 10 Sep 2021 06:28:55 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id b24sm4145283wmj.43.2021.09.10.06.28.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Sep 2021 06:28:54 -0700 (PDT) Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , Augusto Stoffel References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> <87ee9wa7yo.fsf@gmail.com> From: Dmitry Gutov Message-ID: <8ee6271b-142e-7cc1-3d24-7e5c342ef86b@yandex.ru> Date: Fri, 10 Sep 2021 16:28:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <87ee9wa7yo.fsf@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50459 Cc: Michael Albinus , Lars Ingebrigtsen , 50459@debbugs.gnu.org, Gregory Heytings X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 10.09.2021 16:14, João Távora wrote: > - If you're OK with letting the server do the filtering and the > highlighting, you can make a "backend" style like I did for SLY, for > example. It's going to be faster, but `completion-styles` won't be > honoured. That's doesn't mean you give up 100% on "flex". In SLY, > there is flex implemented on the Common Lisp side, and for Eglot, many > LSP server do their own flex matching. You can't really do that with python-shell completion. Nor do you need do: the basic pcmpl mechanism should work just fine with it, and for performance the completion table just needs some smarter caching. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 09:33:02 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 13:33:02 +0000 Received: from localhost ([127.0.0.1]:37274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOgeM-000729-1r for submit@debbugs.gnu.org; Fri, 10 Sep 2021 09:33:02 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]:37471) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOgeK-00071l-CY for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 09:33:01 -0400 Received: by mail-wr1-f45.google.com with SMTP id v10so2664639wrd.4 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 06:33:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7CM4vOAHMTDfL9G6mb+JTl5arQU27uY+aNNQRkALCPw=; b=LzIhNHE69RXbkhTlFIXXkHsrzFVN1D3NVIowAPRRQ2wNiyqyViVen0PBIfxJzv2Fqc d84l1k6cwGcejJPDMGPeeYo3FNRiB2tdsQif0041FyF4bUTmuUJuz6rcxGmTdAHyxX53 mHzOfIgRRi+aeBm4LBi7Ra8rxRBH+bNmPwsHSoDir9SAziFj65dZoQZwPFmeuGAOIZjc PImCOAWSckYj1T/SsevtlBP8+Wx6u7XxYj8xLln6nxHPO7TXD8kCRtVuPszVXZAxR+gW CT40xHrmJ4/FzV7RTzZf5YsCbpAhAmiccbryWHI789UqB65NsJLlzXlmtsJq5ZjBNUfX 4i/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7CM4vOAHMTDfL9G6mb+JTl5arQU27uY+aNNQRkALCPw=; b=IJFWoQH6BNJf18D5HG2wrsFQqWWjMra7JlG2QFbztPH90M10X1J+0T46OAalrf/0jp +lcBf/LO7rhsp6gKRNvK8pVKDRkKnODAloRB/mZvR9UFd6Jim0NvBmlXEl7Aq9ANMRcy JXQT76xshd20ESZLBGsIv2EWCKn+4inVz385ktPEN9HKV3hyGoApU5thCDd7H3/jXN0E OiQQ+cW7p8atLzArUTYkyEHCmBnvyP9lpSNMvvxeWM/LdFUvd3WtjiqRaNmpg8fGcAPd bfkYmeCr7H7VShMNQVelT0KzbHgXdU3TEECBEJg+jZKUr18VzZ6QvRgRiFEyhZ5Q56ac KLMQ== X-Gm-Message-State: AOAM533hYYLkozH1lvOfUfVEYZ60f3dAKzkEiMmMgblS0Cv4wIvwHPEb MibBKy7/U+j5bt/9QCWgU/Y= X-Google-Smtp-Source: ABdhPJzoWZ1ZcO+678Dy7ubk+NT2gMbf86Fp8ifc3aja9rPXT+13bOZSRlapkJZjwU3kDI4JHvaJxA== X-Received: by 2002:adf:c7d1:: with SMTP id y17mr9717163wrg.214.1631280774747; Fri, 10 Sep 2021 06:32:54 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id a10sm4813863wrd.51.2021.09.10.06.32.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Sep 2021 06:32:54 -0700 (PDT) Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. To: Augusto Stoffel , 50459@debbugs.gnu.org References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> From: Dmitry Gutov Message-ID: <86069c89-f058-a1d3-5600-dd1453551c39@yandex.ru> Date: Fri, 10 Sep 2021 16:32:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <87mtolr91a.fsf@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50459 Cc: Gregory Heytings , Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 09.09.2021 19:46, Augusto Stoffel wrote: > To alleviate this, the completion-at-point function could implement some > sort of caching. The difficult question is when to invalidate the > cache. I've attached one possiblility as a draft patch. If the > approach seems reasonable, then I'll format it properly. It's much simpler than what we talked about, but given that python-shell-completion-at-point doesn't really look past the current line, your approach should work fine. I'm not very familiar with the code, so I cannot approve the exact patch, though, sorry. As a bonus, though, maybe add the position of prompt on the shell-buffer to the invalidation key? Like, if a user imports some new lib in there, that can bring in new completions. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 10:07:05 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 14:07:05 +0000 Received: from localhost ([127.0.0.1]:38910 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOhBJ-0008Nh-2N for submit@debbugs.gnu.org; Fri, 10 Sep 2021 10:07:05 -0400 Received: from mail-pg1-f180.google.com ([209.85.215.180]:40810) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOhBH-0008NE-CK for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 10:07:03 -0400 Received: by mail-pg1-f180.google.com with SMTP id h3so1912824pgb.7 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 07:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=NhYWKqZbTqyPX4/gJvmGGrLj84p9Da81iPwVv53D2+U=; b=b0rGFp6bRtPscsoFuhxErSydgbmyG1PH3/xeCeR2WP6TmVZr+lpazfG8gHQlnbfDcf ghM3J8iMThC3CvhB5xNguYmTmtexR+A8n22BgqWHKLslN47oNtDXhw3OUP1XKrQWe2EL S+CZWd+KW2AAczzn2/mtUQdZZXXLQnV4ouY4EVginRzhVBd/b8KxNvbYrGTSmeZE6JyH z46kINDt4MMRB2dx65AC4YiOIi3Dq9Xwxz8onbwSLPj0lT8ZQqpkwLL0bR8bWrfQrTc/ cGe2aXH8EDnt2HmTtitkb1cMkhFEDDb+QhzeRP6Va3+/4kxVDSa18JBJA3BKeUrycnhf JFFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=NhYWKqZbTqyPX4/gJvmGGrLj84p9Da81iPwVv53D2+U=; b=rSFQICsWMOUGpJNjHDOHjI8YCFSHx8HF51NAuLmcHQPfqNn3NmBWXJeJhMjnAvxcb+ AMYoLXuWSD8023hgJgN9i5LAEF9icQQtYOHh7IBsCdq6UTsWbaLuZbgeJJEteFz7hACA eAuVqJia5uFM9cbfT4ie4MQF41Nx2HbbHUGMp+10Kvz2Y+F+rV0yx9EnIymU/Vzbqa9p lLQnaLp9yJ87qY6N1oZauYNAKJOdd9UY81gOO3WAX5UreCiBPsZpMW2CEXb3d9Iu5h/l Ae6OMlbawTMDM2o8Bo97YBYe2xXPk2ui437tzBgGEpbSfmjfa/lzh1/ovz97Dbpcwhzb /dvA== X-Gm-Message-State: AOAM530/NWjJuPqueca5TOXJhKg4ucPpC8u71ChRX7j9PDFKN55steCa EY1diQ29KtMwqZdLpffzix8Jnelq2SpoYfG0vN4= X-Google-Smtp-Source: ABdhPJxKKuf5johMBulDSJBZuIoEJBcoScJNEMdvT1GPOEx4p3b2bEBJD1zwYZclzZiXRfi7dY/vIALBQCScueng+h8= X-Received: by 2002:a62:77d6:0:b0:414:aa59:439 with SMTP id s205-20020a6277d6000000b00414aa590439mr8560172pfc.50.1631282817294; Fri, 10 Sep 2021 07:06:57 -0700 (PDT) MIME-Version: 1.0 References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> <87ee9wa7yo.fsf@gmail.com> <8ee6271b-142e-7cc1-3d24-7e5c342ef86b@yandex.ru> In-Reply-To: <8ee6271b-142e-7cc1-3d24-7e5c342ef86b@yandex.ru> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Fri, 10 Sep 2021 15:06:45 +0100 Message-ID: Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. To: Dmitry Gutov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org, Lars Ingebrigtsen , Gregory Heytings , Augusto Stoffel , Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, Sep 10, 2021 at 2:28 PM Dmitry Gutov wrote: > > On 10.09.2021 16:14, Jo=C3=A3o T=C3=A1vora wrote: > > - If you're OK with letting the server do the filtering and the > > highlighting, you can make a "backend" style like I did for SLY, for > > example. It's going to be faster, but `completion-styles` won't be > > honoured. That's doesn't mean you give up 100% on "flex". In SLY, > > there is flex implemented on the Common Lisp side, and for Eglot, ma= ny > > LSP server do their own flex matching. > > You can't really do that with python-shell completion. Probably not unless you write some python, no. I don't see that as being that dirty. > Nor do you need > do: the basic pcmpl mechanism should work just fine with it, and for > performance the completion table just needs some smarter caching. Yes, as I said in b), with "sufficiently smart caching" (and infinite memory space) you can do everything, indeed. It's one of the famous "two hard problems" though, so good luck. Jo=C3=A3o T=C3=A1vora From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 10:22:51 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 14:22:51 +0000 Received: from localhost ([127.0.0.1]:38915 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOhQZ-0000JG-Fn for submit@debbugs.gnu.org; Fri, 10 Sep 2021 10:22:51 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:36467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOhQX-0000J0-J4 for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 10:22:50 -0400 Received: by mail-wm1-f47.google.com with SMTP id l18-20020a05600c4f1200b002f8cf606262so1604288wmq.1 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 07:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=lP8+T//0sjKi7TplPNKlZbYTwgCJ+VF9OPivj6JsWBg=; b=VHebrV75bTlr5bWU5sgliYPXsXWMymuL+kdle1F+bvBC7e/ulkh3eImbWvq0NZQk4Y XOngwD6sNfTWtgC35X/u017wbFVYAWPgRsEFF6k0KqGyz+SMRHjV/rivZufSQI2gT5f1 9xSWWMav+BjgV6yfCwtoJgmBjVMm8pGHhXfcWuPR3lF/7M1tMZ9la3t/3uIk40FS2Gup rZqNPjos8PP4FncmiVd1wpFr4Wqr6Yq+a5+OAPxplQybZbp3wAs5+JPQ5H1CoqTIDAb5 1OpAWLz4LYj29WDDpklKkIZKLt2oREuXxBk0k91vLUlyzZOBqoOxI9yQKq4oQEtvBVox TPhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lP8+T//0sjKi7TplPNKlZbYTwgCJ+VF9OPivj6JsWBg=; b=CQKd6JJ2a0V0ivMs6kgJWitei9C3E9cQHpQYXqJb0OLnRIGpnAAzw2Jn15+5sbT06W gQLkJA/lkepntohAfBIWaG6YvwYafY1G1GDCIm7fhWuZBQUrFEjvSfyzgwF9G0LnlW3A 572GCu5Wbz9GfgEJXP6B+zH0eH4d+kWuD2TfaZyGduliq3+iZI8nr7g0W7tErO9N9eca ft0Tzyo+WU/XyvUIIkMR60Kr5sSl27hujoB4fBw8pYPJPoq1yZIA3VpzVrVpIcu1B9s2 Ay9W+2N91QNTpjSJpO+RLbAjFqDlEyV271rAIhnusOGYrXRShU20p6sN4fj+Xoo4DJ1R Qwtg== X-Gm-Message-State: AOAM533B6Sm9oShuIzacdJeHrALG1p5Nm3aLljlk49f5v4dk7ChaGH1N VGogI6aGw9c6ahMHyMO/qVw= X-Google-Smtp-Source: ABdhPJzqyqP/FdE2S3r57uKmXC6P4uDXnYPtlliGLjz45/SQAYPv9G0GiL1sOQ7Ra1PZtR/a5opq1w== X-Received: by 2002:a1c:f606:: with SMTP id w6mr8634993wmc.42.1631283763709; Fri, 10 Sep 2021 07:22:43 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id d7sm4689263wrs.39.2021.09.10.07.22.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Sep 2021 07:22:43 -0700 (PDT) Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> <87ee9wa7yo.fsf@gmail.com> <8ee6271b-142e-7cc1-3d24-7e5c342ef86b@yandex.ru> From: Dmitry Gutov Message-ID: Date: Fri, 10 Sep 2021 17:22:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org, Lars Ingebrigtsen , Gregory Heytings , Augusto Stoffel , Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 10.09.2021 17:06, João Távora wrote: > On Fri, Sep 10, 2021 at 2:28 PM Dmitry Gutov wrote: >> >> On 10.09.2021 16:14, João Távora wrote: >>> - If you're OK with letting the server do the filtering and the >>> highlighting, you can make a "backend" style like I did for SLY, for >>> example. It's going to be faster, but `completion-styles` won't be >>> honoured. That's doesn't mean you give up 100% on "flex". In SLY, >>> there is flex implemented on the Common Lisp side, and for Eglot, many >>> LSP server do their own flex matching. >> >> You can't really do that with python-shell completion. > > Probably not unless you write some python, no. I don't see that > as being that dirty. I didn't say it was dirty, just not very fitting for the current approach: when you do completion by piping code for evaluation through inferior shell, you generally like that code to be simple. And reimplementing every completion style in Python seems like anything but. >> Nor do you need >> do: the basic pcmpl mechanism should work just fine with it, and for >> performance the completion table just needs some smarter caching. > > Yes, as I said in b), with "sufficiently smart caching" (and infinite > memory space) you can do everything, indeed. It's one of the > famous "two hard problems" though, so good luck. Completion backends do caching anyways, whether it's on the Emacs side, or somewhere inside a language server. Since completion logic is defined on "our" side here (despite being written in Python), caching logic can reside here too. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 10:40:06 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 14:40:06 +0000 Received: from localhost ([127.0.0.1]:38944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOhhG-0000l5-A6 for submit@debbugs.gnu.org; Fri, 10 Sep 2021 10:40:06 -0400 Received: from mail-pg1-f174.google.com ([209.85.215.174]:43631) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOhhE-0000kV-N5 for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 10:40:05 -0400 Received: by mail-pg1-f174.google.com with SMTP id r2so1984863pgl.10 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 07:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=tlStJC2a4hpfSpTY1ftjB3T96uhLq7mpPBp0jE4h25s=; b=WoJEY7GPWwhNpfDe3dNe/H3OjVPo7pwHQIj62cVOpxC9pkZIRIu/A51NGKvz8W231O A+EHX38+h41jlWD+KdNYT/4QudvcS/XsVCLsjHeA6y55iK0EG14Qh+z0l131L5nVGass dOewcL+7ZEOzl8nvJmV7tfDYuG3nIg3DY4mKozRaMRVyYxip25i5xAJqf+x0ECV5/x7p f4QQFBmjNnOBRhVMlPVYRCUKH5fCnXrMhvBrc1UokQRKCmAhQAWz1u9bVRy+1huowvMm cPuCFv78kLEeGUgRckAWjpUnps/pdRX23Mm8E5F2ut2A3y8NdxABdLWpjnc0xvsd3BQ6 IGyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=tlStJC2a4hpfSpTY1ftjB3T96uhLq7mpPBp0jE4h25s=; b=5I7fIuOXDzrIniswXPGK0JfVFm4aH9aX2Jrgrz+6aEsZfb+8KnhOmBOz5UdMTNLRqq GHZjC6bzj2JfRxo6HAS9JLdsu5YxhkP+z+vLaVa6IwxlPTinnn1rB4iJ+Q3U/AN3PZoJ qPU6NA1jSxRSA7hVbMOhfPX3q0Swq0p6hKP1mO8IY94+NF7/3jH/VrdF9tEJODs+2Gti M43d99sqru6bv0fdiW8DT1hOM4T4ZKKad35dwml8KEibLc4PpISbBe4PPFuyGM2hfZe9 03tRHUq4Tb0TTTRvSIzgpUJLXvN+HzwvyRkn+VmMxNi5Tw6SfW8wNgokMIYNXTRMnfdZ yKEw== X-Gm-Message-State: AOAM530S8nfEJJMZynK5VqP0wQsSZjLiMjtDuNfsnc0K0kfrELIZ7h7L Y8/31TRjvtmCcSW+AL9XFQaKuhZUj8nmftZhAew= X-Google-Smtp-Source: ABdhPJx5hORhNMLmJO9AVHbh3PGtVguoRlO5GEZfiaJqENLSfGbb0YMsaGSklfibzqIGsF/9aLxomGUrD586Flf0rM8= X-Received: by 2002:a63:4c5c:: with SMTP id m28mr7497253pgl.67.1631284797578; Fri, 10 Sep 2021 07:39:57 -0700 (PDT) MIME-Version: 1.0 References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> <87ee9wa7yo.fsf@gmail.com> <8ee6271b-142e-7cc1-3d24-7e5c342ef86b@yandex.ru> In-Reply-To: From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Fri, 10 Sep 2021 15:39:46 +0100 Message-ID: Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. To: Dmitry Gutov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org, Lars Ingebrigtsen , Gregory Heytings , Augusto Stoffel , Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, Sep 10, 2021 at 3:22 PM Dmitry Gutov wrote: > > On 10.09.2021 17:06, Jo=C3=A3o T=C3=A1vora wrote: > > On Fri, Sep 10, 2021 at 2:28 PM Dmitry Gutov wrote: > >> > >> On 10.09.2021 16:14, Jo=C3=A3o T=C3=A1vora wrote: > >>> - If you're OK with letting the server do the filtering and the > >>> highlighting, you can make a "backend" style like I did for SLY, = for > >>> example. It's going to be faster, but `completion-styles` won't = be > >>> honoured. That's doesn't mean you give up 100% on "flex". In SL= Y, > >>> there is flex implemented on the Common Lisp side, and for Eglot,= many > >>> LSP server do their own flex matching. > >> > >> You can't really do that with python-shell completion. > > > > Probably not unless you write some python, no. I don't see that > > as being that dirty. > > I didn't say it was dirty, just not very fitting for the current > approach: when you do completion by piping code for evaluation through > inferior shell, you generally like that code to be simple. And > reimplementing every completion style in Python seems like anything but. I was just volunteering an opinion on how to solve _most_ of the problem (hence I wrote "don't give up 100%") Never did I suggest to implement "every completion style". SLY implements only two in Common Lisp. They're pretty sufficient for most users it seems. Most language servers seem to implement flex, some only prefix, some may be configurable I suppose. > Completion backends do caching anyways, whether it's on the Emacs side, > or somewhere inside a language server. There are many types of caching, as I tried to explain. Inter-capf-invocation caching (if you can understand what I mean) is possible, but is probably harder to get right than the "intra" version. I'm really just stating the obvious: the more removed you are from the source of truth, the harder it becomes to cache. But also, it's true that are definitely valuable, if implemented correctly or if a degree of inaccuracy is tolerated. Fast and accurate is hard. Jo=C3=A3o T=C3=A1vora From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 10:43:16 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 14:43:16 +0000 Received: from localhost ([127.0.0.1]:38952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOhkK-0000pu-1o for submit@debbugs.gnu.org; Fri, 10 Sep 2021 10:43:16 -0400 Received: from mail-wm1-f43.google.com ([209.85.128.43]:43817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOhkI-0000pg-FZ for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 10:43:14 -0400 Received: by mail-wm1-f43.google.com with SMTP id n7-20020a05600c3b8700b002f8ca941d89so1564032wms.2 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 07:43:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SKqnlmR7SnomnD1bpCA7Ysut7US0DsMv6cGTJWZVfZ0=; b=GZAAY8TL6ZP0XMbKlG2LHeHCl4nM0HfeC8IHid9NE5Bdh/3d90I+RwbTrUXlpo+wXc HtfXqObOvzZT2rT+CYGq9cEIIHggFHxFfrTgfC5Wq97Wb4jp3RjmAnxJ4sXg4LKcvRcp DFv27OzhSS3Qh3yJjVK5UswUUsXC30ChPJWRHFP2Ludm/5y+J1lSj6J4LOciXzoH/mNn 2R6u1eWOzSOW0rUdVS7ikpsGdN6M8q3QQkEoMqReoWJOPAGXzr/Y1liYWaBLDQShZfUV q2711Dr7LIWdqj2K96Gde8dti2q1Sd8GS1TylXOrKU5N5Xv0PsuJvFiDlWgvKOkNmG4a lSdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SKqnlmR7SnomnD1bpCA7Ysut7US0DsMv6cGTJWZVfZ0=; b=pwdwykRe6MWfLKAmcCRg+n3XhdlEefe5Ws70FdX0tfYRIoC+wnFUwQriQa61esBPp4 OzMvuyNSXuY/YgMFhDYb0DpqADCP0myrQmyJ/07RrbVR8CCh6M5AiIGtfKUzvr0NBwJd j2Zt5mSC3MfqfLUop73KEK5vwqwYv8DKWfQqG19OvpHMEgwvrGA5+Xo9u2MA7sT9PBov akTcVpfFQBYjMNB+alX3J1PQYuA2lzv6ZiSlNB2z1pfsuR860Yrny2v1ON16Pfg99MAL SkRWSGTQmVLuf4KDip+FxJptvK0yNuxAWCt/JEuzIV3ettMhEr/4qOGBb7JeHycKxfMi FUUg== X-Gm-Message-State: AOAM531zb3KIIstitW3xbTbQQp3VZp4lDWG2tkxwNVO3Iyf64uJoi0ZU GhPrgSwaXY1APbE9dTwbKJs= X-Google-Smtp-Source: ABdhPJyairmEKubYgaUd/LX+xMj/Nktnq9RZ6IB2pwL8kWgERgxDfHEG9hIYg4vAW0TCtUWxz9avKA== X-Received: by 2002:a05:600c:cc:: with SMTP id u12mr8470995wmm.182.1631284988761; Fri, 10 Sep 2021 07:43:08 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id z7sm5819513wre.72.2021.09.10.07.43.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Sep 2021 07:43:08 -0700 (PDT) Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> <87ee9wa7yo.fsf@gmail.com> <8ee6271b-142e-7cc1-3d24-7e5c342ef86b@yandex.ru> From: Dmitry Gutov Message-ID: <15c15c3c-5f29-373f-83fc-fc736b45f7ea@yandex.ru> Date: Fri, 10 Sep 2021 17:43:05 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org, Lars Ingebrigtsen , Gregory Heytings , Augusto Stoffel , Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 10.09.2021 17:39, João Távora wrote: >> Completion backends do caching anyways, whether it's on the Emacs side, >> or somewhere inside a language server. > There are many types of caching, as I tried to explain. > Inter-capf-invocation caching (if you can understand what I mean) > is possible, but is probably harder to get right than the "intra" version. The proposed patch provides the "intra" version. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 15:08:23 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 19:08:23 +0000 Received: from localhost ([127.0.0.1]:39199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOlss-0001vY-NU for submit@debbugs.gnu.org; Fri, 10 Sep 2021 15:08:23 -0400 Received: from mail-wm1-f44.google.com ([209.85.128.44]:55082) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOlsq-0001vI-HW for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 15:08:21 -0400 Received: by mail-wm1-f44.google.com with SMTP id s24so1907308wmh.4 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 12:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:user-agent:mime-version; bh=Quen7fIx7fGvi1IzZugY5gerdZC4POprgZSGGpZtQSk=; b=XQpujMXbWBd8X7N1qR53E30aIAsyLnB9Tzzb2tLgvp4xc3TxZqeqa4Lr25VA/mzhuI X86uRQpfFSk2HP4EsX+J3ymDQjlWvt+Y4blEk1+zfJJkNjPpgMKY+gzm3+UNJiBmXKDo buyoSQrBWVAPw52DUfUDjHnrGYYyoaHoSuku6DFg4bd9VeLdKmR+qzYxWDBxWz441Ptb ZdTbg134IsyZzcfJ8cwlqCUlLZX2YoDJTYp5lwXwtci0NzdWTPaXDhhFqbX3kw4xLJXM vAWiiJxYufIXoS9yX4V3j4JS8W1qew9whTRMw9hO6u8/yYqYUY86Ofs/69wCuNoJncCb xnLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :mime-version; bh=Quen7fIx7fGvi1IzZugY5gerdZC4POprgZSGGpZtQSk=; b=Ct7BsTJBa037SJ+yifAPSTUNltymad4FJiZgL2ZdkDQZ2s7uSKZhvGhJhTSmexJRXx iYIAbZSMpcR13njN4Cpkm3jz9SjhfI61a1CFJOteKBSNjsmjJ6dx+R5vXpMyzHAvnTy/ pvzJFZYGNHpGrwDTGJGKTl8m3i6n2Q1RHPzChvMFqdVQYDDrWO6tEaWpwPFUPmMyh/II htqAu0teqHZA6LlwAn7n0QAZwsL/6C7j99vw/AKsc+d4fu5LlPrDx0Hkt8TCXbQTAKoG xrAx/6PueksS+6/a6gpSRr5bJ2CZ8pe1ZW+LqfF1S7Yup1AjUyUR6TAM9jZMAfV8i0yj d7Ng== X-Gm-Message-State: AOAM532jbDRtWWZypx0t1Isd7G1VVcoap39cCNnecdWKs0FUiS0+yKjb Xt7OYIN5bWLzQwabpLEYA3M= X-Google-Smtp-Source: ABdhPJxppNDP0A3zzy/kYER29ruhz0ct+Gii/fMZ7X5ZTtid62YU6/y5lTMyTKKN7wdnERDZ0Ku9bg== X-Received: by 2002:a05:600c:2295:: with SMTP id 21mr9695993wmf.84.1631300894597; Fri, 10 Sep 2021 12:08:14 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id z5sm5149805wmp.26.2021.09.10.12.08.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 12:08:13 -0700 (PDT) From: Augusto Stoffel To: Dmitry Gutov Subject: Re: bug#50459: 28.0.50; [PATCH] Python shell completion is incompatible with flex, orderless, etc. Date: Fri, 10 Sep 2021 21:08:12 +0200 Message-ID: <877dfo45b7.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: Michael Albinus , Gregory Heytings , 50459@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Okay, I've attached a patch which seems to work fine. On Fri, 10 Sep 2021 at 16:32, Dmitry Gutov wrote: > On 09.09.2021 19:46, Augusto Stoffel wrote: >> To alleviate this, the completion-at-point function could implement some >> sort of caching. The difficult question is when to invalidate the >> cache. I've attached one possiblility as a draft patch. If the >> approach seems reasonable, then I'll format it properly. > > It's much simpler than what we talked about, but given that > python-shell-completion-at-point doesn't really look past the current > line, your approach should work fine. Yes, and you're right --- I've did it that way because this comint-based completion basically only works for globals anyway. > > I'm not very familiar with the code, so I cannot approve the exact > patch, though, sorry. > > As a bonus, though, maybe add the position of prompt on the > shell-buffer to the invalidation key? Like, if a user imports some new > lib in there, that can bring in new completions. Good idea. I've added this to the patch. It still won't show the new completions until the user evaluates the import, but this is the best you can get by querying an interpreter for the completions. I've also changed a bit the way the "native completion" setup code is sent, so that it doesn't print a message directly in the shell buffer (there is still an echo area message). --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Implement-caching-for-python-shell-completion-at-poi.patch >From 3f27a63fe5be884464a6a68407e0b6990186c4a6 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Fri, 10 Sep 2021 20:44:10 +0200 Subject: [PATCH] Implement caching for 'python-shell-completion-at-point' * lisp/progmodes/python.el (python-shell-completion-at-point): cache results, since computing them involves talking with the inferior process and, potentially, network communications (python-shell--capf-cache): new variable, for cache (python-shell-completion-get-completions, python-shell-completion-native-get-completions): 'import' argument is not needed anymore. (python-shell-completion-native-setup, python-shell-completion-native-try): pass the setup code synchronously, to avoid printing a message in the shell. --- lisp/progmodes/python.el | 59 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2eef52de0c..e71a8102df 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3577,13 +3577,12 @@ python-shell-completion-native-try python-shell-completion-native-try-output-timeout)) (python-shell-completion-native-get-completions (get-buffer-process (current-buffer)) - nil "_"))) + "_"))) (defun python-shell-completion-native-setup () "Try to setup native completion, return non-nil on success." - (let ((process (python-shell-get-process))) - (with-current-buffer (process-buffer process) - (python-shell-send-string " + (let* ((process (python-shell-get-process)) + (output (python-shell-send-string-no-output " def __PYTHON_EL_native_completion_setup(): try: import readline @@ -3693,14 +3692,10 @@ python-shell-completion-native-setup print ('python.el: native completion setup failed, %s: %s' % sys.exc_info()[:2]) -__PYTHON_EL_native_completion_setup()" process) - (when (and - (python-shell-accept-process-output - process python-shell-completion-native-try-output-timeout) - (save-excursion - (re-search-backward - (regexp-quote "python.el: native completion setup loaded") nil t 1))) - (python-shell-completion-native-try))))) +__PYTHON_EL_native_completion_setup()" process))) + (when (string-match-p "python\\.el: native completion setup loaded" + output) + (python-shell-completion-native-try)))) (defun python-shell-completion-native-turn-off (&optional msg) "Turn off shell native completions. @@ -3760,13 +3755,10 @@ python-shell-completion-native-toggle (python-shell-completion-native-turn-on msg)) python-shell-completion-native-enable)) -(defun python-shell-completion-native-get-completions (process import input) - "Get completions using native readline for PROCESS. -When IMPORT is non-nil takes precedence over INPUT for -completion." +(defun python-shell-completion-native-get-completions (process input) + "Get completions of INPUT using native readline for PROCESS." (with-current-buffer (process-buffer process) - (let* ((input (or import input)) - (original-filter-fn (process-filter process)) + (let* ((original-filter-fn (process-filter process)) (redirect-buffer (get-buffer-create python-shell-completion-native-redirect-buffer)) (trigger "\t") @@ -3818,11 +3810,8 @@ python-shell-completion-native-get-completions :test #'string=)))) (set-process-filter process original-filter-fn))))) -(defun python-shell-completion-get-completions (process import input) - "Do completion at point using PROCESS for IMPORT or INPUT. -When IMPORT is non-nil takes precedence over INPUT for -completion." - (setq input (or import input)) +(defun python-shell-completion-get-completions (process input) + "Get completions of INPUT using PROCESS." (with-current-buffer (process-buffer process) (let ((completions (python-util-strip-string @@ -3836,6 +3825,9 @@ python-shell-completion-get-completions (split-string completions "^'\\|^\"\\|;\\|'$\\|\"$" t))))) +(defvar-local python-shell--capf-cache nil + "Variable to store cached completions and invalidation keys.") + (defun python-shell-completion-at-point (&optional process) "Function for `completion-at-point-functions' in `inferior-python-mode'. Optional argument PROCESS forces completions to be retrieved @@ -3889,12 +3881,21 @@ python-shell-completion-at-point ;; it during a multiline statement (Bug#28051). #'ignore #'python-shell-completion-get-completions)) - (t #'python-shell-completion-native-get-completions))))) - (list start end - (completion-table-dynamic - (apply-partially - completion-fn - process import-statement))))) + (t #'python-shell-completion-native-get-completions)))) + (prev-prompt (car python-shell--capf-cache)) + (re (or (cadr python-shell--capf-cache) regexp-unmatchable)) + (prefix (buffer-substring-no-properties start end))) + ;; To invalidate the cache, we check if the prompt position or the + ;; completion prefix changed. + (unless (and (equal prev-prompt (car prompt-boundaries)) + (string-match re prefix)) + (setq python-shell--capf-cache + `(,(car prompt-boundaries) + ,(if (string-empty-p prefix) + regexp-unmatchable + (concat "\\`" (regexp-quote prefix) "\\(?:\\sw\\|\\s_\\)*\\'")) + ,@(funcall completion-fn process (or import-statement prefix))))) + (list start end (cddr python-shell--capf-cache)))) (define-obsolete-function-alias 'python-shell-completion-complete-at-point -- 2.31.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 15:27:38 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 19:27:38 +0000 Received: from localhost ([127.0.0.1]:39217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOmBW-0002UO-8u for submit@debbugs.gnu.org; Fri, 10 Sep 2021 15:27:38 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]:36825) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOmBU-0002U9-PU for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 15:27:37 -0400 Received: by mail-wr1-f41.google.com with SMTP id g16so4129882wrb.3 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 12:27:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Iuur4mdtLiLkGdgxMZilegc/kW8tJiBYZoaxKmADtmI=; b=gJrgh9U39I7L3gEbxGbPlTk84chzbLTmVuxJhtvAgW1D0npsjRYpgrNZRDvx2SqbmG 2dzVWSumdnwn3bX+QHk4QfHUIDCzJn1LzjTDXgPF8Rev0K3pna2z7UQilQOU0N/2RbwR 5XwOcuOAgRlFBz1YrS8dZlglEuT75xY7wdOSo26l9dwvl/9+9GIybEnsO8gAR0tKtqAa Ktu2OeoO7hAUYlj9q0H3s8SDjRzXPr8Zu+ivkVBWHsVAl8r6dDzeE9EoBC/+NBOuPR03 +onWNC6l+zzXzhOEIzKOZCS2J16xhZq29CUnlJPcfA0XccaLmDE5rZeulliiKDAzafM6 WcRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Iuur4mdtLiLkGdgxMZilegc/kW8tJiBYZoaxKmADtmI=; b=j7n6REQrHgbUaEUXKXp0omP5pr5sq+1pu2s3+L8yvPDFEH9XStOnjC8Q3OFslFcNTT RtV1RPRLl9CaEj2OxkEXNWY27h4Z6anOhgiKz/26JhdWpp/0RfkW1dbTG3XoZliBO5oJ Jv1ulSCR7+FE4B01Cuo0zso4uTbWcDNpKhbWmOP/4lEL4iNa++MXdLji9o/+uii19HeP Yc61n/pDs2PS0Xf6lzoEdg0v1m92hOoC/Vu135CoGmbipsaK/oOKhwUV3oF61AkD1mNQ TEPFTrNjecdvdUNKobuo3IE8nSFd/qb9csgSCtAfqUci5R5b+7Lj02Y2dDEiDrou1qev kHfw== X-Gm-Message-State: AOAM530X+GsasdXIuXHExGARqeBEtw8Vjk0VN+HgdiBBpJWqx0PiyB2v R6++zPsr/VRFsz4mbEM89Tk= X-Google-Smtp-Source: ABdhPJzFjxdIZ5BEX4diLE1DT4IQnasPdRBnVQBqBWa7nTQ70hatWSDA6kZ2BldUSqWWnnaXVXLqSA== X-Received: by 2002:adf:d231:: with SMTP id k17mr11544295wrh.389.1631302050920; Fri, 10 Sep 2021 12:27:30 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id u23sm4888250wmc.24.2021.09.10.12.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 12:27:30 -0700 (PDT) From: Augusto Stoffel To: Dmitry Gutov Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> <87ee9wa7yo.fsf@gmail.com> <8ee6271b-142e-7cc1-3d24-7e5c342ef86b@yandex.ru> <15c15c3c-5f29-373f-83fc-fc736b45f7ea@yandex.ru> Date: Fri, 10 Sep 2021 21:27:29 +0200 In-Reply-To: <15c15c3c-5f29-373f-83fc-fc736b45f7ea@yandex.ru> (Dmitry Gutov's message of "Fri, 10 Sep 2021 17:43:05 +0300") Message-ID: <8735qc44f2.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org, Lars Ingebrigtsen , Gregory Heytings , Michael Albinus , =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, 10 Sep 2021 at 17:43, Dmitry Gutov wrote: > On 10.09.2021 17:39, Jo=C3=A3o T=C3=A1vora wrote: >>> Completion backends do caching anyways, whether it's on the Emacs side, >>> or somewhere inside a language server. >> There are many types of caching, as I tried to explain. >> Inter-capf-invocation caching (if you can understand what I mean) >> is possible, but is probably harder to get right than the "intra" versio= n. > > The proposed patch provides the "intra" version. I just wanted to emphasize that the approach of evaluating code and asking an interpreter for completions is obviously a dead end. I guess it is still the best available at the moment for the REPL, so it makes sense to ensure it's reasonably correct and doesn't hang your comint. But further optimizations are not really worth the effort. The LSP stuff is much more interesting, and there the caching question is pretty hairy... From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 10 16:08:28 2021 Received: (at 50459) by debbugs.gnu.org; 10 Sep 2021 20:08:28 +0000 Received: from localhost ([127.0.0.1]:39229 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOmp2-0003hK-5y for submit@debbugs.gnu.org; Fri, 10 Sep 2021 16:08:28 -0400 Received: from mail-pj1-f51.google.com ([209.85.216.51]:54167) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOmp0-0003h4-Tx for 50459@debbugs.gnu.org; Fri, 10 Sep 2021 16:08:27 -0400 Received: by mail-pj1-f51.google.com with SMTP id j1so2106329pjv.3 for <50459@debbugs.gnu.org>; Fri, 10 Sep 2021 13:08:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=BAXQkCmCi7tlII4t2E9ISaHgt/rW9yST5dsJzmH6ghQ=; b=RwybTuyn1qMn1OMleJ91jo4eYrr/nm3pby1gft4E/7R25yBpjILSLRX7Sk35EoBixu Qjo8m75jYApJQ02tnRjfTrbv9McS3vQPYEp6v8Rcbi6S5WFPyCAF5YMBQTZB/+6k3Fky fWgPwou1bSwUcFkvlQESLPzVuZlkYBVyNR/qwNFNQ5Owv7Y36UdqBqOWrUyE4+lIwuad BWKBxCjnz54TDEMgAmuMT//N1iTsf4dt9CNS8PSU6WiuI9EHFmZB9zozTaCU4UqzXkNg ebOZTaNMAmptU4M2q8pXVKuJffwJGiFxoBgdr0LuNyjPRh+lT35pd/M4+PXX8SFmWhHm dEEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=BAXQkCmCi7tlII4t2E9ISaHgt/rW9yST5dsJzmH6ghQ=; b=HyCgvq+FP8OPsEqGf6Dq9Hw4G8EqUiUxXVvluV1n6pkki82+yWjd/p1Pkys6IapCXB QiC6AESw36/RZNIE/Z2kLGRhi5oqAzxsriDyW9mv+4M7VJlXSGvbuTfRZFtxx7tRaTrC 1JPkg/YPnnCKQEyttMDxSjKmOdDVvu2+Cbrjt/k+8cbSc8dJO2B1LuEZfP4l+6VoKsb/ nCKtLlOVHBrVuhfC31XovXhqU8XB4kJk6/bKuLx2VJ7uk36oFvZodRa/kNyl5BVx35yG Wi6adUajmayfbfD+OeQ0Tn0WjkYnAMXHPGJANciaiR/OSCvYSdqL4M4mkVO720Ywf8i5 sFEQ== X-Gm-Message-State: AOAM53131D58qfDKYaGylbzuo2rWU8J0TKfKOV3Gj8NEsuPrx8EchnQ8 rwyxaSoYDKgFKW+3oTVtyNfzoPOqXnfcaQom6e4= X-Google-Smtp-Source: ABdhPJzD5o8NV2qCs883W4N+tMl9/oyDWkruz0CuFe+n0TOXP4QeAeV0QLuf2zNI1oynESmWEqLbPh4PzMjw9NRkWc0= X-Received: by 2002:a17:902:c411:b0:13a:4daf:5a35 with SMTP id k17-20020a170902c41100b0013a4daf5a35mr9290106plk.52.1631304501160; Fri, 10 Sep 2021 13:08:21 -0700 (PDT) MIME-Version: 1.0 References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> <87ee9wa7yo.fsf@gmail.com> <8ee6271b-142e-7cc1-3d24-7e5c342ef86b@yandex.ru> <15c15c3c-5f29-373f-83fc-fc736b45f7ea@yandex.ru> <8735qc44f2.fsf@gmail.com> In-Reply-To: <8735qc44f2.fsf@gmail.com> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Fri, 10 Sep 2021 21:08:08 +0100 Message-ID: Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. To: Augusto Stoffel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org, Lars Ingebrigtsen , Michael Albinus , Gregory Heytings , Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, Sep 10, 2021 at 8:27 PM Augusto Stoffel wrote= : > > On Fri, 10 Sep 2021 at 17:43, Dmitry Gutov wrote: > > > On 10.09.2021 17:39, Jo=C3=A3o T=C3=A1vora wrote: > >>> Completion backends do caching anyways, whether it's on the Emacs sid= e, > >>> or somewhere inside a language server. > >> There are many types of caching, as I tried to explain. > >> Inter-capf-invocation caching (if you can understand what I mean) > >> is possible, but is probably harder to get right than the "intra" vers= ion. > > > > The proposed patch provides the "intra" version. > > I just wanted to emphasize that the approach of evaluating code and > asking an interpreter for completions is obviously a dead end. I wouldn't put it that strongly, but for sure not as easy to leverage as a ready to use LSP server. That's the promise of LSP, at least. Also, in my experience, I've found that completions are just one aspect of IDEs, and perhaps not even the most important. "Find definition" and diagnostics are perhaps more important for me. So yak-shaving and obsessing over optimizations to this reasonably hard problem (implementing responsive and fast UIs with arbitrarily sophisticated filtering styles over data that is some tenths of seconds away) might not be worth it. OTOH, yak-shaving is what Emacs is about, in some measure ,and if someone shaves the yak for me, I'll gladly take a shaved yak. Jo=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 11 08:09:23 2021 Received: (at 50459) by debbugs.gnu.org; 11 Sep 2021 12:09:23 +0000 Received: from localhost ([127.0.0.1]:39647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP1ox-0007wN-Ck for submit@debbugs.gnu.org; Sat, 11 Sep 2021 08:09:23 -0400 Received: from quimby.gnus.org ([95.216.78.240]:35930) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP1oq-0007w3-H0 for 50459@debbugs.gnu.org; Sat, 11 Sep 2021 08:09:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=u3yarEB5wVBHrzeDiFHi7YknaQIxVZKH52dsmBm52TY=; b=OSXlYtXlh7AqLOwP2QvPVwh15b 01MLFhmuQKqcfrfmaalvvhVvwtDUwS36+Vcjk96XRVeYz+DIT65Sd2Dir1pMo4L2v28zBIAtY+85v FaPOm+wiISJfu0CEhhOC5YAU2SvXTIWojfuQqbJajYyV4d0obTYTp52CVZF2NO2qsdpI=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mP1oh-0008Al-2l; Sat, 11 Sep 2021 14:09:09 +0200 From: Lars Ingebrigtsen To: Augusto Stoffel Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> Date: Sat, 11 Sep 2021 14:09:06 +0200 In-Reply-To: <87zgskejjq.fsf@gmail.com> (Augusto Stoffel's message of "Fri, 10 Sep 2021 13:50:33 +0200") Message-ID: <87lf43nwkd.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Augusto Stoffel writes: > That's true: the logic here is that the completions are computed > eagerly, and then cached until still valid. So if you type > > foo.bar.baz > > the inferior process is contacted 3 times: afte [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50459 Cc: Michael Albinus , Gregory Heytings , 50459@debbugs.gnu.org, joaotavora@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Augusto Stoffel writes: > That's true: the logic here is that the completions are computed > eagerly, and then cached until still valid. So if you type > > foo.bar.baz > > the inferior process is contacted 3 times: after the , and after > each dot. Before, a lazy table was returned, but the inferior would be > contacted after each character anyway (if using Company or similar). Ah, I see, then that sounds like a definite improvement. My other question is then how the cache is flushed... -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 11 08:34:30 2021 Received: (at 50459) by debbugs.gnu.org; 11 Sep 2021 12:34:30 +0000 Received: from localhost ([127.0.0.1]:39677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP2DG-00007W-FQ for submit@debbugs.gnu.org; Sat, 11 Sep 2021 08:34:30 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:37531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP2DE-00007I-Rp for 50459@debbugs.gnu.org; Sat, 11 Sep 2021 08:34:29 -0400 Received: by mail-wr1-f47.google.com with SMTP id t8so1679800wrq.4 for <50459@debbugs.gnu.org>; Sat, 11 Sep 2021 05:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=FX/wQudVg5/LNb3nmZP4FpiHOFOB55rt3bfhdwUr6rQ=; b=OAzyoli4cHsU64XI4PG9Rrq0dSYzzXMMxXaU+3NxOgGMMcwKKL2vnKnNf/m/SR7oLd 1UGxE6/qezcibGQhH+vAMXd+O/osGo13X1Ixo9T6q1Ul+vvDIAsBlNmQT8YEXQedlAbt QsP1L5x7lG6ioreDMbCxqrV1kt4G9TPP79gh93dvaJuVmFKmOsJ/zwGKLb31DiQT4q99 xL76KQdNTpCcKtGftLaau5dPx4l0z6hZGVRypIshtAaj+Eqye1i7k8aX5R6S1RN7SVGG 32EtZCwfWn9jtEG25IJBEHKdfbJ6+Bxri6JAZSj6wvi1hM8i3UdCuvKeGWofMXW1awk1 +C6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=FX/wQudVg5/LNb3nmZP4FpiHOFOB55rt3bfhdwUr6rQ=; b=FTIN6dmNqWn7WiX97ZIHA67hxQapmwqxZlwD23zSAeDypaL39uO3yykMyYHqZdoIKX C8CLwEPvlAypTUwqXPDbWJ2xBQ6SMTzL7osd77J/KLQ3T3da5YIzmfuSLVPQJIUhZpz/ pcQZmN9cggGvCBTqdVI5hiHfQv71BmH7xC4XmPLBecN650kzJGOcuZQB9kRxJTTLVy8L XQp4nZpln+1Eqrud6j6j7lbqHekOIdr8KTqj85jLC3KXW5y1mcNYjZKsUC6vzNX6fI04 RsuCol3A6+SoNA7AZ8gP2jjM056hcrQ9p5zuO6ZZU0/BmYYgeKQkImJK44D8rJKm/99K 77Lg== X-Gm-Message-State: AOAM533lZBNjmUewnppDZz43vwJI84iHbilDjOMUgXHn5U3C94K/eV8u XrMePs4bWtaKuYNEI9hFub0= X-Google-Smtp-Source: ABdhPJzIL4OzzD36foLfwyVuwj16Ya1qcCfIvhNG/iCeijV2VSJlAKloBNGcf1QXh0DNxcsKcQtbcA== X-Received: by 2002:adf:c148:: with SMTP id w8mr3007294wre.317.1631363661994; Sat, 11 Sep 2021 05:34:21 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id e2sm1604304wra.40.2021.09.11.05.34.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Sep 2021 05:34:21 -0700 (PDT) From: Augusto Stoffel To: Lars Ingebrigtsen Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> <87lf43nwkd.fsf@gnus.org> Date: Sat, 11 Sep 2021 14:34:20 +0200 In-Reply-To: <87lf43nwkd.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 11 Sep 2021 14:09:06 +0200") Message-ID: <87ilz71eb7.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50459 Cc: Michael Albinus , Gregory Heytings , 50459@debbugs.gnu.org, joaotavora@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, 11 Sep 2021 at 14:09, Lars Ingebrigtsen wrote: > Augusto Stoffel writes: > >> That's true: the logic here is that the completions are computed >> eagerly, and then cached until still valid. So if you type >> >> foo.bar.baz >> >> the inferior process is contacted 3 times: after the , and after >> each dot. Before, a lazy table was returned, but the inferior would be >> contacted after each character anyway (if using Company or similar). > > Ah, I see, then that sounds like a definite improvement. My other > question is then how the cache is flushed... The cache will be flushed, at the earliest, when a new call to 'python-shell-completion-at-point' is made. And the criterium is the following: - If the prompt moved, then the cache is flushed. - If the current completion prefix (the text between 'start' and 'end') is not identical to the original completion prefix, except for the addition of some word or symbol characters at the end, then the cache is flushed. That's it in a nutshell. I can give more details if you want. From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 11 08:36:15 2021 Received: (at 50459) by debbugs.gnu.org; 11 Sep 2021 12:36:15 +0000 Received: from localhost ([127.0.0.1]:39685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP2Ex-0000Ae-2M for submit@debbugs.gnu.org; Sat, 11 Sep 2021 08:36:15 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP2Et-0000AS-TK for 50459@debbugs.gnu.org; Sat, 11 Sep 2021 08:36:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ng4riXgl3lKX54CSVN4h/qVaVkoIn5RnlFnm7/W8kk0=; b=JpAEA4uxhKEy6fIq9Lepzhn6Uw gWXoOLACsWGu/kycAT5uN+x97hsCbZYi8lf3zTapzU83kF9QEkdXOIW7mA/wEJFKfXnbMZiMnyCI3 AH71LCZmxeXvkRgUs9rCsnf8kxmJTTrqs8EqaK3QZGRTDt5CmKLIMlxCZa6k3NpRAFNY=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mP2Ek-0008Tc-V5; Sat, 11 Sep 2021 14:36:05 +0200 From: Lars Ingebrigtsen To: Augusto Stoffel Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <87czpijixk.fsf@gmail.com> <877dfqjfwu.fsf@gmail.com> <87mtolr91a.fsf@gmail.com> <877dfopsoa.fsf@gnus.org> <87zgskejjq.fsf@gmail.com> <87lf43nwkd.fsf@gnus.org> <87ilz71eb7.fsf@gmail.com> Date: Sat, 11 Sep 2021 14:36:02 +0200 In-Reply-To: <87ilz71eb7.fsf@gmail.com> (Augusto Stoffel's message of "Sat, 11 Sep 2021 14:34:20 +0200") Message-ID: <87v937mgr1.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Augusto Stoffel writes: > The cache will be flushed, at the earliest, when a new call to > 'python-shell-completion-at-point' is made. And the criterium is the > following: > > - If the prompt moved, then the cache is flushe [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50459 Cc: Michael Albinus , Gregory Heytings , 50459@debbugs.gnu.org, joaotavora@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Augusto Stoffel writes: > The cache will be flushed, at the earliest, when a new call to > 'python-shell-completion-at-point' is made. And the criterium is the > following: > > - If the prompt moved, then the cache is flushed. > - If the current completion prefix (the text between 'start' and 'end') > is not identical to the original completion prefix, except for the > addition of some word or symbol characters at the end, then the cache > is flushed. Ah, I got the last bit, but I missed the first part. Well, then I think this sounds like a good approach? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 11 08:51:04 2021 Received: (at 50459) by debbugs.gnu.org; 11 Sep 2021 12:51:04 +0000 Received: from localhost ([127.0.0.1]:39717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP2TI-0000Xc-G7 for submit@debbugs.gnu.org; Sat, 11 Sep 2021 08:51:04 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP2TG-0000X6-UQ for 50459@debbugs.gnu.org; Sat, 11 Sep 2021 08:51:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kEdJqLORyCAvKkyKOKDxro4CzElTR5mI0VPfh55KEgM=; b=ZxHI/KAETdqZIt5+FAaejjeKST jLyrMq7b5wZTVJ964YfqjEGr6sTma1hjOvoogsgO+Vj92WMI3D0siAvqhTKvpaSx4K6hdbsTNaTzJ OJ6yvNkJdsht655DcSX5kRoU0rcEGOneB0Ijs2OgmmJtr79VWceusGWnxpG9m9D4jvUQ=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mP2T8-0000CA-DQ; Sat, 11 Sep 2021 14:50:56 +0200 From: Lars Ingebrigtsen To: Augusto Stoffel Subject: Re: bug#50459: 28.0.50; [PATCH] Python shell completion is incompatible with flex, orderless, etc. References: <87wnnsl1d1.fsf@gmail.com> <877dfo45b7.fsf@gmail.com> Date: Sat, 11 Sep 2021 14:50:53 +0200 In-Reply-To: <877dfo45b7.fsf@gmail.com> (Augusto Stoffel's message of "Fri, 10 Sep 2021 21:08:12 +0200") Message-ID: <87a6kjmg2a.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Augusto Stoffel writes: > Good idea. I've added this to the patch. It still won't show the new > completions until the user evaluates the import, but this is the best > you can get by querying an interpreter for the completi [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50459 Cc: 50459@debbugs.gnu.org, Gregory Heytings , Michael Albinus , Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Augusto Stoffel writes: > Good idea. I've added this to the patch. It still won't show the new > completions until the user evaluates the import, but this is the best > you can get by querying an interpreter for the completions. > > I've also changed a bit the way the "native completion" setup code is > sent, so that it doesn't print a message directly in the shell buffer > (there is still an echo area message). Looks good to me; pushed to Emacs 28 now. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 11 08:51:11 2021 Received: (at control) by debbugs.gnu.org; 11 Sep 2021 12:51:11 +0000 Received: from localhost ([127.0.0.1]:39720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP2TO-0000Xv-Mu for submit@debbugs.gnu.org; Sat, 11 Sep 2021 08:51:11 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36648) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP2TM-0000XV-Kg for control@debbugs.gnu.org; Sat, 11 Sep 2021 08:51:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=v76PJq+kTQJ21kBdzddWdEDgsGbBDdFSGs97J8ripWg=; b=s4qD4o5EKNrDAmexA7bn+SJDyw R6yFffR9RUhTvc/c1FqSZcUT50nXQUs46nVORBQlE7XjgRyRSsuTqqmdn90i3eehBz3DCZev8L8Vp ji6h1joSW28nSJxqedArUE0yHqdc7Y7XNvn3w8EG5SpWX9SY7ZhgzzYAQqkGLmphH6ec=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mP2TF-0000CM-68 for control@debbugs.gnu.org; Sat, 11 Sep 2021 14:51:03 +0200 Date: Sat, 11 Sep 2021 14:51:00 +0200 Message-Id: <878s03mg23.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #50459 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 50459 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 50459 28.1 quit From unknown Tue Aug 19 10:01:14 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 10 Oct 2021 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator