Skip to content

Instantly share code, notes, and snippets.

@hirofumi
Last active December 18, 2015 03:48
Show Gist options
  • Save hirofumi/5720246 to your computer and use it in GitHub Desktop.
Save hirofumi/5720246 to your computer and use it in GitHub Desktop.
Call ask-user-about-supersession-threat only if the buffer is actually obsolete.
(defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
"Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
(if (or (buffer-modified-p)
(verify-visited-file-modtime)
(< (* 8 1024 1024) (buffer-size))
(/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
ad-do-it
(clear-visited-file-modtime)
(not-modified)))
(ad-activate 'ask-user-about-supersession-threat)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment