Elffuss BraidHub

kikocis/company-english-helper public

Add fuzz search algorithm.
Changesetaf4f8814e395c887ff3a203f42a588735a93ff36b69c647566c522f634169a19
AuthorAndy Stewart <lazycat.manatee@gmail.com> · 2018-08-28 22:03 +08:00
CommitterAndy Stewart <lazycat.manatee@gmail.com> · 2018-08-28 22:03 +08:00
Parents11db1b6ed013

Browse the files at this changeset

1 file changed

modified company-english-helper.el +11 −4
@@ -6,8 +6,8 @@
66 ;; Maintainer: Andy Stewart <lazycat.manatee@gmail.com>
77 ;; Copyright (C) 2018, Andy Stewart, all rights reserved.
88 ;; Created: 2018-07-06 23:22:22
9-;; Version: 0.7
10-;; Last-Updated: 2018-08-10 12:39:24
9+;; Version: 0.8
10+;; Last-Updated: 2018-08-28 21:58:45
1111 ;; By: Andy Stewart
1212 ;; URL: http://www.emacswiki.org/emacs/download/company-english-helper.el
1313 ;; Keywords:
@@ -66,6 +66,9 @@
6666
6767 ;;; Change log:
6868 ;;
69+;; 2018/08/27
70+;; * Add fuzz search algorithm.
71+;;
6972 ;; 2018/08/10
7073 ;; * Require `cl' avoid error "Symbol's function definition is void: remove-if-not".
7174 ;;
@@ -128,11 +131,15 @@
128131 (prefix (company-grab-symbol))
129132 (candidates
130133 (remove-if-not
131- (lambda (c) (string-prefix-p (downcase arg) c))
134+ (lambda (c) (or (string-prefix-p (downcase arg) c)
135+ (string-suffix-p (downcase arg) c)
136+ (and (string-match-p "-" (downcase arg))
137+ (and (string-prefix-p (car (split-string (downcase arg) "-")) c)
138+ (string-suffix-p (cadr (split-string (downcase arg) "-")) c)
139+ ))))
132140 en-words-completions))
133141 (annotation (en-words-annotation arg))
134142 (sorted t)
135- (ignore-case 'keep-prefix)
136143 ))
137144
138145 (defun toggle-company-english-helper ()