-
Notifications
You must be signed in to change notification settings - Fork 41
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
add rg-dwim-current-file to narrow rg-dwim even more. #55
Conversation
a70dcd0
to
d7978cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, some generalt comments below. I added some details in you commit that I want to be fixed before merging.
- Running the tests locally. Should be really simple (in theory). Just install cask and then run
make
from top dir. - One issue with this solution that I didn't think of is that the
:files
key is still a pattern, meaning that it's not just the current file but all files with the same name in any subdir of the current dir. I don't think this is a big issue, would be worse if this was done in project dir. But, I think this would be good to at least aknowledge in the documentation. - The actual problem with the test is likely the use of
=
, which according to documentation wants NUMBER-OR-MARKER as argument. At least that the error I see when running the tests locally. Try withequal
or eveneq
may work.
rg.el
Outdated
@@ -707,6 +707,14 @@ under the current directory." | |||
:files current | |||
:dir current) | |||
|
|||
;;;###autoload (autoload 'rg-dwim-current-file "rg.el" "" t) | |||
(rg-define-search rg-dwim-current-file | |||
"Search for thing at point in the current file." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like this to reflect that the current file is still treated as a pattern. Maybe "Search for thing at point with the current file name as pattern."?
rg.el
Outdated
@@ -715,9 +723,10 @@ point in files matching current file under project root | |||
directory. With \\[universal-argument] prefix (CURDIR), search is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs documentation of the double universal argument behavior.
rg.el
Outdated
(rg-dwim-current-dir) | ||
(rg-dwim-project-dir))) | ||
(cond | ||
((= 4 (and (consp curdir) (car curdir))) (rg-dwim-current-dir)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=
seems to fail the tests.
172b15f
to
094023d
Compare
Following the trend of c-u meaning "more focused", this commit implements c-u c-u rg-dwim as even narrower search, searching just in the current file.
094023d
to
6470d52
Compare
Hello, and thanks for the review. Totally right on all points. The whole thing wasn't "ready" for merge yet. I think I addressed all of them. If you have further ideas on making the wording clearer, feel free to merge and edit the docstrings right away. |
LGTM. Merged. Thanks. |
Following the trend of c-u meaning "more focused", this commit
implements c-u c-u rg-dwim as even narrower search, searching just in
the current file.
Still have to figure out how to run the tests correctly in my box.