mclear-tools / consult-notes

Use consult to search notes
GNU General Public License v3.0
164 stars 15 forks source link

consult-notes crash with consult-notes-history args-out-of-range #69

Closed alperenkose closed 2 months ago

alperenkose commented 3 months ago

Hi,

I want to work with consult-notes for denote but I'm not able to open it as it crashes with the following error when I try to run. I tried downgrading helm and consult packages but it didn't help. I'm a dummy at emacs lisp. Could you please help what could be the problem?

helm-M-x-execute-command: In ‘consult-notes History’ source: ‘#[0 \304\302\300\305\303$\211\205\306\307\310\301""\207 [#[128 \302\300\303\301""\207 [consult--multi-predicate ([]) apply append] 6 

(fn &rest ARGS2)]  consult-notes-history nil helm-comp-read-get-candidates nil delete  helm-cr-default] 6]’ 
 (args-out-of-range [] 0)

Thanks,

mclearc commented 3 months ago

Hi @alperenkose -- I suspect that the issue is that consult works only with a particular set of completions systems (see here) and helm isn't one of them. So if you want to use consult-notes, you'd have to turn off helm-mode and either use icomplete (which is built-into emacs) or one of the other supported systems (e.g. I use vertico).

alperenkose commented 3 months ago

Oh sorry for being dumb, it works if I disable helm-mode :) Is it possible to bypass helm or set specific completion system for a command like "consult-notes" in this case?

mclearc commented 2 months ago

hi @alperenkose -- I'm not sure if you still need to figure this out but something like the below should work (though I have not tested it!)

(defun toggle-denote-and-completion-backends ()
  "Toggle between Helm and Vertico/Consult/Consult-notes setups and call Denote."
  (interactive)
  (if (bound-and-true-p helm-mode)
      (progn
        ;; Disable Helm
        (helm-mode -1)
        (helm-projectile-off)
        ;; Enable Vertico, Consult, and Consult-notes
        (vertico-mode 1)
        (consult-notes-mode 1)
        ;; Call Denote
        (denote))
    (progn
      ;; Disable Vertico, Consult, and Consult-notes
      (vertico-mode -1)
      (consult-notes-mode -1)
      ;; Enable Helm
      (helm-mode 1)
      (helm-projectile-on). ;; only if you use projectile...
      ;; Call Denote
      (denote))))