* grep excludes
@ 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>
0 siblings, 2 replies; 13+ messages in thread
From: Rustom Mody @ 2016-07-06 2:52 UTC (permalink / raw)
To: help-gnu-emacs
When we run grep the exclude list is this:
grep --exclude=.\#\* --exclude=\*.o --exclude=\*\~ --exclude=\*.bin
--exclude=\*.lbin --exclude=\*.so --exclude=\*.a --exclude=\*.ln
--exclude=\*.blg --exclude=\*.bbl --exclude=\*.elc --exclude=\*.lof
--exclude=\*.glo --exclude=\*.idx --exclude=\*.lot --exclude=\*.fmt
--exclude=\*.tfm --exclude=\*.class --exclude=\*.fas --exclude=\*.lib
--exclude=\*.mem --exclude=\*.x86f --exclude=\*.sparcf --exclude=\*.dfsl
--exclude=\*.pfsl --exclude=\*.d64fsl --exclude=\*.p64fsl
--exclude=\*.lx64fsl --exclude=\*.lx32fsl --exclude=\*.dx64fsl
--exclude=\*.dx32fsl --exclude=\*.fx64fsl --exclude=\*.fx32fsl
--exclude=\*.sx64fsl --exclude=\*.sx32fsl --exclude=\*.wx64fsl
--exclude=\*.wx32fsl --exclude=\*.fasl --exclude=\*.ufsl --exclude=\*.fsl
--exclude=\*.dxl --exclude=\*.lo --exclude=\*.la --exclude=\*.gmo
--exclude=\*.mo --exclude=\*.toc --exclude=\*.aux --exclude=\*.cp
--exclude=\*.fn --exclude=\*.ky --exclude=\*.pg --exclude=\*.tp
--exclude=\*.vr --exclude=\*.cps --exclude=\*.fns --exclude=\*.kys
--exclude=\*.pgs --exclude=\*.tps --exclude=\*.vrs --exclude=\*.pyc
--exclude=\*.pyo -i --color -nH -e emacs * .*
---------------------
It literally fills up and overflows the whole window!!
Given that most of these are file types of OSes/Apps that are long defunct
Yeah I know about
1. option grep-find-ignored-files
2. That GREP_OPTIONS env variable became deprecated
But grep has an --exclude-from option that will take all these globs from a
file
Would it not be nice to have a customize option that reads this file (if
non-nil)
rather than filling a screen-full of irrelevant excludes??
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
[not found] <mailman.636.1467773593.26859.help-gnu-emacs@gnu.org>
@ 2016-07-06 3:04 ` Emanuel Berg
2016-07-06 3:24 ` Rusi
0 siblings, 1 reply; 13+ messages in thread
From: Emanuel Berg @ 2016-07-06 3:04 UTC (permalink / raw)
To: help-gnu-emacs
Rustom Mody <rustompmody@gmail.com> writes:
> Would it not be nice to have a customize
> option that reads this file (if non-nil)
> rather than filling a screen-full of
> irrelevant excludes??
Rather than excluding the whole computer one
typically use the input file list to limit the
search space...
--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 56 Blogomatic articles -
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
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
0 siblings, 2 replies; 13+ messages in thread
From: Rusi @ 2016-07-06 3:24 UTC (permalink / raw)
To: help-gnu-emacs
On Wednesday, July 6, 2016 at 8:34:35 AM UTC+5:30, Emanuel Berg wrote:
> Rustom Mody writes:
>
> > Would it not be nice to have a customize
> > option that reads this file (if non-nil)
> > rather than filling a screen-full of
> > irrelevant excludes??
>
> Rather than excluding the whole computer one
> typically use the input file list to limit the
> search space...
Just to be clear this is the default behavior of lgrep [sorry should have been
clear when I said 'grep']
ie emacs started -Q
M-x lgrep
Giving all its 3 options
1. Search for
2. In files
3. In directory
This is its output
For rgrep its bigger:
find . -type d \( -path \*/SCCS -o -path \*/RCS -o -path \*/CVS -o -path \*/MCVS -o -path \*/.svn -o -path \*/.git -o -path \*/.hg -o -path \*/.bzr -o -path \*/_MTN -o -path \*/_darcs -o -path \*/\{arch\} \) -prune -o \! -type d \( -name .\#\* -o -name \*.o -o -name \*\~ -o -name \*.bin -o -name \*.lbin -o -name \*.so -o -name \*.a -o -name \*.ln -o -name \*.blg -o -name \*.bbl -o -name \*.elc -o -name \*.lof -o -name \*.glo -o -name \*.idx -o -name \*.lot -o -name \*.fmt -o -name \*.tfm -o -name \*.class -o -name \*.fas -o -name \*.lib -o -name \*.mem -o -name \*.x86f -o -name \*.sparcf -o -name \*.dfsl -o -name \*.pfsl -o -name \*.d64fsl -o -name \*.p64fsl -o -name \*.lx64fsl -o -name \*.lx32fsl -o -name \*.dx64fsl -o -name \*.dx32fsl -o -name \*.fx64fsl -o -name \*.fx32fsl -o -name \*.sx64fsl -o -name \*.sx32fsl -o -name \*.wx64fsl -o -name \*.wx32fsl -o -name \*.fasl -o -name \*.ufsl -o -name \*.fsl -o -name \*.dxl -o -name \*.lo -o -name \*.la -o -name \*.gmo -o -name \*.mo -o -name \*.toc -o -name \*.aux -o -name \*.cp -o -name \*.fn -o -name \*.ky -o -name \*.pg -o -name \*.tp -o -name \*.vr -o -name \*.cps -o -name \*.fns -o -name \*.kys -o -name \*.pgs -o -name \*.tps -o -name \*.vrs -o -name \*.pyc -o -name \*.pyo \) -prune -o -type f \( -name \* -o -name .\* \) -exec grep -i --color -nH -e emacs {} +
Seems to be just the value of 'completion-ignored-extensions' -- which is fine
I'm just asking for it to go somewhere where its not (SO!) visible
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
2016-07-06 3:24 ` Rusi
@ 2016-07-06 4:30 ` Emanuel Berg
2016-07-06 7:49 ` B.V. Raghav
1 sibling, 0 replies; 13+ messages in thread
From: Emanuel Berg @ 2016-07-06 4:30 UTC (permalink / raw)
To: help-gnu-emacs
Rusi <rustompmody@gmail.com> writes:
> Seems to be just the value of
> 'completion-ignored-extensions' -- which is
> fine I'm just asking for it to go somewhere
> where its not (SO!) visible
It looks crazy. Put it in a function so you
don't have to see it at all?
--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 56 Blogomatic articles -
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
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>
1 sibling, 2 replies; 13+ messages in thread
From: B.V. Raghav @ 2016-07-06 7:49 UTC (permalink / raw)
To: Rusi; +Cc: help-gnu-emacs
(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
--
(B.V. Raghav)
Ph.D. Student,
Design Programme, IIT Kanpur
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
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>
1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2016-07-06 14:50 UTC (permalink / raw)
To: help-gnu-emacs
> From: Rustom Mody <rustompmody@gmail.com>
> Date: Wed, 6 Jul 2016 08:22:48 +0530
>
> But grep has an --exclude-from option that will take all these globs from a
> file
Only GNU Grep has that option, AFAIR.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
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>
1 sibling, 0 replies; 13+ messages in thread
From: B.V. Raghav @ 2016-07-07 6:15 UTC (permalink / raw)
To: Rusi; +Cc: help-gnu-emacs
bvraghav@iitk.ac.in (B.V. Raghav) writes:
> (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 '
HTH
--
(B.V. Raghav)
Ph.D. Student,
Design Programme, IIT Kanpur
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
[not found] ` <mailman.658.1467816673.26859.help-gnu-emacs@gnu.org>
@ 2016-07-07 16:23 ` Rusi
2016-07-07 16:59 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: Rusi @ 2016-07-07 16:23 UTC (permalink / raw)
To: help-gnu-emacs
On Wednesday, July 6, 2016 at 8:21:16 PM UTC+5:30, Eli Zaretskii wrote:
> > From: Rustom Mody
> > Date: Wed, 6 Jul 2016 08:22:48 +0530
> >
> > But grep has an --exclude-from option that will take all these globs from a
> > file
>
> Only GNU Grep has that option, AFAIR.
Does posix grep support the currently used --exclude option?
Doesnt show for example here http://www.unix.com/man-page/posix/1p/grep/
Raghav thanks for your attempt.
I'll try and get back on how it goes
Do consider incorporating the exclude-from option
I believe its easier for lgrep, harder for rgrep
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
2016-07-07 16:23 ` Rusi
@ 2016-07-07 16:59 ` Eli Zaretskii
0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2016-07-07 16:59 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Thu, 7 Jul 2016 09:23:00 -0700 (PDT)
> From: Rusi <rustompmody@gmail.com>
> Injection-Date: Thu, 07 Jul 2016 16:23:00 +0000
>
> > > But grep has an --exclude-from option that will take all these globs from a
> > > file
> >
> > Only GNU Grep has that option, AFAIR.
>
> Does posix grep support the currently used --exclude option?
How is that relevant to the issue at hand?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
[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-09 14:16 ` B.V. Raghav
0 siblings, 2 replies; 13+ messages in thread
From: Rusi @ 2016-07-08 3:05 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
2016-07-08 3:05 ` Rusi
@ 2016-07-08 3:11 ` Rusi
2016-07-08 3:24 ` Rusi
2016-07-09 14:16 ` B.V. Raghav
1 sibling, 1 reply; 13+ messages in thread
From: Rusi @ 2016-07-08 3:11 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
2016-07-08 3:11 ` Rusi
@ 2016-07-08 3:24 ` Rusi
0 siblings, 0 replies; 13+ messages in thread
From: Rusi @ 2016-07-08 3:24 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: grep excludes
2016-07-08 3:05 ` Rusi
2016-07-08 3:11 ` Rusi
@ 2016-07-09 14:16 ` B.V. Raghav
1 sibling, 0 replies; 13+ messages in thread
From: B.V. Raghav @ 2016-07-09 14:16 UTC (permalink / raw)
To: Rusi; +Cc: help-gnu-emacs
Rusi <rustompmody@gmail.com> writes:
> lgrep -e emacs ~/vit-projects-common-wiki/ /dev/null
> /bin/bash: lgrep: command not found
Perhaps, aliases was not configured properly!
> > and you can define lgrep and rgrep in your .bashrc (or .bash_aliases) as follows:
^^^^^^^^^^^^^^^^^^^^^^^^^^
this step is necessary
> > alias lgrep='grep -n '
> > alias rgrep='grep -nR '
Try the following in your command line:
$ alias lgrep
alias lgrep='grep -n '
or something like that should be ouput.
If this is not the case, The problem is about configuring your shell
environment for emacs, not the emacs itself
http://tldp.org/LDP/abs/html/aliases.html
Thanks,
r
--
(B.V. Raghav)
Ph.D. Student,
Design Programme, IIT Kanpur
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-07-09 14:16 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
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
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).