Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to disable certain selector types #135

Closed
hoelzro opened this issue Jul 18, 2012 · 7 comments
Closed

Ability to disable certain selector types #135

hoelzro opened this issue Jul 18, 2012 · 7 comments

Comments

@hoelzro
Copy link
Collaborator

hoelzro commented Jul 18, 2012

What if, as a user, I didn't care about firstlinematch selectors, but I didn't want to redefine the default selector rules? --remove-selector-type=firstlinematch could be handy. Or not. Just a thought.

@petdance
Copy link
Collaborator

What would the benefit of this be? Disabling all firstlinematch checks, and thus saving us the speed hit of opening the file and reading the first line? Is that the optimization you're after?

Maybe ack2 could be smart enough to say "Hey, there are no firstlinematch checks to be done, so I'm smart enough to not bother reading the file at all." Or maybe it's already that smart?

@hoelzro
Copy link
Collaborator Author

hoelzro commented Jul 18, 2012

@petdance That is the optimization I'm after, and ack2 won't check the first line of the file unless a firstlinematch is used (although it may be opening the file once per filter, but that should be easy enough to fix).

@petdance
Copy link
Collaborator

If we get the optimization implicitly, then what's the benefit of explicitly specifying it?

@hoelzro
Copy link
Collaborator Author

hoelzro commented Jul 18, 2012

Because there are a bunch of firstlinematch selectors in the default ackrc now. Meaning that every file that doesn't match the extensions for a --perl filter is being opened and having its first line checked.

@petdance
Copy link
Collaborator

I'm thinking that removing those offending lines from one's ackrc would be the way to go, rather than having a rule to ignore a given type.

@hoelzro
Copy link
Collaborator Author

hoelzro commented Jul 18, 2012

Right, but you'd have to tell ack to ignore its defaults, and import the default ackrc into your own .ackrc file, and make sure you keep it up to date. Maybe it's too specific for a feature, but I thought I'd at least bring up the idea for discussion.

@petdance
Copy link
Collaborator

Oh yeah, I forgot we don't have the global ackrc any more. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants