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

Preivew not working fro helm-ff-run-grep-ag #1

Open
shenhai-ran opened this issue Aug 31, 2019 · 10 comments
Open

Preivew not working fro helm-ff-run-grep-ag #1

shenhai-ran opened this issue Aug 31, 2019 · 10 comments
Labels
bug Something isn't working

Comments

@shenhai-ran
Copy link

I tried this with helm-ff-run-grep-ag,
however helm-file-preview-mode doesn't turn on on startup, and preview of course not working.
(require 'helm-file-preview) (helm-file-preview-mode t)

Interesting though, if I evaluate second command manually, I got helm-file-preview-mode fired up, but preview still not working.

What else configurations do I need?

Thanks

@jcs090218
Copy link
Member

Hi, thanks for reporting this issue!

I think you have configured this package correctly. I never use helm-ff-run-grep-ag command before, and couldn't find it from helm. Would you like to share your configuration anything that related to that command? And better if you can take the screenshot at the point when you were expecting helm-file-preview should work.

@shenhai-ran
Copy link
Author

Hi, sorry I wasn't able to reply during the weekend.

  • My os and emacs version:

MacOS 10.13.6

In GNU Emacs 26.1 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511))

  • Here is what I way trying:
  1. I started from a plain emacs, and installed Helm and Helm-file-preview via straight. I don't think package or straight matters.

  2. after install packages, here are the only code I have:
    image

  3. helm-file-preview-mode doesn't start up with Emacs as a minor mode, as shown in this picture.

image

  1. so I did C-x C-e to manually start helm-file-preview minor mode

Now I did some experiments: I have two folders under .emacs.d, one is a test folder with some dummy files; another is configs folders with some *.el files. I use helm-find-files to locate the folder, then C-s to invoke helm-ff-run-grep.

Here is what happened: if I search under test folder, the preview works as expected.
However if I search under configs folder, grep function works fine and preview didn't work. I even lost my current open buffer, which means, I guess, preview was invoked, but not properly, seen two pictures below.

Regards,
Shenhai

image
image

@jcs090218
Copy link
Member

jcs090218 commented Sep 3, 2019

Thanks for these useful informations!

Some changes from this package to version 0.1.4 .

  • helm-file-preview should be global minor mode, hence should resolve helm-file-preview-mode doesn't listed on the Enabled minor modes list.
  • helm-file-preview doesn't work with *helm-grep*. This issue should be resolved for now, by getting the full file path by calling the function expand-file-name.

Can you update the package to the latest version and see if the issue resolved? Thanks!

@shenhai-ran
Copy link
Author

Hi,

Great work, it seems they are solved.
Thanks I will close the issue.

@jcs090218
Copy link
Member

Great! :D

@shenhai-ran
Copy link
Author

shenhai-ran commented Sep 5, 2019

Hi again,

sorry I have to reopen this issue....
It seems helm-grep works fine with the preview. However there are two other situations doesn't work.

  1. During helm-find-files, by default (I don't remember I changed this key binds) M-g a invoke helm-ff-run-grep-ag, preview seems not working.
    2. I normally replace helm-grep default command with ack-grep
    This one is not working either.

As you want to preview all the helm with line number search, would it be better to have these two or others as well? I haven't got chance to look into your code, so I don't know if it is much trouble to include these....

Hope you consider that!

UPDATE: actually I think ack-grep works as well, I might mess up with configuration at beginning. But helm build-in ag still doesn't work.

@shenhai-ran shenhai-ran reopened this Sep 5, 2019
@jcs090218
Copy link
Member

I would definitely want to include all the possible commands! The code here is pretty simple, helm-file-preview starts when user are selecting the candidate from the menu. This package manage to take the current candidate as a string and split into 3 sections. 1. filename 2. line numbers 3. column. Hence, if the selection didn't give enough info then this package wouldn't work!

Like *helm grep*, this command only gives you the filename yet not full file path. I would have to do some trick in order to get the correct information, which the file path here.

I have tried helm built-in ag, but couldn't get the command running... Not sure what I'm doing it wrong. I did what you mentioned in the last message, M-g a invoke the command and I typed the pattern but nothing shown.

@shenhai-ran
Copy link
Author

Hi,

I just had tried around and I guess the reason is just because of the path. If I have the following folders and files:

parent_dir
├── sub_dir_1
│   ├── aaa
│   ├── bbb
│   └── ccc
└── sub_dir_2
    ├── ddd
    └── fff

and I am editing file bbb.

Now if I start helm-find-files (the file bbb is selected by helm automatically) and then

  • M-g s start grep: pattern matches inside bbb and preview works
  • Inside helm-find-files buffer navigate to sub_dir_1, then M-g s start grep: pattern matches all files under sub_dir_1 and preview works
  • M-g a start ag: pattern matches all files under sub_dir_1 and preview works.
  • Inside helm-find-files buffer navigate to sub_dir_2/ddd, then grep pattern with in ddd, preview show empty buffer with name ddd

As long as I use helm-find-files move to sub_dir_2 or any files inside, both grep and ag don't work any more, though they are different:

  • grep gives empty preview buffer but correct file name
  • ag shows no changes on the original buffer, which is bbb in this case.

I don't know if I have made things clear or worse :).
Thank!

@jcs090218 jcs090218 added the bug Something isn't working label Sep 6, 2019
@jcs090218
Copy link
Member

Hmmm, You explained it clearly but what should I type for the command after keyword pattern: ? Because I couldn't get these commands run and working hence I couldn't reproduce the bug. :0

Sorry I don't really use these commands. :(

@MattMicheletti
Copy link

@shenhai-ran Just in case you still were using this package 5 years later, the issue is a simple setting in helm-grep (well as of recent versions of Helm ... not sure about the version originally reported here). I posted some additional details here #7 (comment)

TL;DR
Essentially, a to fix this, simply set helm-grep-file-path-style to any of the alternative options such as 'relative or 'absolute.

I tested it out when invoking helm-ff-run-grep-ag and it worked as expected. It failed, as expected, when helm-grep-file-path-style was set to 'basename (the default).

I skimmed this entire issue but I believe this was the crux of what you were seeing/experience. Hope this helps you and anyone else that may stumble across this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants