Emacs says,
Buffer foo.txt has shrunk a lot; auto save disabled in that buffer until next real save
when it detects that a lot of text is gone upon auto save time, and disables auto save, unless auto-save-include-big-deletions
is non-nil.
How can I hook into this event of Emacs detecting that the buffer has shrunk a lot? I want to hook into that because I want to set a buffer-local flag whenever buffer gets shrunk a lot so that when I do save-some-buffers
, one of its advices would detect the flag and say to me "hey, this buffer has shrunk a lot. don't forget to see diff to make sure you didn't delete some big chunk by mistake". This would be nice in addition to backups. Simply comparing the size of buffer before save and the saved file would fail to detect the case of adding a lot then deleting a lot by mistake then saving.