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

Fixes for Windows #10

Merged
merged 1 commit into from
Jun 15, 2017
Merged

Fixes for Windows #10

merged 1 commit into from
Jun 15, 2017

Conversation

drvink
Copy link
Contributor

@drvink drvink commented Jun 3, 2017

No description provided.

@dajva dajva added the bug label Jun 3, 2017
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 for the pr.
I am kind of surprised that this is all that is needed for Windows support. :)
I don't use Windows myself and will not officially support anything other than Linux. Patches for other platforms are very welcome though but I can't do any testing.

I will merge this patch after some small changes.

Thanks.

@@ -207,7 +207,8 @@ for special purposes.")
(globs (cdr typedef)))
(mapconcat
(lambda (glob)
(concat "--type-add '" name ":" glob "'"))
(concat "--type-add "
(shell-quote-argument (concat name ":" glob))))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the problem on Windows? I assume it's the '*' in the globs that needs to be escaped or is it more? When running this on linux I see that the ':'s are escaped as well.
Elsip documentation (36.2 Shell Arguments) indicates that escaping shall be done in order to make sure file names are detected properly. Maybe it's better to only escape the glob var if it's enough on Wiindows to avoid potential problems?

Copy link
Owner

@dajva dajva Jun 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I think this also needs to be done on the custom var in rg-build-template in case you search in a custom file pattern that is not part of rg or rg-custom-type-aliases.
Try invoking rg and chose a custom glob instead of an exisiting aliases at the files prompt, e.g. *.el to see if it works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra escapes don't hurt (i.e. they are effectively no-ops), and I'm not sure if escaping just the glob piece would work for Windows--I haven't tried, but this way definitely works, and results in a reasonable command line if the user chooses to edit it before invocation via C-u M-x rg; the escaped parameters look like gn\:\*.gn or "gn:*.gn" on Linux and Windows, respectively.

And yes, I think you're right that the custom also needs to be escaped--I tried just now and the argument gets single-quoted, which won't work for Windows, so I'll fix that.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it seems to work on linux so let's keep it.

rg.el Outdated
@@ -734,7 +735,7 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
(setq command nil))
(setq dir (file-name-as-directory (expand-file-name dir)))
(rg-set-case-sensitivity regexp)
(setq command (rg-build-command regexp files))
(setq command (concat (rg-build-command regexp files) " ."))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the path needs to be done in the rg-build-command defun in order to be applied to rg-rerun-* defuns so please move this to the end of that defun.

@drvink
Copy link
Contributor Author

drvink commented Jun 14, 2017

I pushed a new version with the requested changes.

@dajva
Copy link
Owner

dajva commented Jun 14, 2017

I can't see any new changes on your branch.

@drvink drvink closed this Jun 14, 2017
@drvink drvink reopened this Jun 14, 2017
@drvink
Copy link
Contributor Author

drvink commented Jun 14, 2017

git is harder than actually writing software. Do you see it now?

@dajva
Copy link
Owner

dajva commented Jun 15, 2017

Yeah, I see it now. Thanks.

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

Successfully merging this pull request may close these issues.

2 participants