[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The definition of orig-fn.

From: Tassilo Horn
Subject: Re: The definition of orig-fn.
Date: Tue, 05 Oct 2021 10:50:25 +0200
User-agent: mu4e 1.7.0; emacs 29.0.50

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---
     matches the empty string, but only at the beginning of the buffer
     or string being matched against.

     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

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:


reply via email to

[Prev in Thread] Current Thread [Next in Thread]