Function: kill-buffer--possibly-save

kill-buffer--possibly-save is a byte-compiled function defined in simple.el.gz.

Signature

(kill-buffer--possibly-save BUFFER)

Documentation

Ask the user to confirm killing of a modified BUFFER.

If the user confirms, optionally save BUFFER that is about to be killed.

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun kill-buffer--possibly-save (buffer)
  "Ask the user to confirm killing of a modified BUFFER.

If the user confirms, optionally save BUFFER that is about to be
killed."
  (let ((response
         (cadr
          (read-multiple-choice
           (format "Buffer %s modified; kill anyway?"
                   (buffer-name))
           '((?y "yes" "kill buffer without saving")
             (?n "no" "exit without doing anything")
             (?s "save and then kill" "save the buffer and then kill it"))
           nil nil (and (not use-short-answers)
                        (not (use-dialog-box-p)))))))
    (if (equal response "no")
        nil
      (unless (equal response "yes")
        (with-current-buffer buffer
          (save-buffer)))
      t)))