You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i would like to write a function with the following behaviour:
if corfu--total (length of the candidates list) is < to completion-cycle-threshold (defined by user), then call (corfu-next)
if a candidate is currently previewed, call (corfu-complete) (already the case)
if corfu--index is negative, call (corfu-expand) (already the case)
Here is the function i have written:
(defunt/corfu-dwim ()
"If the length of `corfu--candidates' is < to `completion-cycle-threshold',call `corfu-next'if preview, call `corfu-complete'if index < 0, call `corfu-expand'else, default behavior is `corfu-expand'"
(interactive)
(cond
((<= corfu--total completion-cycle-threshold)
(corfu-next))
((corfu--preview-current-p)
(corfu-complete))
((< corfu--index 0)
(corfu-expand ))
(t
(corfu-expand))))
This function works correctly to expand and complete.
In the case where it should call corfu-next, it correctly do so the first time, but not when we want to do it again.
If i replace (corfu-next) by
(progn
(princ corfu--index)
(corfu-next))
I can see the the first time corfu--index is 0, the second time -1 (It exits the second time)
If someone knows how i can make it work, it would be really helpful.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, i would like to write a function with the following behaviour:
Here is the function i have written:
This function works correctly to expand and complete.
In the case where it should call corfu-next, it correctly do so the first time, but not when we want to do it again.
If i replace
(corfu-next)
byI can see the the first time corfu--index is 0, the second time -1 (It exits the second time)
If someone knows how i can make it work, it would be really helpful.
Beta Was this translation helpful? Give feedback.
All reactions