unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* M-x grep prompt: fill in the * for us
@ 2003-06-18 18:18 Dan Jacobson
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Jacobson @ 2003-06-18 18:18 UTC (permalink / raw)


How about when prompting for M-x grep,
    Run grep (like this): grep -n -e
You instead prompt with
    Run grep (like this): grep -n -e X *
with the cursor placed where I've put the X
because otherwise we often forget to fill in the *,
which is often what we want.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: M-x grep prompt: fill in the * for us
       [not found] <mailman.8194.1055972915.21513.bug-gnu-emacs@gnu.org>
@ 2003-06-18 23:43 ` Kevin Rodgers
       [not found] ` <mailman.8205.1055979983.21513.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Kevin Rodgers @ 2003-06-18 23:43 UTC (permalink / raw)


Dan Jacobson wrote:

> How about when prompting for M-x grep,
>     Run grep (like this): grep -n -e
> You instead prompt with
>     Run grep (like this): grep -n -e X *


Even better would be *.foo, where foo is the extension of the visited file.

> with the cursor placed where I've put the X
> because otherwise we often forget to fill in the *,
> which is often what we want.


-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: M-x grep prompt: fill in the * for us
       [not found] ` <mailman.8205.1055979983.21513.bug-gnu-emacs@gnu.org>
@ 2003-06-19  0:09   ` Johan Bockgård
  2003-06-19  5:05     ` Dan Jacobson
       [not found]     ` <mailman.8224.1056013350.21513.bug-gnu-emacs@gnu.org>
       [not found]   ` <mailman.8208.1055981544.21513.bug-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 9+ messages in thread
From: Johan Bockgård @ 2003-06-19  0:09 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Dan Jacobson wrote:
>
>> How about when prompting for M-x grep,
>>     Run grep (like this): grep -n -e
>> You instead prompt with
>>     Run grep (like this): grep -n -e X *
>
> Even better would be *.foo, where foo is the extension of the visited file.

And that's what C-u M-x grep already does.

-- 
The day Microsoft makes something that doesn't suck is probably the
day they start making vacuum cleaners. -- Ernst Jan Plugge

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: M-x grep prompt: fill in the * for us
  2003-06-19  0:09   ` Johan Bockgård
@ 2003-06-19  5:05     ` Dan Jacobson
       [not found]     ` <mailman.8224.1056013350.21513.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Dan Jacobson @ 2003-06-19  5:05 UTC (permalink / raw)


J> And that's what C-u M-x grep already does.

Hmmm, like nifteaux (nifto (nifty)).  OK, I wish C-u M-x compile would
notice current target the cursor is in in a makefile and use that as
the default argument for make.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: M-x grep prompt: fill in the * for us
       [not found]   ` <mailman.8208.1055981544.21513.bug-gnu-emacs@gnu.org>
@ 2003-06-19  8:39     ` Hanak David
       [not found]     ` <mailman.8223.1056011968.21513.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Hanak David @ 2003-06-19  8:39 UTC (permalink / raw)


On Thu, 19 Jun 2003, Johan Bockgård wrote:

> Kevin Rodgers <ihs_4664@yahoo.com> writes:
>
>> Dan Jacobson wrote:
>>
>>> How about when prompting for M-x grep,
>>>     Run grep (like this): grep -n -e
>>> You instead prompt with
>>>     Run grep (like this): grep -n -e X *
>>
>> Even better would be *.foo, where foo is the extension of the visited file.
>
> And that's what C-u M-x grep already does.

Not really.

,----[ C-h f grep RET ]
| [...]
| A prefix argument says to default the argument based upon the current
| tag the cursor is over, substituting it into the last grep command
| in the grep command history (or into `grep-command'
| if that history list is empty).
`----

Dan's request deals with the filename, not with the pattern.

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: M-x grep prompt: fill in the * for us
       [not found]     ` <mailman.8223.1056011968.21513.bug-gnu-emacs@gnu.org>
