On Mon, 28 Feb 2011 00:17:05 -0500 Stefan Monnier <monn...@iro.umontreal.ca> wrote:
TZ> Maybe accept the score as a property to the candidate strings and use TZ> that property, if it exists, instead of the string length? TZ> That would side-step the current completion mechanism nicely, requiring TZ> little extra code except in the final sort of candidates. If the TZ> strings aren't mangled by the completion mechanism, of course--but I TZ> don't think they are after a quick scan. SM> That would work. It's a quick&simple solution (i.e. generally a good SM> sign), but it has one drawback: the properties will be often added SM> without being used, since the list of completions is used not only to SM> build the *Completions* buffer or to cycle through completions but also SM> to do TAB completion (often just handled by try-completion, but with SM> substring completion it instead needs to get the all-completions list SM> and then weed it out). SM> So it has a performance downside (which means, it's not the last word in SM> this respect), but I'd probably accept a patch to add such a feature to SM> minibuffer.el since the performance impact is only incurred by SM> completion tables that really use the feature and it's unlikely to be SM> a serious maintenance problem in the future. So something like this would work in `completion-all-sorted-completions': (or (get-text-property 0 :completion-score (propertize "hello" :completion-score 100)) 0) => 100 ...and we're adding an extra `get-text-property' call to all the sorts: (or (get-text-property 0 :completion-score "hello") 0) => 0 ...which should not be a big deal since it's just a plist lookup. The only thing I need to clarify is sorting. Right now shorter string wins. In the new method, higher score should win. So I propose these rules: - if both have the :completion-score property, sort by highest score first - if one has it, put it first - if neither has it, shorter string wins Let me know if you agree and I'll propose the code+doc patch. Thanks Ted ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/