[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#516: [PATCH] Minor Enhancement for grep.el: auto-input thesymbol int

From: Drew Adams
Subject: bug#516: [PATCH] Minor Enhancement for grep.el: auto-input thesymbol into minibuffer command line.
Date: Sat, 5 Dec 2009 12:28:03 -0800

> >> > This patch is to let you input the cursor position symbol
> >> > automatically into minibuffer command line. I think it makes
> >> > us easier to use "grep-find" function.
> >>
> >> There is a function `grep-default-command' in grep.el that 
> >> does this. I wonder why it's used in `grep', but not in
> >> `grep-find'.  I think we should do the same in `grep-find'.
> >
> > Yes, and as I've suggested before, if the region is active,
> > then its contents, surrounded by "s, should be the default
> > search string. Example code:
> > http://www.emacswiki.org/emacs/grep%2b.el
> `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.

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

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

> 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'.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]