[求助] 新手求助:装了pinyinlib后,consult无法用拼音首字母进行搜索?

我装了orderless、pinyinlib,但是consult-grep搜索拼音首字母的时候无法成功。配置如下:

(require 'orderless)
(setq completion-styles '(orderless basic)
        completion-category-overrides '((file (styles basic partial-completion))))
(require 'pinyinlib)
(defun completion--regex-pinyin (str)
   (orderless-regexp (pinyinlib-build-regexp-string str)))
 (add-to-list 'orderless-matching-styles 'completion--regex-pinyin)

搜索结果如上,当我consult-grep输入新年快乐的首字母xnkl后,无法出现搜索结果。

eval 后 orderless-matching-styles 包含了 completion–regex-pinyin 了么?

是只要 (add-to-list 'orderless-matching-styles 'completion–regex-pinyin)吗?这个我配置了。我用的是purcell的配置,他的consult的配置如下:

;;; init-minibuffer.el --- Config for minibuffer completion       -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:


(when (maybe-require-package 'vertico)
  (add-hook 'after-init-hook 'vertico-mode)

  (when (maybe-require-package 'embark)
    (with-eval-after-load 'vertico
      (define-key vertico-map (kbd "C-c C-o") 'embark-export)
      (define-key vertico-map (kbd "C-c C-c") 'embark-act)))

  (when (maybe-require-package 'consult)
    (defmacro sanityinc/no-consult-preview (&rest cmds)
      `(with-eval-after-load 'consult
         (consult-customize ,@cmds :preview-key "M-P")))

    (sanityinc/no-consult-preview
     consult-ripgrep
     consult-git-grep consult-grep
     consult-bookmark consult-recent-file consult-xref
     consult--source-recent-file consult--source-project-recent-file consult--source-bookmark)

    (when (and (executable-find "rg"))
      (defun sanityinc/consult-ripgrep-at-point (&optional dir initial)
        (interactive (list prefix-arg (when-let ((s (symbol-at-point)))
                                        (symbol-name s))))
        (consult-ripgrep dir initial))
      (sanityinc/no-consult-preview sanityinc/consult-ripgrep-at-point)
      (global-set-key (kbd "M-?") 'sanityinc/consult-ripgrep-at-point))

    (global-set-key [remap switch-to-buffer] 'consult-buffer)
    (global-set-key [remap switch-to-buffer-other-window] 'consult-buffer-other-window)
    (global-set-key [remap switch-to-buffer-other-frame] 'consult-buffer-other-frame)
    (global-set-key [remap goto-line] 'consult-goto-line)



    (when (maybe-require-package 'embark-consult)
      (with-eval-after-load 'embark
        (require 'embark-consult)
        (add-hook 'embark-collect-mode-hook 'embark-consult-preview-minor-mode)))

    (maybe-require-package 'consult-flycheck)))

(when (maybe-require-package 'marginalia)
  (add-hook 'after-init-hook 'marginalia-mode))


(provide 'init-minibuffer)
;;; init-minibuffer.el ends here

我不知道是不是和他的consult配置有关。 他的orderless配置如下:

(setq tab-always-indent 'complete)
(when (maybe-require-package 'orderless)
  (with-eval-after-load 'vertico
    (require 'orderless)
    (setq completion-styles '(orderless basic))))
(setq completion-category-defaults nil
      completion-category-overrides nil)
(setq completion-cycle-threshold 4)