[Top][All Lists]

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

Re: Improvement proposals for `completing-read'

From: Daniel Mendler
Subject: Re: Improvement proposals for `completing-read'
Date: Thu, 8 Apr 2021 21:15:12 +0200

On 4/8/21 8:13 PM, Stefan Monnier wrote:
This is similar to what I am doing in my `consult-line` command, which is
a Swiper equivalent. There I encode the line number in Unicode characters of
some private plane and hide them with 'invisible or 'display.

I can understand the `invisible` but I would have used plain `%s` or
`number-to-string` rather than funny unicode chars.

I am using funny unicode tofus in order to prevent accidental matching when searching for numbers. The idea is that the numbers should be unmatchable!

Maybe that's the cleaner solution? The nice advantage is that it would be
backward compatible. I could just start to mark my prefixes as 'unmatchable

Why put it in the prefix rather than the suffix?

and the basic completion style would suddenly start to work. On older Emacs
versions everything would continue to work as is; the user is required to
use a completion style which matches substrings,

If you put the line numbers in the suffix, then they won't bother
anyone, even with the most basic completion scheme.

Yes, then it would work with basic completion. The main reason was that the candidates are already prefixed with line numbers in the 'display property. The real string is the tofu-encoded number hidden behind that.

Maybe it would be better to implement this differently. Use an affixation function prefix for the line numbers and append the 'invisible tofu-encoded line number as suffix. But I think I implemented `consult-line` before the affixation function came into existence. I have to consider this.


reply via email to

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