Is there any package that has a magit-style UI for viewing unsaved buffers with their diffs?
not that I know of, but that's a cool idea
Did you know that whenever Emacs prompts "you have unsaved changes" for a buffer, you can press d to see the diff.
If you need to see the list of buffers with unsaved changes, you can use iBuffer and set the filter
Doesn't work for me, I think my ivy is getting in the way, do you know what function it uses to diff unsaved vs. last saved?
oh diff-buffer-with-file is p good.
🆒
Did you know that whenever Emacs prompts "you have unsaved changes" for a buffer, you can press d to see the diff.Yep, that's what I do at the moment. But I almost always want to see a diff of the file before deciding what to do with it so having the information already there (like with magit) would be a big improvement.• Open iBuffer
• Call ibuffer-filter-by-unsaved-file-buffers
• Then on each you can ibuffer-diff-with-file
Thanks! Seems like ibuffer-filter-by-unsaved-file-buffers is one of your custom filters 🙂 found it here: https://gist.github.com/agzam/a9b7062f8785d733777132a216d99891
I think that workflow is good enough, and definitely a step up from "you have unsaved changes" prompt. I like that you can mark all unsaved buffers and then ibuffer-diff-with-file will diff all at once
Ah, sorry, yes. I completely forgot that I have my own filter for that:
(define-ibuffer-filter unsaved-file-buffers
"Toggle current view to buffers whose file is unsaved."
(:description "file is unsaved")
(ignore qualifier)
(and (buffer-local-value 'buffer-file-name buf)
(buffer-modified-p buf)))There is also magit-diff-buffer-file for magit ui.