(defun revert-buffer-check () "Revert the current buffer. Ask for confirmation if it has unsaved data." (interactive) (revert-buffer t ; IGNORE-AUTO (not (buffer-modified-p)) ; NOCONFIRM (unless modified) nil)) ; PRESERVE-MODES (defun revert-buffer-force (&optional buffer) "Reverts BUFFER to the state of its file on disk. This discards any data that hasn't been explicitly saved by the user. If BUFFER isn't supplied the current buffer is used." (when buffer (set-buffer buffer)) (revert-buffer t t) ) ; IGNORE-AUTO NOCONFIRM (provide 'revert-buffer-my)