修改Helm以支持中文拼音搜索

应该把 source 里面的 :match 函数返回的正则,用 orderless-pattern-comipler 转换一下就行。

(defun ad/helm-mm-3-get-patterns-internal (pattern)
  "Return a list of predicate/regexp cons cells.
E.g., ((identity . \"foo\") (not . \"bar\"))."
  (unless (string= pattern "")
    (cl-loop for pat in (helm-mm-split-pattern pattern)
          collect (if (char-equal ?! (aref pat 0))
                      (cons 'not (car (orderless-pattern-compiler (substring pat 1))))
                    (cons 'identity (car (orderless-pattern-compiler  pat)))))))


(defun ad/helm-buffers--match-from-pat (candidate)
  (let* ((regexp-list (cl-loop with pattern = helm-pattern
                               for p in (helm-mm-split-pattern pattern)
                               unless (string-match
                                       "\\`\\(\\*\\|/\\|@\\)" p)
                               collect (car (orderless-pattern-compiler p))))
         (nofuzzy (cdr regexp-list)))
    (if regexp-list
        (cl-loop for re in regexp-list
                 always (helm-buffer--match-pattern re candidate nofuzzy))
        t)))

helm-mini,helm-swoop 都能用了, helm-find-file 最后匹配文件名的时候要先输入一个空格