dgutov / diff-hl

Emacs package for highlighting uncommitted changes
GNU General Public License v3.0
914 stars 44 forks source link

Feature Request: Support diff-buffer-with-file #176

Closed bastianbeischer closed 1 year ago

bastianbeischer commented 2 years ago

It would be amazing if this mode would support showing fringe indicators for unsaved files, by comparing the buffer with the on-disk file (through diff-buffer-with-file).

I realize this has nothing to do with vc, so I don't know how easy this is to implement. But I would find it rather useful, as I find that "what did I actually change in this file" is a very relevant question before saving, that could need some helpful advice. Running a full diff-buffer-with-file is a bit cumbersome...

dgutov commented 2 years ago

That's diff-hl-flydiff-mode, isn't it?

bastianbeischer commented 2 years ago

Aha! Yes, basically. However, that only works if the underlying file is in vc right?

dgutov commented 2 years ago

Uh, yes. It compares to the last committed (or staged) version.

I suppose for non-version-controlled files the issue of whether to save or not, might actually be more important. It should be possible to implement this without too much trouble. Maybe even in this package (as a separate minor mode).

I wonder if using the same look might be problematic, since it could give an impression that the buffer is version-controlled.

dgutov commented 1 year ago

Closing as not planned, but if someone wanted to submit a PR with an implementation, I would definitely give it a look.