consult-gh
consult-gh copied to clipboard
When a file is previewed and then selected, a new copy is downloaded instead of opening the same preview buffer
Describe the bug* Previewing a file (or code search result) and then opening it creates two copy of the files and two buffers).
To Reproduce Steps to reproduce the behavior:
-
M-x consult-gh-find-file
- search for a repo, and file
- once you have a list of files, get a preview
- select the same file
Expected behavior
If a file is already previewed, selecting it should just reload that same buffer (i.e. the same temporary file) at least within the same consult-gh-find-file
call, there is no need to create two different copies of the same file.
Screenshots
Additional context This is happening because of the way temporary file names are created. Essentially both preview and view actions are making a unique filepath and therefore end up creating two unique files. The filepath should be shared between the two.