Subject: Re: bug#516: [PATCH] Minor Enhancement for grep.el: auto-input thesymbol into minibuffer command line.

From: Juri Linkov <[email-masked]>
Date: Sun, 06 Dec 2009 02:35:31 +0200

>> `grep-tag-default' already provides the active region. But it uses
>> `shell-quote-argument' instead of surrounding by quotes.  I don't know
>> what is better, since it's harder to edit the command when
>> `shell-quote-argument' puts a backslash before every space
>> and some other characters.
>
> Not only that, but:
>
> a. You must use M-n to put it in the minibuffer. Not a big deal, but you must
> know about this, to think to do that.

You can use `C-u grep' instead of `M-n' to put it in the minibuffer as
initial input.  However, `C-u grep' is worse than `M-n' because such use
of C-u is non-standard (unlike `M-n' that is the standard key to put the
default value in the minibuffer).

> b. A default file-name pattern (e.g. "*.el") is also included, as part of what's
> inserted.

That's what rgrep/lgrep do.  They provide a default file-name pattern
depending on the buffer's file name.

> All of that (especially the backslashing instead of quoting), makes it harder to
> edit the text to match and the file names to match.

I don't like backslashing too.

>> Another drawback of `grep-tag-default' is that it provides only
>> one alternative.  This is unlike `read-regexp' that proposes
>> a list of possible default values.  So `grep-tag-default' could be
>> improved to do the same.
>
> FWIW, the code I use inserts the (quoted) region or the symbol name nearest
> point (if no active region), and leaves out a file pattern. (You can still get
> the vanilla default using `M-n'.)

I agree it would be better to provide the active region, and the vanilla
default using `M-n'.

-- 
Juri Linkov
http://www.jurta.org/emacs/