Closed Eason0210 closed 2 days ago
I can reproduce this bug. I will need to dig into the source code to figure out this bug. 🤔 Thanks for the detailed steps to reproduce this bug!
Edit: How to reproduce this bug with Eask: (for future references)
# Create test project and navigate to the created project
$ mkdir test-fussy && cd test-fussy
# Create Eask-file (leave everything answers empty since it doesn't matter)
$ eask init
# Add sources
$ eask source add melpa # For everything else
$ eask source add jcs-elpa # For `flx-rs`
# Installed used packages/dependencies
$ eask install consult flx flx-rs fussy vertico
Then paste the above config to ./.eask/<emacs-version>/init.el
$ eask emacs # Start Emacs with those packages installed
@jcs090218 : is this issue related to flx-rs?
I'm seeing a similar case, but it happens when using vertico + fussy + (flx-rs or plain flx). With ido + flx-ido + flx-rs there is no problem. So it seems that the culprit is not flx-rs itself.
I recently updated the flx-rs; maybe that solves the issue. 🤔 @Eason0210 Can you try with the latest version?
@jcs090218 I tried the latest commit of flx-rs, but the issue is still exist.
@jcs090218 : on the issue I've observed there is no difference from the current release of flx-rs to the previous one.
Upon further investigation, it seems that I'm misunderstanding what the fussy/emacs combo does.
I have
(setq completion-styles '(fussy))
When switching buffers with vertico (C-x b
) as long as the input corresponds to the substring of some candidate, fussy-score
is not invoked. Only when the input does not match any candidate as substring, fussy-score
is invoked.
For instance, let's say I have these three buffers: parser.cpp parser.h prelude.cpp do-process.cpp
. If the input is p
, only those that start with that letter are listed, do-process.cpp
is excluded. If the input is pr
, only prelude.cpp
is listed. If then the input is prc
, then fussy-score
is invoked and all the candidates are listed again.
I find this behavior very confusing. I've looked for some configuration that controls this, but found none. What I'm missing?
It seems that only happens in switch-buffer.
(I also realize that my problem is not the same as the the OP, so apologies to @Eason0210 for hijacking his report.)
@jojojames and @jcs090218
When using the default backend
flx
, everthing is working well, but when the number of candidates is large (such as 10000 and more), it is slow. So I tried to use the faster backendflx-rs
.But Some result candidates do not appear when using
flx-rs
withM-x consult-imenu
orM-x consult-line
.steps to reprodue:
~/.emacs.d/init.el
init.el
file(require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize) (package-refresh-contents)
(eval-and-compile (setq use-package-enable-imenu-support t) (setq use-package-expand-minimally t) (require 'use-package))
(use-package flx-rs :load-path "~/src/packages/flx-rs/" :config (setq fussy-score-fn 'fussy-flx-rs-score) (flx-rs-load-dyn))
(use-package fussy :ensure t :custom (completion-styles '(fussy basic)) (completion-category-defaults nil) (completion-category-overrides '((file (styles basic partial-completion)) (eglot (styles fussy basic)))) (fussy-score-fn 'fussy-flx-rs-score) (fussy-filter-fn 'fussy-filter-default) (fussy-use-cache t) :config (advice-add 'corfu--capf-wrapper :before 'fussy-wipe-cache) (add-hook 'corfu-mode-hook (lambda () (setq-local fussy-max-candidate-limit 5000 fussy-default-regex-fn 'fussy-pattern-first-letter fussy-prefer-prefix nil))))
(use-package vertico :ensure t :demand t :bind (:map vertico-map ([tab] . vertico-next) ([backtab] . vertico-previous)) :custom (vertico-cycle t) :config (vertico-mode))
;; Example configuration for Consult (use-package consult :ensure t :bind (;; C-c bindings in
mode-specific-map' ("C-c M-x" . consult-mode-command) ("C-c h" . consult-history) ("C-c k" . consult-kmacro) ("C-c m" . consult-man) ("C-c i" . consult-info) ([remap Info-search] . consult-info) ;; C-x bindings in
ctl-x-map' ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command ("C-x b" . consult-buffer) ;; orig. switch-to-buffer ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame ("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer ;; Custom M-# bindings for fast register access ("M-#" . consult-register-load) ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) ("C-M-#" . consult-register) ;; Other custom bindings ("M-y" . consult-yank-pop) ;; orig. yank-pop ;; M-g bindings ingoto-map' ("M-g e" . consult-compile-error) ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck ("M-g g" . consult-goto-line) ;; orig. goto-line ("M-g M-g" . consult-goto-line) ;; orig. goto-line ("M-g o" . consult-outline) ;; Alternative: consult-org-heading ("M-g m" . consult-mark) ("M-g k" . consult-global-mark) ("M-g i" . consult-imenu) ("M-g I" . consult-imenu-multi) ;; M-s bindings in
search-map' ("M-s d" . consult-find) ;; Alternative: consult-fd ("M-s c" . consult-locate) ("M-s g" . consult-grep) ("M-s G" . consult-git-grep) ("M-s r" . consult-ripgrep) ("M-s l" . consult-line) ("M-s L" . consult-line-multi) ("M-s k" . consult-keep-lines) ("M-s u" . consult-focus-lines))C-x C-f ~/.emacs.d/init.el
M-x consult-imenu
you will see all the candidates as below, so far so good.c
in the minibuffer prompt, you will get no candiates. This is the issue.if I disable the flx-rs and use flx, the result is as below: I don't known why the "fussy" can match the
c
??when input
co
, the result is expected: