>> Before knowing what's the best approach, I think we should clearly >> decide what would be the "ideal" new API. E.g. should it return "any >> string" and then it'd be up to the infrastructure code to store >> side-info about what is the corresponding candidate's actual text? > > After trying different variants, it turned out that the most convenient > is to use annotation-function that can contain a placeholder for the > completion candidate. Currently "%s" is used as a placeholder, > for example, "prefix %s suffix" but it can be any string. Actually, I discovered that unfortunately annotation-function is unsuitable for formatting data in a columnar format. It needs to receive a complete list of completions to be able to adjust their widths for more optimal overall columnar layout. So a new function is needed that is like annotation-function but accepts a list of all completions. There is an existing similar function 'display-sort-function' that could be abused to add prefix/suffix annotations, but maybe a separate function would be preferable for cleaner API?