help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: grep excludes


From: Rusi
Subject: Re: grep excludes
Date: Thu, 7 Jul 2016 20:05:55 -0700 (PDT)
User-agent: G2/1.0

On Thursday, July 7, 2016 at 11:46:02 AM UTC+5:30, B.V. Raghav wrote:
> 
> > (defun my-grep(pattern file-name)
> >   "My own version of grep command"
> >   (interactive "sPattern: \nFFind %s in file(s): ")
> >   (let ((cmd "grep -e"))
> >     ;;       ^^^^^^^^^ My Grep Command
> >     (grep (message "%s %s %s" cmd pattern file-name))))
> >
> > If I understand correctly, you requires the change of command as
> > mentioned here.
> >
> > HTH
> 
> On second thoughts, the following set should be helpful:
> 
> (defun my-grep-base(grep-cmd params)
>   (grep (format "%s %s %s" grep-cmd (car params) (cadr params))))
> 
> (defun my-grep-params(pattern file-name)
>   "My own version of grep command"
>   (interactive "sPattern: \nFFind %s in file(s): ")
>   (list pattern file-name))
> 
> (defun my-grep()
>   (interactive)
>   (my-grep-base "grep -e" (call-interactively #'my-grep-params)))
> 
> (defun my-lgrep()
>   (interactive)
>   (my-grep-base "lgrep -e" (call-interactively #'my-grep-params)))
> 
> (defun my-rgrep()
>   (interactive)
>   (my-grep-base "rgrep -e" (call-interactively #'my-grep-params)))
> 
> and you can define lgrep and rgrep in your .bashrc (or .bash_aliases) as 
> follows:
> 
> alias lgrep='grep -n '
> alias rgrep='grep -nR '

Thanks for trying Raghav but as of now it does:
--------------------------------
-*- mode: grep; default-directory: "~/vit-projects-common-wiki/" -*-
Grep started at Fri Jul  8 08:32:13

lgrep -e emacs ~/vit-projects-common-wiki/ /dev/null
/bin/bash: lgrep: command not found

Grep exited abnormally with code 127 at Fri Jul  8 08:32:13
------------------------------

Eli, I'll be glad to clarify any question(s) about the issue at hand


reply via email to

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