Function: message-kill-buffer

message-kill-buffer is an interactive and byte-compiled function defined in message.el.gz.

Signature

(message-kill-buffer)

Documentation

Kill the current buffer.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
(defun message-kill-buffer ()
  "Kill the current buffer."
  (interactive nil message-mode)
  (when (or (not (buffer-modified-p))
	    (not message-kill-buffer-query)
	    (yes-or-no-p "Message modified; kill anyway? "))
    (let ((actions message-kill-actions)
	  (draft-article message-draft-article)
	  (auto-save-file-name buffer-auto-save-file-name)
	  (file-name buffer-file-name)
	  (modified (buffer-modified-p)))
      (setq buffer-file-name nil)
      (kill-buffer (current-buffer))
      (when (and (or (and auto-save-file-name
			  (file-exists-p auto-save-file-name))
		     (and file-name
			  (file-exists-p file-name)))
		 (progn
		   ;; If the message buffer has lived in a dedicated window,
		   ;; `kill-buffer' has killed the frame.  Thus the
		   ;; `yes-or-no-p' may show up in a lowered frame.  Make sure
		   ;; that the user can see the question by raising the
		   ;; current frame:
		   (raise-frame)
		   (yes-or-no-p (format "Remove the backup file%s? "
					(if modified " too" "")))))
	(ignore-errors
	  (delete-file auto-save-file-name))
	(let ((message-draft-article draft-article))
	  (message-disassociate-draft)))
      (message-do-actions actions))))