corfu and ESS: accessing list elements without having first to select list #451
Replies: 3 comments 5 replies
-
The more I think about it, the more I think the problem is due to |
Beta Was this translation helpful? Give feedback.
-
Hi, (defun mpger/cape-capf-ess ()
(dolist (elmnt
(mapcar #'cape-company-to-capf
(list #'company-R-library #'company-R-args #'company-R-objects)))
(add-to-list 'completion-at-point-functions elmnt))
(setq-local orderless-matching-styles '(orderless-literal))) ;; default is '(orderless-literal orderless-regexp)
(use-package cape
:hook
(ess-r-mode . mpger/cape-capf-ess)) So, at the end of the day, to get the intended behavior I had to locally disable I guess that would be a substantial amount of work for a corner case, this is the reason I prefer to ask directly here instead of 'polluting' the issue tracker of |
Beta Was this translation helpful? Give feedback.
-
Max Pger ***@***.***> writes:
So, at the end of the day, to get the intended behavior I had to locally disable `orderless-regexp` matching style.
However, this is unfortunate because this is a pretty cool functionality of
`orderless`. @minad would it be worth to add a feature request to `orderless`,
like a custom variable allowing to exclude `$` from the metacharacters in order
to keep `orderless-regexp` as a matching style?
I don't think it would be worth it. But you can probably already achieve
your desired result with a custom Orderless matching style or style
dispatcher.
|
Beta Was this translation helpful? Give feedback.
-
Hi @minad,
I've tried
corfu
witheglot
, works pretty well (amazing work, as always).I decided to give it a try with
ESS
, which relies on CAPF + some Company-specific backends (so I also took that as an opportunity to trycape
; also a really cool package).In R, dataframes are named lists, and their elements (i.e. features/columns/variables) can be accessed using the
$
operator.In the example below, I consider
iris
, a builtin dataset, but the result is the same if I assign it tofoo
orbar
.With Company, I can type (in one shot)
iris$
, and the popup will suggests the different elements it contains:However, I failed to have Corfu behaving the same way. If I type
iris$
in one shot, Corfu will only suggest the corresponding object candidate, that is,iris
. I then have to select it, and then use the$
operator to have Corfu suggesting the different elements of the list:I tried to play with
corfu-preselect
, but didn't succeed to get the desired behavior. Same when I tried to change the order the different backends were added tocompletion-at-point-functions
viacape-company-to-capf
.Is there a way to make
corfu
behave the waycompany
does? Could my problem be due to the fact thatcorfu
treats as$
as the regex metacharacter?Thanks a lot for the great work!
Best,
M
Emacs 29.3
Corfu 20240409.438 (Melpa)
Cape 20240411.2207 (Melpa)
Beta Was this translation helpful? Give feedback.
All reactions