Function: kill-buffer-if-not-modified
kill-buffer-if-not-modified is an autoloaded and byte-compiled
function defined in view.el.gz.
Signature
(kill-buffer-if-not-modified BUF)
Documentation
Like kill-buffer, but does nothing if buffer BUF is modified.
Source Code
;; Defined in /usr/src/emacs/lisp/view.el.gz
;;; Commands that enter or exit view mode.
;; This is used when view mode is exited, to make sure we don't try to
;; kill a buffer modified by the user. A buffer in view mode can
;; become modified if the user types C-x C-q, edits the buffer, then
;; types C-x C-q again to return to view mode.
;;;###autoload
(defun kill-buffer-if-not-modified (buf)
"Like `kill-buffer', but does nothing if buffer BUF is modified."
(let ((buf (get-buffer buf)))
(and buf (not (buffer-modified-p buf))
(kill-buffer buf))))