bug#36558: When the user forgets the filename when using M-x grep

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#36558: When the user forgets the filename when using M-x grep

積丹尼 Dan Jacobson
I don't think the M-x grep command has the ability for the user to
change the default prompt from the current

Run grep (like this): grep --color -nH --null -e

to the rather more sophisticated

Run grep (like this): grep --color -nH --null -e [] *

where "[]" represents where the cursor should be placed when prompting
the user.

Mentioning how to do so in (info "(emacs) Grep Searching")
or indeed, simply making it the new default, would save the 98% mistake
rate of users forgetting to add a filename and think there was no
matches (as outside of emacs this would hang without a filename,
alerting the user to the problem.)

Also M-x grep should detect that something tried to read stdin, meaning
the user forgot the filename, and then warn the user, instead of just
saying "No matches".

Currently this is a very high possibility the user will just do
Run grep (like this): grep --color -nH --null -e STRING
and forget FILENAMEs
creating an impossible situation, for which emacs currently just treats
as if the user did
Run grep (like this): grep --color -nH --null -e STRING /dev/null
which helps nobody.
At least emacs should catch this situation.



Reply | Threaded
Open this post in threaded view
|

bug#36558: When the user forgets the filename when using M-x grep

Lars Ingebrigtsen
積丹尼 Dan Jacobson <[hidden email]> writes:

> I don't think the M-x grep command has the ability for the user to
> change the default prompt from the current
>
> Run grep (like this): grep --color -nH --null -e
>
> to the rather more sophisticated
>
> Run grep (like this): grep --color -nH --null -e [] *
>
> where "[]" represents where the cursor should be placed when prompting
> the user.

I virtually never want to grep all files in a directory, so having to
hit `C-k' first would be a disadvantage, I think.  And this is the kind
of interface twiddling that annoys people used to the old defaults, so
I'm closing this bug report.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#36558: When the user forgets the filename when using M-x grep

Tak Kunihiro-3
>> I don't think the M-x grep command has the ability for the user to
>> change the default prompt from the current
>>
>> Run grep (like this): grep --color -nH --null -e
>>
>> to the rather more sophisticated
>>
>> Run grep (like this): grep --color -nH --null -e [] *
>>
>> where "[]" represents where the cursor should be placed when prompting
>> the user.
>
> I virtually never want to grep all files in a directory, so having to
> hit `C-k' first would be a disadvantage, I think.  And this is the kind
> of interface twiddling that annoys people used to the old defaults, so
> I'm closing this bug report.

I had a similar thought.  I am OK now with following configuration.

(grep-apply-setting 'grep-command "grep -inHr . -e ")



Reply | Threaded
Open this post in threaded view
|

bug#36558: When the user forgets the filename when using M-x grep

積丹尼 Dan Jacobson
In reply to this post by 積丹尼 Dan Jacobson
>>>>> "LI" == Lars Ingebrigtsen <[hidden email]> writes:
LI> 積丹尼 Dan Jacobson <[hidden email]> writes:

>> I don't think the M-x grep command has the ability for the user to
>> change the default prompt from the current
>>
>> Run grep (like this): grep --color -nH --null -e
>>
>> to the rather more sophisticated
>>
>> Run grep (like this): grep --color -nH --null -e [] *
>>
>> where "[]" represents where the cursor should be placed when prompting
>> the user.

Indeed, grep.el is already so complicated...

LI> I virtually never want to grep all files in a directory, so having to

I'm the opposite.

LI> hit `C-k' first would be a disadvantage, I think.  And this is the kind
LI> of interface twiddling that annoys people used to the old defaults, so

I didn't say changing any defaults. I was asking for the "ability"...

LI> I'm closing this bug report.



Reply | Threaded
Open this post in threaded view
|

bug#36558: When the user forgets the filename when using M-x grep

Tak Kunihiro-3
>>> I don't think the M-x grep command has the ability for the user to
>>> change the default prompt from the current
>>>
>>> Run grep (like this): grep --color -nH --null -e
>>>
>>> to the rather more sophisticated
>>>
>>> Run grep (like this): grep --color -nH --null -e [] *
>>>
>>> where "[]" represents where the cursor should be placed when prompting
>>> the user.

How about something like this?

(grep-apply-setting 'grep-command (cons "grep --color -nH --null -e  *" 28))



Reply | Threaded
Open this post in threaded view
|

bug#36558: When the user forgets the filename when using M-x grep

積丹尼 Dan Jacobson
In reply to this post by 積丹尼 Dan Jacobson
>>>>> "TK" == Tak Kunihiro <[hidden email]> writes:
TK> How about something like this?
TK> (grep-apply-setting 'grep-command (cons "grep --color -nH --null -e  *" 28))

Ah! But I need something that I can put in (some grep hook in) .emacs. Something without the
flags hardwired into it. Something that just takes what grep gives me
and then adds "  *" to it and moves backwards like yours does without
hardwiring numbers. And even worth mentioning on grep's docstring too.