radian-software / prescient.el

☄️ Simple but effective sorting and filtering for Emacs.
MIT License
614 stars 25 forks source link

can't dynamically change prescient-filter-method for org-refile #146

Open aspiers opened 1 year ago

aspiers commented 1 year ago

In #83 I was hoping to achieve a mechanism where I can automatically set prescient-filter-method according to the current completion context (e.g. the command which invoked completion).

I finally got round to trying out the solution kindly provided by @peterstuart in #110, and while I see it calling the prescient-filter-method function, I can't see any way to test whether the command invoking completion was org-refile. this-command is set to self-insert-command; completion-category evaluates to nil, current-minibuffer-command is set to nil.

Am I missing something, or does this mechanism simply not provide enough context to detect when certain commands such as org-refile are invoking completion?

okamsn commented 1 year ago

I haven't tried it, but maybe Vertico Multiform Mode would work? See https://github.com/minad/vertico#configure-vertico-per-command-or-completion-category.

They give an example that seems to suggest that it would work:

;; Change the default sorting function.
;; See `vertico-sort-function' and `vertico-sort-override-function'.
(setq vertico-multiform-commands
      '((describe-symbol (vertico-sort-function . vertico-sort-alpha))))

Regardless, you might be interested in how they are detecting commands.

aspiers commented 1 year ago

Thanks! I think I should try migrating to vertico anyway.