minad / consult

:mag: consult.el - Consulting completing-read
GNU General Public License v3.0
1.14k stars 99 forks source link

Feature request: make consult-line treat initial empty input as symbol at point (similar to helm-occur) #847

Closed mpedramfar closed 9 months ago

mpedramfar commented 9 months ago

Hi and thanks for the great package!

Helm has a variable called helm-maybe-use-default-as-input and a list helm-sources-using-default-as-input. When helm-maybe-use-default-as-input is non-nil or the function that's being called, i.e. helm-occur, belongs to helm-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 run helm-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, when consult-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.