@ 2003-06-19 16:43       ` Kevin Rodgers
  0 siblings, 0 replies; 9+ messages in thread
From: Kevin Rodgers @ 2003-06-19 16:43 UTC (permalink / raw)


Hanak David wrote:

> On Thu, 19 Jun 2003, Johan Bockgård wrote:
>>Kevin Rodgers <ihs_4664@yahoo.com> writes:
>>>Even better would be *.foo, where foo is the extension of the visited file.
>>>
>>And that's what C-u M-x grep already does.
> 
> Not really.
> 
> ,----[ C-h f grep RET ]
> | [...]
> | A prefix argument says to default the argument based upon the current
> | tag the cursor is over, substituting it into the last grep command
> | in the grep command history (or into `grep-command'
> | if that history list is empty).
> `----
> 
> Dan's request deals with the filename, not with the pattern.

Even though the doc string doesn't mention it, the file name pattern defaults
as desired as well (when a prefix arg is specified).

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: M-x grep prompt: fill in the * for us
       [not found]     ` <mailman.8224.1056013350.21513.bug-gnu-emacs@gnu.org>
@ 2003-06-19 17:44       ` Kevin Rodgers
  2003-06-19 21:41         ` Dan Jacobson
       [not found]         ` <mailman.8311.1056096299.21513.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Kevin Rodgers @ 2003-06-19 17:44 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

Dan Jacobson wrote:

> J> And that's what C-u M-x grep already does.
> 
> Hmmm, like nifteaux (nifto (nifty)).  OK, I wish C-u M-x compile would
> notice current target the cursor is in in a makefile and use that as
> the default argument for make.

Ask and ye shall receive...


-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

[-- Attachment #2: compile.el.patch --]
[-- Type: text/plain, Size: 3016 bytes --]

*** /usr/local/emacs-21.3/lisp/progmodes/compile.el	Fri Jan 17 06:45:11 2003
--- /usr/tmp/kevinr/compile.el	Thu Jun 19 11:35:33 2003
***************
*** 571,577 ****
  and move to the source code that caused it.
  
  Interactively, prompts for the command if `compilation-read-command' is
! non-nil; otherwise uses `compile-command'.  With prefix arg, always prompts.
  
  To run more than one compilation at once, start one and rename the
  \`*compilation*' buffer to some other name with \\[rename-buffer].
--- 571,578 ----
  and move to the source code that caused it.
  
  Interactively, prompts for the command if `compilation-read-command' is
