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

Preview not working with helm-do-ag or helm-ag #7

Open
rdiaz02 opened this issue Mar 16, 2023 · 3 comments
Open

Preview not working with helm-do-ag or helm-ag #7

rdiaz02 opened this issue Mar 16, 2023 · 3 comments

Comments

@rdiaz02
Copy link

rdiaz02 commented Mar 16, 2023

Hi,
I do not know if I am doing something wrong, but preview is not working with helm-ag and helm-do-ag. Minimal example:

  1. Start emacs as emacs -Q
  2. Evaluate this code
(require 'package)
(package-initialize)
(require 'helm)
(require 'helm-ag)
(require 'helm-file-preview)
(helm-file-preview-mode 1)
  1. Use helm-ag or helm-do-ag.

The preview is not shown.

@jcs090218
Copy link
Member

Sorry, I don't use helm anymore. But to answer your question, this package parse helm's candidate to get the file path. The suspect the candidate isn't viable for this package to parse.

@rdiaz02
Copy link
Author

rdiaz02 commented Mar 18, 2023

Thanks for your reply anyway. (Candidates were text files, org files, etc).

@MattMicheletti
Copy link

MattMicheletti commented Apr 28, 2024

I figured I would tackle this since I would occasionally experience this issue but not always. I did a little digging with this issue. As @jcs090218 notes, it was essentially a parsing issue. The default format returned by helm-do-grep-ag, for example, is just the filename. That only works if any given match's file is in the same directory as the root directory used by Helm File Preview's helm-file-preview--helm-move-selection-after-hook function (i.e. whatever the project root is based on your current project management package).

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

The file name provided by Helm AG will then have important file path components that Helm File Preview can use as it parses them out.

Hope this helps anyone else running into this issue.

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

3 participants