From: yamaoka Date: Fri, 2 Oct 1998 00:00:28 +0000 (+0000) Subject: * lisp/message.el (message-kill-buffer): Refer to X-Git-Tag: pgnus-ichikawa-199811302358~192 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f9d25d99f501178a2df2adc6fced816967356fc;p=elisp%2Fgnus.git- * lisp/message.el (message-kill-buffer): Refer to `message-kill-buffer-query-function'. * lisp/message.el (message-kill-buffer-query-function): New user option. * lisp/nnheader.el (nnheader-Y-or-n-p): New function. --- diff --git a/lisp/message.el b/lisp/message.el index 004730c..6ff9adc 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -311,6 +311,15 @@ should return the new buffer name." :group 'message-buffers :type 'boolean) +(defcustom message-kill-buffer-query-function 'yes-or-no-p + "*A function called to query the user whether to kill buffer anyway or not. +If it is t, the buffer will be killed peremptorily." + :type '(radio (function-item yes-or-no-p) + (function-item y-or-n-p) + (function-item nnheader-Y-or-n-p) + (function :tag "Other" t)) + :group 'message-buffers) + (defvar gnus-local-organization) (defcustom message-user-organization (or (and (boundp 'gnus-local-organization) @@ -2062,14 +2071,17 @@ The text will also be indented the normal way." "Kill the current buffer." (interactive) (when (or (not (buffer-modified-p)) - (yes-or-no-p "Message modified; kill anyway? ")) + (eq t message-kill-buffer-query-function) + (funcall message-kill-buffer-query-function + "Message modified; kill anyway? ")) (let ((actions message-kill-actions) (frame (selected-frame)) (org-frame message-original-frame)) (setq buffer-file-name nil) (kill-buffer (current-buffer)) (message-do-actions actions) - (message-delete-frame frame org-frame)))) + (message-delete-frame frame org-frame))) + (message "")) (defun message-delete-frame (frame org-frame) "Delete frame for editing message." diff --git a/lisp/nnheader.el b/lisp/nnheader.el index 222f090..3122dd8 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -807,6 +807,20 @@ find-file-hooks, etc. (fset 'nnheader-cancel-timer 'cancel-timer) (fset 'nnheader-cancel-function-timers 'cancel-function-timers) +(defun nnheader-Y-or-n-p (prompt) + "Ask user a \"Y/n\" question. Return t if answer is neither \"n\", \"N\" nor \"C-g\"." + (if (and (featurep 'xemacs) (should-use-dialog-box-p)) + (yes-or-no-p-dialog-box prompt) + (let ((cursor-in-echo-area t) + (echo-keystrokes 0) + (log-message-max-size 0) + (inhibit-quit t) + message-log-max ans) + (while (not (memq ans '(?\ ?N ?Y ?\C-g ?\e ?\n ?\r ?n ?y))) + (message "%s(Y/n) " prompt) + (setq ans (read-char-exclusive))) + (not (memq ans '(?\C-g ?N ?n)))))) + (when (string-match "XEmacs\\|Lucid" emacs-version) (require 'nnheaderxm))