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

add rg-dwim-current-file to narrow rg-dwim even more. #55

Merged
merged 1 commit into from
Feb 5, 2019

Conversation

kidd
Copy link
Contributor

@kidd kidd commented Feb 1, 2019

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.

@coveralls
Copy link

coveralls commented Feb 1, 2019

Coverage Status

Coverage increased (+0.03%) to 84.431% when pulling 6470d52 on kidd:add-rg-dwim-current-file into f09df88 on dajva:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+3.7%) to 88.119% when pulling a70dcd0 on kidd:add-rg-dwim-current-file into f09df88 on dajva:master.

Copy link
Owner

@dajva dajva left a 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.

  1. Running the tests locally. Should be really simple (in theory). Just install cask and then run make from top dir.
  2. 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.
  3. 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 with equal or even eq 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."
Copy link
Owner

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
Copy link
Owner

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))
Copy link
Owner

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.

@kidd kidd force-pushed the add-rg-dwim-current-file branch 2 times, most recently from 172b15f to 094023d Compare February 5, 2019 10:02
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.
@kidd
Copy link
Contributor Author

kidd commented Feb 5, 2019

Hello, and thanks for the review.

Totally right on all points. The whole thing wasn't "ready" for merge yet.
And good catch on 2.

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.

@dajva dajva merged commit 77670a4 into dajva:master Feb 5, 2019
@dajva
Copy link
Owner

dajva commented Feb 5, 2019

LGTM. Merged. Thanks.

@kidd kidd deleted the add-rg-dwim-current-file branch February 5, 2019 18:28
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

Successfully merging this pull request may close these issues.

None yet

3 participants