unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* RE: [h-e-w] emacs grep on Windows
       [not found] ` <AF4AE27C841A4802B788F19EDBAB2EC3@us.oracle.com>
@ 2010-10-05 22:32   ` Drew Adams
  2010-10-05 22:37     ` Lennart Borgman
  0 siblings, 1 reply; 2+ messages in thread
From: Drew Adams @ 2010-10-05 22:32 UTC (permalink / raw)
  To: 'Kenneth Goldman', 'Emacs mailing list'
  Cc: help-emacs-windows

Sorry.  Resending my reply with clearer quoting of your post, and redirecting to
help-gnu-emacs (this is not really Windows-specific).

> I use igrep, but it seems to be broken on Windows with emacs 23.
> I'd like to switch to grep. 
> 	
> The manual says: 
>  If you specify a prefix argument for M-x grep, it finds the tag ... 
> 	
> There's no sample code for how to actually set the prefix 
> argument.  I know I can type C-u every time, but how do I
> assign it to a key (global-set-key)? 

C-u is a key. ;-)

Many commands that change their behavior based on a prefix 
arg use the prefix arg as one of their arguments.  E.g.:

(defun foo (arg)
  (interactive "P)
  ;; Do something according to the value of ARG,
  ;; which is the same as variable `current-prefix-arg'.
  )

If that is the case, and you want a command that _always_ 
performs `foo' as if you had used `C-u' interactively, you
can write a command that does that:

(defun my-foo ()
  (interactive)
  (foo arg))

In some cases it is a bit more involved than that.  For 
example, `foo' might do things differently depending on
whether it is called interactively or from Lisp.

More germane to your question, `foo' (`grep' in this case) 
might not provide any argument that corresponds one-to-one
with the `current-prefix-arg'.  You need to look at the source
code for the command to see how it works interactively.

In the case of `grep', you can do this to get what you want:

(defun my-grep ()
  "..."
  (interactive)
  (let ((current-prefix-arg  t))
    (call-interactively #'grep)))

HTH.

You might also be interested in the version of Emacs `grep'	
provided by library `grep+.el'.
http://www.emacswiki.org/emacs/GrepPlus
http://www.emacswiki.org/emacs/grep%2b.el




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

* Re: [h-e-w] emacs grep on Windows
  2010-10-05 22:32   ` [h-e-w] emacs grep on Windows Drew Adams
@ 2010-10-05 22:37     ` Lennart Borgman
  0 siblings, 0 replies; 2+ messages in thread
From: Lennart Borgman @ 2010-10-05 22:37 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-emacs-windows, Emacs mailing list, Kenneth Goldman

> You might also be interested in the version of Emacs `grep'
> provided by library `grep+.el'.
> http://www.emacswiki.org/emacs/GrepPlus
> http://www.emacswiki.org/emacs/grep%2b.el

I believe someone also mentioned the new builtin commands lgrep and
rgrep in Emacs as alternatives.



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

end of thread, other threads:[~2010-10-05 22:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <OFCD5BE2EA.1E6A44BD-ON862577B3.0074243D-862577B3.0074B442@us.ibm.com>
     [not found] ` <AF4AE27C841A4802B788F19EDBAB2EC3@us.oracle.com>
2010-10-05 22:32   ` [h-e-w] emacs grep on Windows Drew Adams
2010-10-05 22:37     ` Lennart Borgman

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