bug#1863: Improved grep prompt

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

bug#1863: Improved grep prompt

積丹尼 Dan Jacobson
Regarding M-x grep, here are the current and improved prompts:
Run grep (like this): grep -nH -e
Run grep (like this): grep -nH -e [Cursor goes here] * <--and an asterisk here. I.e., @=cursor:
Run grep (like this): grep -nH -e @ *
If you use my improved prompt suggestion above, no longer will
everybody forget to add a filename, and leave thinking "no matches found".





Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

Juri Linkov
> Regarding M-x grep, here are the current and improved prompts:
> Run grep (like this): grep -nH -e
> Run grep (like this): grep -nH -e [Cursor goes here] * <--and an asterisk here. I.e., @=cursor:
> Run grep (like this): grep -nH -e @ *
> If you use my improved prompt suggestion above, no longer will
> everybody forget to add a filename, and leave thinking "no matches found".

Everybody's using rgrep and lgrep these days and never forget a filename ;-)

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




Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

積丹尼 Dan Jacobson
JL> Everybody's using rgrep and lgrep these days
Well I would make M-x grep say that then, with a an option available
for those who really want to use the old grep even after finally
learning this news.




Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

Juri Linkov
> JL> Everybody's using rgrep and lgrep these days
> Well I would make M-x grep say that then,

It already says that.
`C-h f grep RET':

    For doing a recursive `grep', see the `rgrep' command.
    For running `grep' in a specific directory, see `lgrep'.

> with a an option available for those who really want to use the old
> grep even after finally learning this news.

There is already a template option for the old `grep'.
`C-h v grep-command RET':

    grep-command is a variable defined in `grep.el'.
    Its value is "grep -nH -e *"

    Documentation:
    The default grep command for M-g r e.

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




Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

積丹尼 Dan Jacobson
JL> It already says that.
JL> `C-h f grep RET':
But nobody would look there often. All I know is I took the Tutorial
in the 80's and would never know about the two new greps unless
alerted somehow.
JL> There is already a template option for the old `grep'.
JL>     grep-command is a variable defined in `grep.el'.
JL>     Its value is "grep -nH -e *"
Ah, newer than Debian sid. OK, doing
(setq grep-command "grep -nHe *"); until emacs 23
By the way, you can combine the nH and e options to save some minibuffer.




Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

Lennart Borgman (gmail)
On Thu, Jan 15, 2009 at 1:40 AM,  <[hidden email]> wrote:
> JL> It already says that.
> JL> `C-h f grep RET':
> But nobody would look there often. All I know is I took the Tutorial
> in the 80's and would never know about the two new greps unless
> alerted somehow.

In your case I myself see nothing that can help then ;-) but I think
newbees would benefit from having all the search and replace commands
under search and replace in the edit menu.

Otherwise the wheel will be invented over and over.




Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

Juri Linkov
>> JL> It already says that.
>> JL> `C-h f grep RET':
>> But nobody would look there often. All I know is I took the Tutorial
>> in the 80's and would never know about the two new greps unless
>> alerted somehow.
>
> In your case I myself see nothing that can help then ;-) but I think
> newbees would benefit from having all the search and replace commands
> under search and replace in the edit menu.

I can't believe we still don't have these useful commands in the menu.
But why do you think they should be placed in the Edit menu?

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




Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

Lennart Borgman (gmail)
On Thu, Jan 15, 2009 at 2:27 AM, Juri Linkov <[hidden email]> wrote:

>>> JL> It already says that.
>>> JL> `C-h f grep RET':
>>> But nobody would look there often. All I know is I took the Tutorial
>>> in the 80's and would never know about the two new greps unless
>>> alerted somehow.
>>
>> In your case I myself see nothing that can help then ;-) but I think
>> newbees would benefit from having all the search and replace commands
>> under search and replace in the edit menu.
>
> I can't believe we still don't have these useful commands in the menu.
> But why do you think they should be placed in the Edit menu?

That is where the search and replace commands normally are. Why do you
doubt they should be there?




Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

Stefan Monnier
In reply to this post by 積丹尼 Dan Jacobson
You can also use C-u M-x grep.
That's what I use, personally.


        Stefan




Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

Juri Linkov
In reply to this post by Lennart Borgman (gmail)
>>> In your case I myself see nothing that can help then ;-) but I think
>>> newbees would benefit from having all the search and replace commands
>>> under search and replace in the edit menu.
>>
>> I can't believe we still don't have these useful commands in the menu.
>> But why do you think they should be placed in the Edit menu?
>
> That is where the search and replace commands normally are. Why do you
> doubt they should be there?

The `Grep' menu entry is traditionally in the Tools menu because it reads
an external command like `Compile' and `Shell Command' do.  So perhaps we
should add `rgrep' and `lgrep' to the Tools menu.

A less controversial change is to add `rgrep' and `lgrep' to the
grep mode menu:

Index: lisp/progmodes/grep.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.98
diff -u -r1.98 grep.el
--- lisp/progmodes/grep.el 5 Jan 2009 03:23:37 -0000 1.98
+++ lisp/progmodes/grep.el 16 Jan 2009 00:27:48 -0000
@@ -204,12 +204,18 @@
     (define-key map [menu-bar grep compilation-compile]
       '(menu-item "Compile..." compile
   :help "Compile the program including the current buffer.  Default: run `make'"))
