GNU bug report logs -
#32549
Allow passing custom options to vc-git-grep
Previous Next
Reported by: Federico Tedin <federicotedin <at> gmail.com>
Date: Mon, 27 Aug 2018 23:04:01 UTC
Severity: wishlist
Tags: fixed
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32549 in the body.
You can then email your comments to 32549 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Mon, 27 Aug 2018 23:04:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Federico Tedin <federicotedin <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 27 Aug 2018 23:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
When using vc-git-grep, it is not possible to pass custom options to
the git grep command. It would be good to have a customizable template
variable for vc-git-grep (like grep-command or grep-find-command) to
allow for more customization. I am willing to implement this feature
assuming there's no other possible workaround.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Mon, 27 Aug 2018 23:22:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 32549 <at> debbugs.gnu.org (full text, mbox):
Federico Tedin <federicotedin <at> gmail.com> writes:
> When using vc-git-grep, it is not possible to pass custom options to
> the git grep command. It would be good to have a customizable template
> variable for vc-git-grep (like grep-command or grep-find-command) to
> allow for more customization. I am willing to implement this feature
> assuming there's no other possible workaround.
Does C-u help? From the docstring:
With C-u prefix, you can edit the constructed shell command line
before it is executed.
With two C-u prefixes, directly edit and run ‘grep-command’.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Tue, 28 Aug 2018 02:56:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 32549 <at> debbugs.gnu.org (full text, mbox):
> Does C-u help? From the docstring:
>
> With C-u prefix, you can edit the constructed shell command line
> before it is executed.
> With two C-u prefixes, directly edit and run ‘grep-command’.
You're right! With C-u, I am eventually prompted for the full git-grep
arguments, This is useful
when manually invoking the command, but now I'm wondering how I would
set my custom arguments
when the vc-git-grep function is called from another function. For
example, the projectile package
defines projectile-grep, which eventually calls rgrep or vc-git-grep
[1] (depending on the user's choice).
[1] https://github.com/bbatsov/projectile/blob/master/projectile.el#L2757
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Tue, 28 Aug 2018 03:53:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 32549 <at> debbugs.gnu.org (full text, mbox):
Federico Tedin <federicotedin <at> gmail.com> writes:
> I'm wondering how I would set my custom arguments when the vc-git-grep
> function is called from another function. For example, the projectile
> package defines projectile-grep, which eventually calls rgrep or
> vc-git-grep [1] (depending on the user's choice).
It looks like you'd have to do
(let ((current-prefix-arg '(4)))
(vc-git-grep ...))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Tue, 28 Aug 2018 23:02:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 32549 <at> debbugs.gnu.org (full text, mbox):
> > I'm wondering how I would set my custom arguments when the vc-git-grep
> > function is called from another function. For example, the projectile
> > package defines projectile-grep, which eventually calls rgrep or
> > vc-git-grep [1] (depending on the user's choice).
>
> It looks like you'd have to do
>
> (let ((current-prefix-arg '(4)))
> (vc-git-grep ...))
I've set the prefix argument using the current-prefix-arg variable as
you mentioned:
(let ((current-prefix-arg '(4)))
(vc-git-grep "something" "*.el" "."))
And then I also tried:
(let ((current-prefix-arg '(4)))
(projectile-grep))
In both cases, I am prompted for the full git-grep command (and nothing else).
Is there any way to set a default set of arguments in order to avoid typing them
when invoking the function?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Tue, 28 Aug 2018 23:16:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 32549 <at> debbugs.gnu.org (full text, mbox):
Federico Tedin <federicotedin <at> gmail.com> writes:
> (let ((current-prefix-arg '(4)))
> (vc-git-grep "something" "*.el" "."))
>
> And then I also tried:
>
> (let ((current-prefix-arg '(4)))
> (projectile-grep))
>
> In both cases, I am prompted for the full git-grep command (and
> nothing else).
Doesn't projectile-grep prompt you for a regexp? I don't have it
installed here, but it looks like you have to pass a non-nil ARG to get
prompted for filenames, i.e.,
(let ((current-prefix-arg '(4)))
(projectile-grep nil t))
> Is there any way to set a default set of arguments in order to avoid
> typing them when invoking the function?
Not sure I follow, when you pass "something" and "*.el" to the function,
those get inserted into the default command so you don't have to type
them interactively.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Tue, 28 Aug 2018 23:32:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 32549 <at> debbugs.gnu.org (full text, mbox):
> Doesn't projectile-grep prompt you for a regexp? I don't have it
> installed here, but it looks like you have to pass a non-nil ARG to get
> prompted for filenames, i.e.,
>
> (let ((current-prefix-arg '(4)))
> (projectile-grep nil t))
My mistake. Calling projectile-grep with current-prefix-arg '(4) indeed prompts
for the git-grep command _and_ a regexp.
> > Is there any way to set a default set of arguments in order to avoid
> > typing them when invoking the function?
>
> Not sure I follow, when you pass "something" and "*.el" to the function,
> those get inserted into the default command so you don't have to type
> them interactively.
I am sorry if I wasn't clear enough. What I'm trying to say is, when calling
vc-git-grep directly or indirectly with current-prefix-arg '(4), I am always
prompted for the full git-grep command. I would like to skip this step
completely,
and always use a custom set of arguments (like, for example, "-C 3"). Then, I
would be prompted for a regexp and (maybe) files, which would be added to this
custom git-grep command's arguments (this is how the rgrep command works, I
think).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Wed, 29 Aug 2018 00:46:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 32549 <at> debbugs.gnu.org (full text, mbox):
Federico Tedin <federicotedin <at> gmail.com> writes:
> when calling vc-git-grep directly or indirectly with
> current-prefix-arg '(4), I am always prompted for the full git-grep
> command. I would like to skip this step completely,
> and always use a custom set of arguments (like, for example, "-C 3"). Then, I
> would be prompted for a regexp and (maybe) files, which would be added to this
> custom git-grep command's arguments (this is how the rgrep command works, I
> think).
Ah, I see what you mean, vc-git-grep hardcodes the grep-command
template, so it doesn't allow for this. Would you like to send a patch?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Wed, 29 Aug 2018 00:55:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 32549 <at> debbugs.gnu.org (full text, mbox):
> Ah, I see what you mean, vc-git-grep hardcodes the grep-command
> template, so it doesn't allow for this. Would you like to send a patch?
Sure! I'll start working on it.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Sat, 01 Sep 2018 21:56:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 32549 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I'm attaching a patch with the implementation of the new feature
(vc-git-grep-template).
[0001-Add-variable-vc-git-grep-template.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32549
; Package
emacs
.
(Tue, 04 Sep 2018 23:04:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 32549 <at> debbugs.gnu.org (full text, mbox):
tags 32549 fixed
close 32549 27.1
quit
Federico Tedin <federicotedin <at> gmail.com> writes:
> I'm attaching a patch with the implementation of the new feature
> (vc-git-grep-template).
Thanks, pushed to master.
[1: e3661f8c35]: 2018-09-04 18:53:59 -0400
Add variable vc-git-grep-template
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e3661f8c35b3057c58e8c0b474f597697ce413ba
Added tag(s) fixed.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 04 Sep 2018 23:04:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
32549 <at> debbugs.gnu.org and Federico Tedin <federicotedin <at> gmail.com>
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 04 Sep 2018 23:04:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 03 Oct 2018 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 344 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.