! non-nil; otherwise uses `compile-command'.  With prefix arg, append the
! default target to `compile-command'.
  
  To run more than one compilation at once, start one and rename the
  \`*compilation*' buffer to some other name with \\[rename-buffer].
***************
*** 581,596 ****
  the function in `compilation-buffer-name-function', so you can set that
  to a function that generates a unique name."
    (interactive
!    (if (or compilation-read-command current-prefix-arg)
         (list (read-from-minibuffer "Compile command: "
!                                  (eval compile-command) nil nil
!                                  '(compile-history . 1)))
!      (list (eval compile-command))))
    (unless (equal command (eval compile-command))
      (setq compile-command command))
    (save-some-buffers (not compilation-ask-about-save) nil)
    (compile-internal command "No more errors"))
  
  ;; run compile with the default command line
  (defun recompile ()
    "Re-compile the program including the current buffer."
--- 582,614 ----
  the function in `compilation-buffer-name-function', so you can set that
  to a function that generates a unique name."
    (interactive
!    (if compilation-read-command
         (list (read-from-minibuffer "Compile command: "
! 				   (eval compile-command) nil nil
! 				   '(compile-history . 1)))
!      (if current-prefix-arg
! 	   (list (concat (eval compile-command)
! 			 " "
! 			 (or compile-default-target "")))
!        (list (eval compile-command)))))
    (unless (equal command (eval compile-command))
      (setq compile-command command))
    (save-some-buffers (not compilation-ask-about-save) nil)
    (compile-internal command "No more errors"))
  
+ (defun compile-default-target ()
+   "Return the default target for `compile'."
+   (cond ((eq major-mode 'makefile-mode)
+ 	 (save-excursion
+ 	   (if (re-search-backward makefile-dependency-regex nil t)
+ 	       (match-string 1))))
+ 	(buffer-file-name		; generate an executable name:
+ 	 (file-name-sans-extension (file-name-nondirectory buffer-file-name)))
+ 	(t				; see grep:
+ 	 (funcall (or find-tag-default-function
+ 		      (get major-mode 'find-tag-default-function)
+ 		      'grep-tag-default)))))
+ 
  ;; run compile with the default command line
  (defun recompile ()
    "Re-compile the program including the current buffer."

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: M-x grep prompt: fill in the * for us
  2003-06-19 17:44       ` Kevin Rodgers
@ 2003-06-19 21:41         ` Dan Jacobson
       [not found]         ` <mailman.8311.1056096299.21513.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Dan Jacobson @ 2003-06-19 21:41 UTC (permalink / raw)


>> Hmmm, like nifteaux (nifto (nifty)).  OK, I wish C-u M-x compile
>> would notice current target the cursor is in in a makefile and use that as
>> the default argument for make.

K> Ask and ye shall receive...

K> *** /usr/local/emacs-21.3/lisp/progmodes/compile.el	Fri Jan 17 06:45:11 2003
K> --- /usr/tmp/kevinr/compile.el	Thu Jun 19 11:35:33 2003

OK, that's nice, but it just flits by on the screen here.  Unless
RMS&co. captures it as it flits by, otherwise it is just for sport.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: M-x grep prompt: fill in the * for us
       [not found]         ` <mailman.8311.1056096299.21513.bug-gnu-emacs@gnu.org>
@ 2003-06-20 14:25           ` Kevin Rodgers
  0 siblings, 0 replies; 9+ messages in thread
From: Kevin Rodgers @ 2003-06-20 14:25 UTC (permalink / raw)


Dan Jacobson wrote:

>>>Hmmm, like nifteaux (nifto (nifty)).  OK, I wish C-u M-x compile
>>>would notice current target the cursor is in in a makefile and use that as
>>>the default argument for make.
>>>
> 
> K> Ask and ye shall receive...
> 
> K> *** /usr/local/emacs-21.3/lisp/progmodes/compile.el	Fri Jan 17 06:45:11 2003
> K> --- /usr/tmp/kevinr/compile.el	Thu Jun 19 11:35:33 2003
> 
> OK, that's nice, but it just flits by on the screen here.  Unless
> RMS&co. captures it as it flits by, otherwise it is just for sport.

Hmmm, there was 1 embarrassing bug:


592c592
< 	 
	 (or compile-default-target "")))
---
 > 			 (or (compile-default-target) "")))

And of course compilation-read-command has to be nil for it to be exercised.

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-06-20 14:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.8194.1055972915.21513.bug-gnu-emacs@gnu.org>
2003-06-18 23:43 ` M-x grep prompt: fill in the * for us Kevin Rodgers
     [not found] ` <mailman.8205.1055979983.21513.bug-gnu-emacs@gnu.org>
2003-06-19  0:09   ` Johan Bockgård
2003-06-19  5:05     ` Dan Jacobson
     [not found]     ` <mailman.8224.1056013350.21513.bug-gnu-emacs@gnu.org>
2003-06-19 17:44       ` Kevin Rodgers
2003-06-19 21:41         ` Dan Jacobson
     [not found]         ` <mailman.8311.1056096299.21513.bug-gnu-emacs@gnu.org>
2003-06-20 14:25           ` Kevin Rodgers
     [not found]   ` <mailman.8208.1055981544.21513.bug-gnu-emacs@gnu.org>
2003-06-19  8:39     ` Hanak David
     [not found]     ` <mailman.8223.1056011968.21513.bug-gnu-emacs@gnu.org>
2003-06-19 16:43       ` Kevin Rodgers
2003-06-18 18:18 Dan Jacobson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).