From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: The definition of orig-fn. Date: Tue, 05 Oct 2021 10:50:25 +0200 Message-ID: <87v92bsup1.fsf@gnu.org> References: <87czolhud6.fsf@gnu.org> <878rz9ht1m.fsf@gnu.org> <87sfxgfy19.fsf@gnu.org> <878rz8t68a.fsf@gnu.org> <874k9vud3t.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13756"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.7.0; emacs 29.0.50 Cc: help-gnu-emacs To: Hongyi Zhao Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 05 11:11:17 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mXgTl-0003Nm-7i for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 11:11:17 +0200 Original-Received: from localhost ([::1]:60038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXgTj-0007GO-Oa for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 05:11:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXgTO-0007G1-1u for help-gnu-emacs@gnu.org; Tue, 05 Oct 2021 05:10:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58884) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXgTN-0003jD-LS; Tue, 05 Oct 2021 05:10:53 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:57001) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXgTM-00025w-VT; Tue, 05 Oct 2021 05:10:53 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailauth.nyi.internal (Postfix) with ESMTP id 4E2CC27C0054; Tue, 5 Oct 2021 05:10:52 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 05 Oct 2021 05:10:52 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudelgedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfhgfhffvufffjgfkgggtgfesthhqredttderjeenucfhrhhomhepvfgrshhs ihhlohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucggtffrrghtthgvrhhnpe elvedtueejhfdvveefiefgffehgeelgeduiefgvedvueefvdevjeeivdfgkeekhfenucff ohhmrghinhepfihikhhiphgvughirgdrohhrghdpghhithhhuhgsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnhdomhgv shhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeehvdelke dqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Oct 2021 05:10:51 -0400 (EDT) In-reply-to: X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133557 Archived-At: Hongyi Zhao writes: >> The advice suppresses calls to `company--good-prefix-p' > > Here [1] comes the definition of `company--good-prefix-p': Sorry, I have no time to analyze how company works. ;-) >> if the prefix matches "\\`[0-9]+\\'" which would be true for 9281, too. > > I am puzzled why it is written in this form, to be more specific, why > not just use "[0-9]+"? See (info "(elisp) Regexp Backslash"), especially: --8<---------------cut here---------------start------------->8--- =E2=80=98\`=E2=80=99 matches the empty string, but only at the beginning of the buffer or string being matched against. =E2=80=98\'=E2=80=99 matches the empty string, but only at the end of the buffer or string being matched against. --8<---------------cut here---------------end--------------->8--- So it only matches if prefix is made up entirely of digits, not if the prefix contains some digit. >> That's why I've said, the regexp would allow multi-digit prefixes > > Do you mean that it should be more reasonable by removing the + symbol > in the regexp? If the selection can only be one single digit, it would make sense. But no authorative answer from me who doesn't know the code. I guess the author had a reason to add the + there. >> but probably the candidate selection by numeric key press doesn't >> because it triggers immediately when a numeric key is pressed. > > Insertion candidate by a numeric key is for convenience and > efficiency, so it must work the way you described above. No, not necessarily. One could use prefixes generated by the DeBruijn sequence, see https://en.wikipedia.org/wiki/De_Bruijn_sequence. The avy package supports an `avy-style' called `'de-bruijn', and then you can get unique sequences triggering an action for any alphabet (like the digits). Of course, that means that all candidates will get a "shortcut" of the same length, i.e., with just the letters 0 and 1 available, you could select between 4 candidates using shortcut sequences 00, 01, 10, and 11. That's my commit which implemented that for avy: https://github.com/abo-abo/avy/commit/27b98bb73044cfe61233d065b8f06bd80cf48= 67b Bye, Tassilo