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 feature #3

Open
goldfita opened this issue Feb 2, 2023 · 6 comments
Open

Preview feature #3

goldfita opened this issue Feb 2, 2023 · 6 comments

Comments

@goldfita
Copy link
Contributor

goldfita commented Feb 2, 2023

Is it possible to add a preview feature the way consult-ripgrep does when you step through the results?

@goldfita
Copy link
Contributor Author

goldfita commented Feb 3, 2023

See also this similar project.

@ghosty141
Copy link
Owner

I can definitely take a look at how to implement it, I think this might be quite useful.

My only "problem" is that calling consult-git-log-grep-open-function might be a bit slow for the preview usecase, but I'd have to try it to confirm my suspission.

@minad
Copy link

minad commented Feb 4, 2023

If your preview function is slow, you can configure :debounce or manual preview via consult-customize. Also recent file preview of consult-buffer is slow, but quite usable with debouncing.

@goldfita
Copy link
Contributor Author

goldfita commented Feb 5, 2023

Magit lets you open the diffs in another window, at least just using regular log - I don't know about log grep; I've noticed it's a bit slow. If you can make it work, that would be great. I think consult's preview-from-the-minibuffer feature is a much better interface than opening buffers one at a time in adjacent buffers. And each package has its own way of doing things. Using consult brings consistency.

@goldfita
Copy link
Contributor Author

The following seems to work for preview:

(defun consult-git-log-grep (&optional initial)
...
                      :state #'consult-git-log-grep-preview
...)

(defun consult-git-log-grep-preview (action cand)
  (and cand
       (eq action 'preview)
       (funcall consult-git-log-grep-open-function cand)))

It is slow, but I'd rather have it be slow than not at all. I have arrow keys bound for previewing, and C-n/C-p for when I don't want preview.

@goldfita
Copy link
Contributor Author

Also, it would be nice if it showed everything the way switch-to-buffer and find-file do before you start typing. You would just need to get rid of one line:

(unless (string-blank-p arg) ... )

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