+    (define-key map [menu-bar grep compilation-lgrep]
+      '(menu-item "Local grep..." lgrep
+  :help "User-friendly grep"))
+    (define-key map [menu-bar grep compilation-rgrep]
+      '(menu-item "Recursive grep..." rgrep
+  :help "User-friendly recursive grep in directory tree"))
+    (define-key map [menu-bar grep compilation-grep-find]
+      '(menu-item "Grep via Find..." grep-find
+  :help "Run grep via find, with user-specified args"))
     (define-key map [menu-bar grep compilation-grep]
       '(menu-item "Another grep..." grep
   :help "Run grep, with user-specified args, and collect output in a buffer."))
-    (define-key map [menu-bar grep compilation-grep-find]
-      '(menu-item "Recursive grep..." grep-find
-  :help "Run grep via find, with user-specified args"))
     (define-key map [menu-bar grep compilation-recompile]
       '(menu-item "Repeat grep" recompile
   :help "Run grep again"))

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




Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

Lennart Borgman (gmail)
On Fri, Jan 16, 2009 at 1:31 AM, Juri Linkov <[hidden email]> wrote:

>>>> In your case I myself see nothing that can help then ;-) but I think
>>>> newbees would benefit from having all the search and replace commands
>>>> under search and replace in the edit menu.
>>>
>>> I can't believe we still don't have these useful commands in the menu.
>>> But why do you think they should be placed in the Edit menu?
>>
>> That is where the search and replace commands normally are. Why do you
>> doubt they should be there?
>
> The `Grep' menu entry is traditionally in the Tools menu because it reads
> an external command like `Compile' and `Shell Command' do.  So perhaps we
> should add `rgrep' and `lgrep' to the Tools menu.

I think menus should see things from the users view, not from an
internal view. Emacs itself does not really care how the menus look
...

I would expect nearly all users to look for these commands in the Edit menu.




Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

richardeng
In reply to this post by Juri Linkov
Juri Linkov wrote:
In your case I myself see nothing that can help then ;-) but I think
newbees would benefit from having all the search and replace commands
under search and replace in the edit menu.
        
I can't believe we still don't have these useful commands in the menu.
But why do you think they should be placed in the Edit menu?
      
That is where the search and replace commands normally are. Why do you
doubt they should be there?
    

The `Grep' menu entry is traditionally in the Tools menu because it reads
an external command like `Compile' and `Shell Command' do.  So perhaps we
should add `rgrep' and `lgrep' to the Tools menu.

A less controversial change is to add `rgrep' and `lgrep' to the
grep mode menu:

Index: lisp/progmodes/grep.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.98
diff -u -r1.98 grep.el
--- lisp/progmodes/grep.el	5 Jan 2009 03:23:37 -0000	1.98
+++ lisp/progmodes/grep.el	16 Jan 2009 00:27:48 -0000
@@ -204,12 +204,18 @@
     (define-key map [menu-bar grep compilation-compile]
       '(menu-item "Compile..." compile
 		  :help "Compile the program including the current buffer.  Default: run `make'"))
+    (define-key map [menu-bar grep compilation-lgrep]
+      '(menu-item "Local grep..." lgrep
+		  :help "User-friendly grep"))
+    (define-key map [menu-bar grep compilation-rgrep]
+      '(menu-item "Recursive grep..." rgrep
+		  :help "User-friendly recursive grep in directory tree"))
+    (define-key map [menu-bar grep compilation-grep-find]
+      '(menu-item "Grep via Find..." grep-find
+		  :help "Run grep via find, with user-specified args"))
     (define-key map [menu-bar grep compilation-grep]
       '(menu-item "Another grep..." grep
 		  :help "Run grep, with user-specified args, and collect output in a buffer."))
-    (define-key map [menu-bar grep compilation-grep-find]
-      '(menu-item "Recursive grep..." grep-find
-		  :help "Run grep via find, with user-specified args"))
     (define-key map [menu-bar grep compilation-recompile]
       '(menu-item "Repeat grep" recompile
 		  :help "Run grep again"))

  
I think many emacs users discovery useful command from the menu instead of  searching the release notes.
I suggest to add rgrep,lgrep,grep-find to menu.


Reply | Threaded
Open this post in threaded view
|

bug#1863: Improved grep prompt

Lars Ingebrigtsen
In reply to this post by Juri Linkov
Juri Linkov <[hidden email]> writes:

>> Regarding M-x grep, here are the current and improved prompts:
>> Run grep (like this): grep -nH -e
>> Run grep (like this): grep -nH -e [Cursor goes here] * <--and an asterisk here. I.e., @=cursor:
>> Run grep (like this): grep -nH -e @ *
>> If you use my improved prompt suggestion above, no longer will
>> everybody forget to add a filename, and leave thinking "no matches found".
>
> Everybody's using rgrep and lgrep these days and never forget a filename ;-)

It seemed like nobody were enthusiastic about adding such a fix, so I'm
closing this as a "wontfix".

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