Function: delete-auto-save-file-if-necessary

delete-auto-save-file-if-necessary is a byte-compiled function defined in files.el.gz.

Signature

(delete-auto-save-file-if-necessary &optional FORCE)

Documentation

Delete auto-save file for current buffer if delete-auto-save-files is t.

Normally delete only if the file was written by this Emacs since the last real save, but optional arg FORCE non-nil means delete anyway.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun delete-auto-save-file-if-necessary (&optional force)
  "Delete auto-save file for current buffer if `delete-auto-save-files' is t.
Normally delete only if the file was written by this Emacs since
the last real save, but optional arg FORCE non-nil means delete anyway."
  (and buffer-auto-save-file-name delete-auto-save-files
       (not (string= buffer-file-name buffer-auto-save-file-name))
       (or force (recent-auto-save-p))
       (progn
	 (condition-case ()
	     (delete-file buffer-auto-save-file-name)
	   (file-error nil))
	 (set-buffer-auto-saved))))