Fixes #284: Capture buffer not associated with a file#285
Conversation
832baba to
5552a66
Compare
117f068 to
c3d0219
Compare
c3d0219 to
32708f0
Compare
|
I have also made changes to fix both |
b481e3c to
0a65381
Compare
|
This pull request fixes the issue: #284 (comment) |
VC library functions (like vc-buffer-sync, vc-deduce-fileset, and vc-ensure-vc-buffer) rely on the current buffer's file association and local state. When invoked from an indirect or cloned buffer, these functions can fail or return incorrect results. This commit wraps these buffer-dependent VC calls in (with-current-buffer (diff-hl--target-buffer ...)) to ensure they always execute in the context of the base buffer. The diff-hl--target-buffer function was also updated to make its argument optional, cleaning up several redundant calls.
0a65381 to
a0378a2
Compare
|
@jamescherti Remember the several places we have the redundant How about we try to localize the fix there? Both |
|
@jamescherti Could we limit the fix to those How do we reproduce the issue? Just using |
|
If we have to add a new one, we can add it in Or change But preferably just one of these. |

This pull request:
diff-hlcommands from cloned or indirect buffers. Several functions invc, such asvc-buffer-syncandvc-deduce-fileset, rely on the state and file association of the current buffer. When these functions are executed from an indirect buffer, they often fail to resolve the proper version control context, leading to errors during operations like reverting hunks, fetching diffs, or deducing the active VC backend. To address this, the updates systematically wrap buffer-dependentvc-*function calls within awith-current-buffer (diff-hl--target-buffer ...))block.