开发者

Emacs Word-Reordering Completion Style

I'm missing one piece in Emacs' already superbly unique completion system (completion-styles and completion-styles-alist), namely word and sub-word-reordering a la google search.

As an example, file-write should complete to write-file if no other style finds a completion. Word-separating characters could for-example be matched usi开发者_C百科ng the regular expression "\\s_".

Even cooler and more general would be if applied the Damerau-Levenshtein Edit Distance (D) to words instead of letters. The completion candidates could the be sorted on increasing distance D, meaning closest match first.

My plan is quite clear on how to implement this and an implementation of D already exists. I ask anyway so I don't reinvent the wheel yet another time:

Has anybody implemented such a completion style already?


Per --

You cannot do what you want with vanilla Emacs (well, you can use Lisp to code whatever you need -- but you cannot do what you want not out of the box).

Icicles gives you exactly what you want. It's called "progressive completion", and the idea is similar to using a pipeline of grep commands.

  • Nutshell view of progressive completion (and chipping away the non-elephant)

  • Progressive completion

You can also use LevenShtein matching for completion with Icicles, and combine that with progressive completion to match the words in any order.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