Open progfolio opened 1 year ago
shrug That looks to me like a problem with Helm, not with org-ql-find
.
Anyway, if you're using Helm, you could just use helm-org-ql
, right?
It's due to the way org-ql-completing-read
let-binds completion-styles-alist
. Changing the binding so that it appends the org-ql-completing-read
cell to the front of the alist prevents the error and allows helm to work with org-ql-find
directly.
One aspect that would need more work, though, is the annotations/affixations are off. I'd have to look into it more to see how to deal with that, but if we could figure that out, it may obviate the need for helm-org-ql.
Ok, thanks, I'll look at this again. Maybe I can get that fix in for v0.7.1.
I'm on vanilla Emacs 28.1 with helm as my completion framework, but unlike progfolio I have helm-completion-style set to 'helm, not to 'emacs. I recently installed org-ql and helm-org-ql from Melpa. The helm-org-ql commands all worked, but none of the org-ql-find commands did anything and no error messages appeared either. The only other one that didn't do anything was the org-ql-refile command. The rest of the org-ql commands did work. Thanks for your work on this great addition to org mode.
Going to target this for v0.8 (or possibly a v0.7.3).
It's due to the way
org-ql-completing-read
let-bindscompletion-styles-alist
. Changing the binding so that it appends theorg-ql-completing-read
cell to the front of the alist prevents the error and allows helm to work withorg-ql-find
directly.
This let-binding also breaks recursive minibuffers. M-x org-ql-find RET followed by C-x b *M TAB complains about invalid completion style (basic in my case) as shown in OP. I use the default Emacs completion framework.
It's due to the way
org-ql-completing-read
let-bindscompletion-styles-alist
. Changing the binding so that it appends theorg-ql-completing-read
cell to the front of the alist prevents the error and allows helm to work withorg-ql-find
directly.One aspect that would need more work, though, is the annotations/affixations are off. I'd have to look into it more to see how to deal with that, but if we could figure that out, it may obviate the need for helm-org-ql.
@progfolio Thanks for that. Do you mean that, if the org-ql-completing-read
style is added to the front of completion-styles-alist
rather than replacing it, annotations and affixations don't work?
@vizs Would you be able to test and confirm whether that solution seems to work?
Adam Porter @.***> writes:
@progfolio Thanks for that. Do you mean that, if the org-ql-completing-read style is added to the front of completion-styles-alist rather than replacing it, annotations and affixations don't work?
That was the case at the time of that comment. Helm has had quite a few commits since then, so I'm not sure if that's still the case.
Oh, you mean it only broke annotations and affixations on Helm? I thought you meant on Vertico.
I don't use Vertico, so I'm not sure how it works there.
For @vizs's problem with recursive minibuffers I think it should work to use setq-local
in the minibuffer on completion-styles
rather than binding it with let
.
Sorry for the late reply, prepending org-ql-completing-read completion-style to completion-style-alist fixes my problem. The diff below is what I use on my end to fix the issue.
diff --git a/org-ql-completing-read.el b/org-ql-completing-read.el
index 1bc6265..84d6996 100644
--- a/org-ql-completing-read.el
+++ b/org-ql-completing-read.el
@@ -279,7 +279,8 @@ single predicate)."
(setf buffers-files (list buffers-files)))
(mapc #'org-ql--ensure-buffer buffers-files)
(let* ((completion-styles '(org-ql-completing-read))
- (completion-styles-alist (list (list 'org-ql-completing-read #'try #'all "Org QL Find")))
+ (completion-styles-alist (cons (list 'org-ql-completing-read #'try #'all "Org QL Find")
+ completion-styles-alist))
(selected (completing-read prompt #'collection nil t)))
;; (debug-message "SELECTED:%S KEYS:%S" selected (hash-table-keys table))
(or (gethash selected table)
Unfortunately, I can't get this to work with Helm with either the emacs
or helm
value for helm-completion-style
, so I'll have to defer fixing this to a later version. Any further help here is welcome. Thanks.
If I set the buffer-local value of completion-styles
,
(setq-local completion-styles '(basic partial-completion))
org-ql-find
fails for me with the following error:
Error in post-command-hook (vertico--exhibit): (error "Invalid completion style orderless")
My global value of completion-styles
is (orderless partial-completion basic)
.
I set completion-styles
buffer-locally in some buffers for faster completions, this approach is recommended in the Corfu readme.
Mentioning this here instead of in a new thread since the cause of the problem is the same: let-binding completion-styles-alist instead of prepending to it. Progfolio's suggestion above fixes it:
It's due to the way org-ql-completing-read let-binds completion-styles-alist. Changing the binding so that it appends the org-ql-completing-read cell to the front of the alist prevents the error and allows helm to work with org-ql-find directly.
Originally posted by @progfolio in https://github.com/alphapapa/org-ql/issues/284#issuecomment-1463934195
Bisected my helm configuration. Reliably reproducable on my end when the
helm-completion-style
option is set to'emacs
. Leaving that option at its default value prevents the error, but theorg-ql-find
candidate list is empty.