armindarvish / consult-omni

A Powerful Versatile Omni Search inside Emacs
https://github.com/armindarvish/consult-omni/tree/main
165 stars 4 forks source link

How can I get a simple example working? #13

Closed madorian closed 3 months ago

madorian commented 4 months ago

Just trying to get something working, but I assume this simple command should not output all of this?;)

(require 'consult-omni-sources)

, but I get

Debugger entered--Lisp error: (void-function static-if)
  static-if(nil (embark--narrow-to-target))
  byte-code("\302\303\304\305\306DD\307\310\311%\210\302\312\304\305\313DD\314\310\315%\210\302\316\304\305\317DD\320\310\321%\210\302\322\304\305\323DD\324\310\325%\210\302\326..." [emacs-major-version embark-around-action-hooks custom-declare-variable embark-quit-after-action funcall function #f(compiled-function () #<bytecode 0x19800016fe5d4>) "Should `embark-act' quit the minibuffer?\nThis cont..." :type (choice (const :tag "Always quit" t) (const :tag "Never quit" nil) (alist :tag "Configure per action" :key-type (choice (function :tag "Action") (const :tag "All other actions" t)) :value-type (choice (const :tag "Quit" t) (const :tag "Do not quit" nil)))) embark-confirm-act-all #f(compiled-function () #<bytecode 0x19800016fe5d4>) "Should `embark-act-all' prompt the user for confir..." boolean embark-default-action-overrides #f(compiled-function () #<bytecode 0x19800016fe914>) "Alist associating target types with overriding def..." (alist :key-type (choice (symbol :tag "Type") (cons (symbol :tag "Type") (symbol :tag "Command"))) :value-type (function :tag "Default action")) embark-target-injection-hooks #f(compiled-function () #<bytecode 0x19800016fe914>) "Alist associating commands with post-injection set..." (alist :key-type (choice symbol (const :tag "Default" t) (const :tag "Always" :always)) :value-type hook) embark-pre-action-hooks #f(compiled-function () #<bytecode 0x19800016fe914>) "Alist associating commands with pre-action hooks.\n..." (alist :key-type (choice symbol (const :tag "Default" t) (const :tag "Always" :always)) :value-type hook) embark-post-action-hooks #f(compiled-function () #<bytecode 0x19800016fe914>) "Alist associating commands with post-action hooks...." (alist :key-type (choice symbol (const :tag "Default" t) (const :tag "Always" :always)) :value-type hook) #f(compiled-function () #<bytecode 0x19800016fe914>) "Alist associating commands with post-action hooks...." (alist :key-type (choice symbol (const :tag "Default" t) (const :tag "Always" :always)) :value-type hook) static-if 29 repunctuate-sentences (embark--narrow-to-target) embark-multitarget-actions #f(compiled-function () #<bytecode 0x1985da561fa14>) "Commands for which `embark-act-all' should pass a ..." (repeat function) embark-repeat-actions #f(compiled-function () #<bytecode 0x10332ceb5f53614>) "List of repeatable actions.\nWhen you use a command..." (repeat (choice function (cons function (symbol :tag "Next target type")))) put embark-target-overlay face embark-target priority ...] 6)
  require(embark)
  #<subr eval-buffer>(#<buffer  *load*> nil "/home/b0ef/.emacs.d/straight/build/consult-omni/co..." nil t)
  apply(#<subr eval-buffer> (#<buffer  *load*> nil "/home/b0ef/.emacs.d/straight/build/consult-omni/co..." nil t))
  eval-buffer(#<buffer  *load*> nil "/home/b0ef/.emacs.d/straight/build/consult-omni/co..." nil t)  ; Reading at buffer position 441
  load-with-code-conversion("/home/b0ef/.emacs.d/straight/build/consult-omni/co..." "/home/b0ef/.emacs.d/straight/build/consult-omni/co..." nil t)
  require(consult-omni-embark)
  (progn (require 'consult-omni-sources) (require 'consult-omni-embark) (require 'consult-omni-brave-autosuggest) (setq consult-omni-default-interactive-command #'consult-omni-brave-autosuggest) t)
  (condition-case err (progn (require 'consult-omni-sources) (require 'consult-omni-embark) (require 'consult-omni-brave-autosuggest) (setq consult-omni-default-interactive-command #'consult-omni-brave-autosuggest) t) ((debug error) (funcall use-package--warning303 :config err)))
  (prog1 (condition-case err (progn (require 'consult-omni-sources) (require 'consult-omni-embark) (require 'consult-omni-brave-autosuggest) (setq consult-omni-default-interactive-command #'consult-omni-brave-autosuggest) t) ((debug error) (funcall use-package--warning303 :config err))) (let ((elapsed (float-time (time-subtract (current-time) now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Configuring package consult-omni" elapsed) (message "%s...done" "Configuring package consult-omni"))))
  (let ((now (current-time))) (message "%s..." "Configuring package consult-omni") (prog1 (condition-case err (progn (require 'consult-omni-sources) (require 'consult-omni-embark) (require 'consult-omni-brave-autosuggest) (setq consult-omni-default-interactive-command #'consult-omni-brave-autosuggest) t) ((debug error) (funcall use-package--warning303 :config err))) (let ((elapsed (float-time (time-subtract (current-time) now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Configuring package consult-omni" elapsed) (message "%s...done" "Configuring package consult-omni")))))
  (if (not (require 'consult-omni nil t)) (display-warning 'use-package (format "Cannot load %s" 'consult-omni) :error) (let ((now (current-time))) (message "%s..." "Configuring package consult-omni") (prog1 (condition-case err (progn (require 'consult-omni-sources) (require 'consult-omni-embark) (require 'consult-omni-brave-autosuggest) (setq consult-omni-default-interactive-command #'consult-omni-brave-autosuggest) t) ((debug error) (funcall use-package--warning303 :config err))) (let ((elapsed (float-time (time-subtract ... now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Configuring package consult-omni" elapsed) (message "%s...done" "Configuring package consult-omni"))))))
  (prog1 (if (not (require 'consult-omni nil t)) (display-warning 'use-package (format "Cannot load %s" 'consult-omni) :error) (let ((now (current-time))) (message "%s..." "Configuring package consult-omni") (prog1 (condition-case err (progn (require 'consult-omni-sources) (require 'consult-omni-embark) (require 'consult-omni-brave-autosuggest) (setq consult-omni-default-interactive-command #'consult-omni-brave-autosuggest) t) ((debug error) (funcall use-package--warning303 :config err))) (let ((elapsed (float-time ...))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Configuring package consult-omni" elapsed) (message "%s...done" "Configuring package consult-omni")))))) (let ((elapsed (float-time (time-subtract (current-time) now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Loading package consult-omni" elapsed) (message "%s...done" "Loading package consult-omni"))))
  (let ((now (current-time))) (message "%s..." "Loading package consult-omni") (prog1 (if (not (require 'consult-omni nil t)) (display-warning 'use-package (format "Cannot load %s" 'consult-omni) :error) (let ((now (current-time))) (message "%s..." "Configuring package consult-omni") (prog1 (condition-case err (progn (require ...) (require ...) (require ...) (setq consult-omni-default-interactive-command ...) t) ((debug error) (funcall use-package--warning303 :config err))) (let ((elapsed ...)) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Configuring package consult-omni" elapsed) (message "%s...done" "Configuring package consult-omni")))))) (let ((elapsed (float-time (time-subtract (current-time) now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Loading package consult-omni" elapsed) (message "%s...done" "Loading package consult-omni")))))
  (lambda nil (let ((now (current-time))) (message "%s..." "Loading package consult-omni") (prog1 (if (not (require 'consult-omni nil t)) (display-warning 'use-package (format "Cannot load %s" 'consult-omni) :error) (let ((now (current-time))) (message "%s..." "Configuring package consult-omni") (prog1 (condition-case err (progn ... ... ... ... t) (... ...)) (let (...) (if ... ... ...))))) (let ((elapsed (float-time (time-subtract ... now)))) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Loading package consult-omni" elapsed) (message "%s...done" "Loading package consult-omni"))))))()
  eval-after-load-helper("/home/b0ef/.emacs.d/straight/build/consult/consult...")
  do-after-load-evaluation("/home/b0ef/.emacs.d/straight/build/consult/consult...")
  require(consult)
  byte-code("\300\301!\210\300\302!\210\300\303!\210\304\305\306\307\310\311\310\312\310\301\310\313\310\314\315\316&\17\210\317\320\321\322\323DD\324\325\326%\210\317\327\321\322\330DD..." [require consult url url-queue custom-declare-group consult-omni nil "Consulting omni sources" :group convenience minibuffer web search :prefix "consult-omni-" custom-declare-variable consult-omni-sources-modules-to-load funcall function #f(compiled-function () #<bytecode 0x19800016fe914>) "List of source modules/features to load.\n\nThis var..." :type (repeat :tag "list of source modules/features to load" symbol) consult-omni-intereactive-commands-type #f(compiled-function () #<bytecode 0x19800017fa314>) "Type of interactive commands to make?.\n\nThis varia..." (choice (const :tag "(Default) Make both static and dynamic commands" 'both) (const :tag "Only make DYNAMIC interactive commands" 'dynamic) (const :tag "Only make STATIC interactive commands" 'static)) consult-omni-default-browse-function #f(compiled-function () #<bytecode 0x1f9e042142f094>) "consult-omni default function when selecting a lin..." (choice (function :tag "(Default) Browse URL" browse-url) (function :tag "Custom Function")) consult-omni-default-new-function #f(compiled-function () #<bytecode 0x1980ac0051f94>) "default function when selecting a non-existing new..." (choice (function :tag "(Default) Search in External Browser" consult-omni-external-search) (function :tag "Custom Function")) consult-omni-alternate-browse-function #f(compiled-function () #<bytecode 0x1f9e04214262d4>) (choice (function :tag "(Default) EWW" eww-browse-url) (function :tag "Custom Function")) consult-omni-default-search-engine #f(compiled-function () #<bytecode 0x19800016fe914>) "Consult-omni's default search engine name" (choice (string :tag "Bing" "Bing") (string :tag "Brave" "Brave") (string :tag "DuckDuckGo" "DuckDuckGo") (string :tag "Google" "Google") (string :tag "Perplexity" "Perplexity") (string :tag "PubMed" "PubMed") (string :tag "Wikipedia" "Wikipedia") (string :tag "YouTube" "YouTube")) consult-omni-default-preview-function #f(compiled-function () #<bytecode 0x1f9e04214262d4>) "consult-omni default function when previewing a li..." (choice (function :tag "(Default) EWW" eww-browse-url) (function :tag "Custom Function")) consult-omni-show-preview #f(compiled-function () #<bytecode 0x19800016fe914>) "Should`consult-omni' show previews?\nThis turns pre..." boolean ...] 16)
  require(consult-omni)
  require(consult-omni-sources)
  elisp--eval-last-sexp(nil)
  #<subr eval-last-sexp>(nil)
  apply(#<subr eval-last-sexp> nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)
armindarvish commented 4 months ago

@madorian Well, first things first, follow the template for filing an issue, so I can see how you are installing the package etc. But with the limited info I have from your post, it seems like there is something wrong with your consult (and or embark) installation. Do those work just fine (without consult-omni)?

rileyrg commented 4 months ago

Just as a sign of solidarity, and I dont have ghe time now to further investigate, I tried a quick look and it failed too. My config:

(use-package consult-omni
    :straight (consult-omni :type git :host github :repo "armindarvish/consult-omni" :files (:defaults "sources/*.el"))
    :after consult
    :config
  (require 'consult-omni-sources)
  (require 'consult-omni-wikipedia)
    )

I type something in and just get

apply: Args out of range: [], 0

Everything's up to date on emacs 29.4

GNU Emacs 29.4 Development version 6a299b3caceb on HEAD branch; build date 2024-07-19.

Maybe I'll try to look deeper later. But this was one of about three configs I tried from the git page and none worked, all giving the same error.

Backtrace:

Debugger entered--Lisp error: (args-out-of-range [] 0) (consult-omni--multi-lookup [] "#hello" nil "#hello" nil) (apply consult-omni--multi-lookup ([] "#hello" nil "#hello" nil)) (#f(compiled-function (&rest args2) #<bytecode -0xae282a1aa6a663f>) "#hello" nil "#hello" nil) (#f(compiled-function (narrow input cand) #<bytecode -0xcce2d72c3933eeb>) nil "#hello" "#hello") (consult--with-preview-1 (:predicate # :keys nil) nil #f(compiled-function (narrow input cand) #<bytecode -0xcce2d72c3933eeb>) #f(compiled-function (&rest args2) #<bytecode -0x1aaa412383c063f>) consult-omni--search-history #f(compiled-function () #<bytecode 0x15c95cf9ee5307f3>)) (consult--read-1 #f(compiled-function (action) #<bytecode 0x14d233ef3569c5c1>) :prompt #("[consult-omni-multi] Search: " 1 19 (face consult-omni-prompt-face)) :sort t :require-match nil :history (:input consult-omni--search-history) :add-history ("#Desktop" "range") :initial "#" :sort nil :history (:input consult-omni--search-history) :initial "#" :category multi-category :predicate #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa66a63f>) :annotate #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa5be63f>) :group #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa7f263f>) :lookup #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa6a663f>) :preview-key (:predicate # :keys nil) :narrow nil :state nil :prompt "Select: " :preview-key any :sort t :lookup #) (consult--read #f(compiled-function (action) #<bytecode 0x14d233ef3569c5c1>) :prompt #("[consult-omni-multi] Search: " 1 19 (face consult-omni-prompt-face)) :sort t :require-match nil :history (:input consult-omni--search-history) :add-history ("#Desktop" "range") :initial "#" :sort nil :history (:input consult-omni--search-history) :initial "#" :category multi-category :predicate #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa66a63f>) :annotate #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa5be63f>) :group #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa7f263f>) :lookup #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa6a663f>) :preview-key (:predicate # :keys nil) :narrow nil :state nil) (apply consult--read #f(compiled-function (action) #<bytecode 0x14d233ef3569c5c1>) (:prompt #("[consult-omni-multi] Search: " 1 19 (face consult-omni-prompt-face)) :sort t :require-match nil :history (:input consult-omni--search-history) :add-history ("#Desktop" "range") :initial "#" :sort nil :history (:input consult-omni--search-history) :initial "#" :category multi-category :predicate #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa66a63f>) :annotate #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa5be63f>) :group #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa7f263f>) :lookup #f(compiled-function (&rest args2) #<bytecode -0xae282a1aa6a663f>) :preview-key (:predicate # :keys nil) :narrow nil :state nil)) (consult-omni--multi-dynamic nil nil :prompt #("[consult-omni-multi] Search: " 1 19 (face consult-omni-prompt-face)) :sort t :require-match nil :history (:input consult-omni--search-history) :add-history ("#Desktop" "range") :initial "#") (consult-omni-multi) (apply consult-omni-multi nil) (consult-omni) (funcall-interactively consult-omni) (command-execute consult-omni record) (execute-extended-command nil "consult-omni" nil) (funcall-interactively execute-extended-command nil "consult-omni" nil) (command-execute execute-extended-command)

This from an interactive, minibuffer call to "consult-omni".

armindarvish commented 4 months ago

This is a bit confusing! The original error was about showing (void-function static-if). Is that resolved now?

In the most recent example you posted above, why are you calling consult-omni instead of consult-omni-wikipedia?

Did you set your default interactive command to wikipedia? i.e.:

(setq consult-omni-default-interactive-command #'consult-omni-wikipedia)

Also, the config you posted above is not one of the "drop-in" examples, did you try any of those configs exactly as they are?

armindarvish commented 3 months ago

Closing this since there is no update!

pmiddend commented 1 month ago

I'm actually struggling with this as well. I get the same apply: Args out of range: [], 0 error and am not sure how to debug this any further. Advice?

armindarvish commented 1 month ago

@pmiddend Same questions as above. Tell me how you are installing the package and what's your setup and the questions I asked from the other user above. I cannot help without knowing what you are doing!

pmiddend commented 1 month ago

Okay, I get that, sorry for being presumptuous.

So to keep it light, I cloned the repository (I already have consult + embark installed) opened consult-omni.el and simply did M-x eval-buffer. I then did the same for sources/consult-omni-sources.el, but that didn't get me any sources.

I then explicitly opened the wikipedia.el file and eval-buffered it. That gave me consult-omni-wikipedia at least, but when I open that I get:

uncompressing publicsuffix.txt.gz...done
let: Invalid regexp: "Unmatched [ or [^" [2 times]
Error in post-command-hook (ido-cr+-schedule-dynamic-collection-update): (args-out-of-range #<buffer  *Minibuf-1*> 34 41)
armindarvish commented 1 month ago

@pmiddend I cannot be sure, but it looks like you are using ido and for some reason that is causing an issue with the minibuffer name. So first question is: Do other consult commands work fine? (for example if you run consult-grep what do you see?)

If consult works fine, then can you do this:

After running eval-buffer on those ".el" files you mentioned before:

  1. Run M-x toggle-debug-on-error
  2. Run this code:
(require 'consult-omni)
(require 'consult-omni-sources)
(require 'consult-omni-wikipedia)
(setq consult-omni-log-level 'debug)
  1. Then dp M-x consult-omni-wikipedia

And if you get errors at any point in the process, put the backtrace (contents of *Backtrace* buffer) here.