Feature request: make consult-line treat initial empty input as symbol at point (similar to helm-occur) #848
Replies: 4 comments 24 replies
-
Thanks. That's a nice idea. Right now you can use the future history to obtain the symbol at point. I've not considered such prefilled input where the input is going away as soon as you type. This is certainly doable but differs quite a bit from the usual built-in completion command behavior and I try to avoid such deviations. Nevertheless it would be interesting to try this out. |
Beta Was this translation helpful? Give feedback.
-
I looked a bit and I agree that doing it through built-in (setq orderless-empty-input-is-matched-with "")
(defun my-completion-advice (fun string table pred _point)
(let ((string (or (and (equal string "")
orderless-empty-input-is-matched-with)
string)))
(funcall fun string table pred _point)))
(advice-add #'orderless-try-completion :around #'my-completion-advice)
(advice-add #'orderless-all-completions :around #'my-completion-advice)
(defun my-consult-line ()
(interactive)
(let ((orderless-empty-input-is-matched-with (thing-at-point 'symbol)))
(consult-line))) |
Beta Was this translation helpful? Give feedback.
-
This seems like a lot of effort just to avoid pressing |
Beta Was this translation helpful? Give feedback.
-
(new user of consult/vertico/etc here, having declared .emacs bankruptcy after 15 years of cruft accumulation and stagnation) what I understood after some digging:
( |
Beta Was this translation helpful? Give feedback.
-
Hi and thanks for the great package!
Helm has a variable called
helm-maybe-use-default-as-input
and a listhelm-sources-using-default-as-input
. Whenhelm-maybe-use-default-as-input
is non-nil or the function that's being called, i.e.helm-occur
, belongs tohelm-sources-using-default-as-input
, helm treats empty input as the symbol at point. More specifically, if the point is at the word "hello" and I runhelm-occur
, it will match all of the instances of the word "hello" in the current buffer. The moment I input a single character, it will match my input instead.Is there a way to make
consult-line
behave similarly? Currently, whenconsult-line
is called, while input is still empty, it will match all non-empty lines in the buffer. I don't think matching all non-empty lines in the current buffer is common use case.There is a partial solution in the wiki. However, it doesn't treat empty input as symbol at point, it fills the input with symbol at point. So using this means that, if I want to search for something other than the symbol at point, I have to either move the point to an empty area, or call this function and clear the minibuffer before I can start my search.
Beta Was this translation helpful? Give feedback.
All reactions