all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hongyi Zhao <hongyi.zhao@gmail.com>
To: Tassilo Horn <tsdh@gnu.org>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: The definition of orig-fn.
Date: Tue, 5 Oct 2021 17:41:51 +0800	[thread overview]
Message-ID: <CAGP6PO+RUm3LVNchLL=M7VHKTBacR5VOb90TD7+j0oTyDK0yzg@mail.gmail.com> (raw)
In-Reply-To: <87v92bsup1.fsf@gnu.org>

On Tue, Oct 5, 2021 at 5:10 PM Tassilo Horn <tsdh@gnu.org> wrote:
> >> 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.

Thank you for letting me know about these Elisp-specific regexp
metacharacters, I just take it for granted that they are not any
metacharacters.


> >> 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.

Without further keyboard remapping, this scheme will require at least
two keystrokes to complete a candidate insertion. I think abo-abo's
customized function is just for solving this type of problem: One
keystroke for one candidate insertion.

> That's my commit which implemented that for avy:
> https://github.com/abo-abo/avy/commit/27b98bb73044cfe61233d065b8f06bd80cf4867b

Thank you for letting me know of this interesting feature.

HZ



  reply	other threads:[~2021-10-05  9:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 11:33 The definition of orig-fn Hongyi Zhao
2021-10-04 11:59 ` Tassilo Horn
2021-10-04 12:12   ` Hongyi Zhao
2021-10-04 12:23     ` Tassilo Horn
2021-10-04 13:57       ` Hongyi Zhao
2021-10-04 18:14         ` Tassilo Horn
2021-10-05  2:12           ` Hongyi Zhao
2021-10-05  4:56             ` Tassilo Horn
2021-10-05  6:06               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-05  6:25               ` Hongyi Zhao
2021-10-05  6:40                 ` Hongyi Zhao
2021-10-05  7:32                 ` Tassilo Horn
2021-10-05  8:15                   ` Hongyi Zhao
2021-10-05  8:50                     ` Tassilo Horn
2021-10-05  9:41                       ` Hongyi Zhao [this message]
2021-10-05  9:43                         ` Tassilo Horn
2021-10-05 10:19                           ` Tassilo Horn
2021-10-05 10:25                         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-05 11:55                           ` Hongyi Zhao
2021-10-05 14:21                             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-05 10:17                     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-05 11:52                       ` Hongyi Zhao
2021-10-04 12:01 ` Emanuel Berg via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGP6PO+RUm3LVNchLL=M7VHKTBacR5VOb90TD7+j0oTyDK0yzg@mail.gmail.com' \
    --to=hongyi.zhao@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.