From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help,gmane.emacs.windows Subject: RE: [h-e-w] emacs grep on Windows Date: Tue, 5 Oct 2010 15:32:03 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1286318013 23332 80.91.229.12 (5 Oct 2010 22:33:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 5 Oct 2010 22:33:33 +0000 (UTC) Cc: help-emacs-windows@gnu.org To: "'Kenneth Goldman'" , "'Emacs mailing list'" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 06 00:33:31 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P3G4h-0005W6-15 for geh-help-gnu-emacs@m.gmane.org; Wed, 06 Oct 2010 00:33:31 +0200 Original-Received: from localhost ([127.0.0.1]:41126 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3G4g-0000yd-AJ for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Oct 2010 18:33:30 -0400 Original-Received: from [140.186.70.92] (port=35213 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3G48-0000ww-7t for help-gnu-emacs@gnu.org; Tue, 05 Oct 2010 18:32:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P3G46-0006dy-MC for help-gnu-emacs@gnu.org; Tue, 05 Oct 2010 18:32:56 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:21896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P3G46-0006dV-H3; Tue, 05 Oct 2010 18:32:54 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o95MWnhb023832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Oct 2010 22:32:51 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o95KItpf010340; Tue, 5 Oct 2010 22:32:49 GMT Original-Received: from abhmt003.oracle.com by acsmt353.oracle.com with ESMTP id 665281141286317925; Tue, 05 Oct 2010 15:32:05 -0700 Original-Received: from dradamslap1 (/10.159.222.141) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 05 Oct 2010 15:32:05 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 Thread-Index: Actk0+rHcXDeURF0QVC8e8rgawQxrgABTQ4gAADdnQA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:75074 gmane.emacs.windows:4762 Archived-At: 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