minad / consult

:mag: consult.el - Consulting completing-read
GNU General Public License v3.0
1.14k stars 99 forks source link

consult-grep: (wrong number of arguments: orderless--highlight 2) #887

Closed deadcombo closed 7 months ago

deadcombo commented 7 months ago

Hi, this recent commit to orderless seems to break orderless completion in consult:

Debugger entered--Lisp error: (wrong-number-of-arguments orderless--highlight 2)
  (orderless--highlight input str)
  (closure ((input "\\(?:elis\\)")) (str) (orderless--highlight input str))("elisp")
  #f(compiled-function (action) #<bytecode 0x1bcbc6a7519cad99>)(("./elisp/doom-crib.org.save\0864:elisp"))
  #f(compiled-function (action &optional state) #<bytecode 0x139139ab0e5fdc8f>)(("./elisp/doom-crib.org.save\0864:elisp"))
  #f(compiled-function (_ out) #<bytecode -0x1b52fe76591aeba1>)(#<process rg> "./elisp/doom-crib.org.save\0864:elisp\n")
  #<subr completing-read-default>(#("Ripgrep (Project emacs): " 17 22 (help-echo "~/.config/emacs/")) #f(compiled-function (str pred action) #<bytecode 0xca27ae469f7d61>) nil t "#" consult--grep-history nil nil)
  apply((#<subr completing-read-default> #("Ripgrep (Project emacs): " 17 22 (help-echo "~/.config/emacs/")) #f(compiled-function (str pred action) #<bytecode 0xca27ae469f7d61>) nil t "#" consult--grep-history nil nil))
  #f(compiled-function (&rest app) #<bytecode 0xdd1f9cd5f0ad759>)(#<subr completing-read-default> #("Ripgrep (Project emacs): " 17 22 (help-echo "~/.config/emacs/")) #f(compiled-function (str pred action) #<bytecode 0xca27ae469f7d61>) nil t "#" consult--grep-history nil nil)
  apply(#f(compiled-function (&rest app) #<bytecode 0xdd1f9cd5f0ad759>) (#<subr completing-read-default> #("Ripgrep (Project emacs): " 17 22 (help-echo "~/.config/emacs/")) #f(compiled-function (str pred action) #<bytecode 0xca27ae469f7d61>) nil t "#" consult--grep-history nil nil))
  vertico--advice(#<subr completing-read-default> #("Ripgrep (Project emacs): " 17 22 (help-echo "~/.config/emacs/")) #f(compiled-function (str pred action) #<bytecode 0xca27ae469f7d61>) nil t "#" consult--grep-history nil nil)
  apply(vertico--advice #<subr completing-read-default> (#("Ripgrep (Project emacs): " 17 22 (help-echo "~/.config/emacs/")) #f(compiled-function (str pred action) #<bytecode 0xca27ae469f7d61>) nil t "#" consult--grep-history nil nil))
  completing-read-default(#("Ripgrep (Project emacs): " 17 22 (help-echo "~/.config/emacs/")) #f(compiled-function (str pred action) #<bytecode 0xca27ae469f7d61>) nil t "#" consult--grep-history nil nil)
  completing-read(#("Ripgrep (Project emacs): " 17 22 (help-echo "~/.config/emacs/")) #f(compiled-function (str pred action) #<bytecode 0xca27ae469f7d61>) nil t "#" consult--grep-history nil nil)
  #f(compiled-function () #<bytecode 0xd81e7a98a7db8e2>)()
  consult--with-preview-1(any #f(compiled-function (action cand) #<bytecode -0xb6e7c55c2ea4e5f>) #f(compiled-function (narrow input cand) #<bytecode -0x1deb1f1699210721>) #f(compiled-function (&rest args2) #<bytecode -0x1bc33190628a0ff>) #f(compiled-function () #<bytecode 0xd81e7a98a7db8e2>))
  consult--read-1(#f(compiled-function (action) #<bytecode 0x10ea659d6ce4864a>) :prompt #("Ripgrep (Project emacs): " 17 22 (help-echo "~/.config/emacs/")) :lookup consult--lookup-member :state #f(compiled-function (action cand) #<bytecode -0xb6e7c55c2ea4e5f>) :initial "#" :add-history nil :require-match t :category consult-grep :group consult--prefix-group :history (:input consult--grep-history) :sort nil :prompt "Select: " :preview-key any :sort t :lookup #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_168>)
  consult--read(#f(compiled-function (action) #<bytecode 0x10ea659d6ce4864a>) :prompt #("Ripgrep (Project emacs): " 17 22 (help-echo "~/.config/emacs/")) :lookup consult--lookup-member :state #f(compiled-function (action cand) #<bytecode -0xb6e7c55c2ea4e5f>) :initial "#" :add-history nil :require-match t :category consult-grep :group consult--prefix-group :history (:input consult--grep-history) :sort nil)
  consult--grep("Ripgrep" consult--ripgrep-make-builder nil nil)
  consult-ripgrep(nil)
  funcall-interactively(consult-ripgrep nil)
  command-execute(consult-ripgrep)

My completion styles:

    (setq completion-styles '(orderless basic)
             completion-category-defaults nil)
                ;;; Enable partial-completion for files.
                ;;; Either give orderless precedence or partial-completion.
                ;;; Note that completion-category-overrides is not really an override,
                ;;; but rather prepended to the default completion-styles.
    (add-to-list 'completion-category-overrides '((file (styles orderless partial-completion)) ;; orderless is tried first

Cheers for the packages!

oantolin commented 7 months ago

That sounds like you've updated orderless but not vertico. Try also updating vertico.

minad commented 7 months ago

I believe the problem is this outdated snippet: https://github.com/minad/consult/wiki/Home/3bd157565e00b4fdaf38f6c0b54dc887d9849ce7#use-orderless-as-pattern-compiler-for-consult-grepripgrepfind

I just updated the wiki, please take a look: https://github.com/minad/consult/wiki/Home/a0e391f8416e98b8d8319d62fb40b64f939b9fd1#use-orderless-as-pattern-compiler-for-consult-grepripgrepfind

Please follow https://github.com/minad/consult#bug-reports when reporting bugs. I need a minimal recipe to reproduce issues.

oantolin commented 7 months ago

Maybe instead of t, @minad, (orderless--ignore-case-p input) would be better?

deadcombo commented 7 months ago

Apologies for imposing. I fat-fingered and sent the issue before even writing the title. You're correct regarding the cause and solution, both this function and affe-orderless-regexp-compiler are now working correctly.

Your bug-reports section is very good, I'll make a template to fill issues from it in the future. Thank you!