From: Rusi <rustompmody@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: grep excludes
Date: Thu, 7 Jul 2016 20:24:32 -0700 (PDT) [thread overview]
Message-ID: <d86e1857-195b-464b-88e8-3c2c645102f7@googlegroups.com> (raw)
In-Reply-To: <fdfcac09-af29-4efc-82b8-a9e5a8273f59@googlegroups.com>
On Friday, July 8, 2016 at 8:41:23 AM UTC+5:30, Rusi wrote:
> On Friday, July 8, 2016 at 8:35:58 AM UTC+5:30, Rusi wrote:
> > 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
> > ------------------------------
>
> And when I change the lgrep defun to:
>
> (defun my-lgrep()
> (interactive)
> (my-grep-base "grep -e" (call-interactively #'my-grep-params)))
>
> in order to remove gratuitous dependency on a shell lgrep
>
> I get:
> -*- mode: grep; default-directory: "~/vit-projects-common-wiki/" -*-
> Grep started at Fri Jul 8 08:40:04
>
> grep -e emacs ~/.emacs.d/setups/grepsetup.el /dev/null
>
> Grep finished with no matches found at Fri Jul 8 08:40:04
For now with:
grep-find-ignored-directories set to (".git" ".hg" "__pycache__")))
and
grep-find-ignored-files set to (".#*" "*.o" "*.elc" "*.pyc")))
I get things like this:
-*- mode: grep; default-directory: "~/vit-projects-common-wiki/" -*-
Grep started at Fri Jul 8 08:48:12
grep --exclude=.\#\* --exclude=\*.o --exclude=\*.elc --exclude=\*.pyc -i --color -nH -e emacs * .*
followed by the real grep output
without too many false positives
Sure one line of output would be better than 4 but its ok ... can live with it
next prev parent reply other threads:[~2016-07-08 3:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.636.1467773593.26859.help-gnu-emacs@gnu.org>
2016-07-06 3:04 ` grep excludes Emanuel Berg
2016-07-06 3:24 ` Rusi
2016-07-06 4:30 ` Emanuel Berg
2016-07-06 7:49 ` B.V. Raghav
2016-07-07 6:15 ` B.V. Raghav
[not found] ` <mailman.730.1467872160.26859.help-gnu-emacs@gnu.org>
2016-07-08 3:05 ` Rusi
2016-07-08 3:11 ` Rusi
2016-07-08 3:24 ` Rusi [this message]
2016-07-09 14:16 ` B.V. Raghav
2016-07-06 2:52 Rustom Mody
2016-07-06 14:50 ` Eli Zaretskii
[not found] ` <mailman.658.1467816673.26859.help-gnu-emacs@gnu.org>
2016-07-07 16:23 ` Rusi
2016-07-07 16:59 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d86e1857-195b-464b-88e8-3c2c645102f7@googlegroups.com \
--to=rustompmody@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).