From ac7a697c6c1aeb9d6afdefe2ad529c515065dade Mon Sep 17 00:00:00 2001 From: yamaoka Date: Fri, 7 Dec 2001 06:09:21 +0000 Subject: [PATCH] * lisp/message.el (message-mimic-kill-buffer): Bind `message-kill-buffer-and-remove-file' to nil while calling the function `message-kill-buffer'. * texi/message-ja.texi, texi/message-ja.texi: Update. * lisp/lpath.el: Fbind `replace-regexp-in-string' for XEmacs and Mule; don't fbind coding-system-list for Mule. (cf. news://news.gnus.org/gnus.gnus-bug #48523) * lisp/message.el (message-kill-buffer-and-remove-file): New user option. (message-kill-buffer): Don't remove the backup file if `message-kill-buffer-and-remove-file' is nil. --- ChangeLog | 19 +++++++++++++++++++ lisp/lpath.el | 8 ++++---- lisp/message.el | 34 ++++++++++++++++++++-------------- texi/message-ja.texi | 38 ++++++++++++++++++++++++++++++++++++-- texi/message.texi | 37 +++++++++++++++++++++++++++++++++++-- 5 files changed, 114 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index e4a05d5..764bf93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2001-12-07 Katsumi Yamaoka + + * lisp/message.el (message-mimic-kill-buffer): Bind + `message-kill-buffer-and-remove-file' to nil while calling the + function `message-kill-buffer'. + + * texi/message-ja.texi, texi/message-ja.texi: Update. + + * lisp/lpath.el: Fbind `replace-regexp-in-string' for XEmacs and + Mule; don't fbind coding-system-list for Mule. + +2001-12-03 TSUCHIYA Masatoshi + (cf. news://news.gnus.org/gnus.gnus-bug #48523) + + * lisp/message.el (message-kill-buffer-and-remove-file): New user + option. + (message-kill-buffer): Don't remove the backup file if + `message-kill-buffer-and-remove-file' is nil. + 2001-12-07 TSUCHIYA Masatoshi * lisp/gnus-namazu.el (gnus-namazu-case-sensitive-filesystem): New diff --git a/lisp/lpath.el b/lisp/lpath.el index 7275027..5a7299b 100644 --- a/lisp/lpath.el +++ b/lisp/lpath.el @@ -114,15 +114,15 @@ (let ((functions-variables (cond ((featurep 'xemacs) - nil) + '((replace-regexp-in-string))) ((>= emacs-major-version 21) '((function-max-args smiley-encode-buffer))) ((boundp 'MULE) '((coding-system-get - coding-system-list compose-mail file-name-extension + compose-mail file-name-extension find-coding-systems-for-charsets find-coding-systems-region - function-max-args get-charset-property shell-command-to-string - smiley-encode-buffer))) + function-max-args get-charset-property replace-regexp-in-string + shell-command-to-string smiley-encode-buffer))) (t '((function-max-args smiley-encode-buffer)))))) (maybe-fbind (car functions-variables)) diff --git a/lisp/message.el b/lisp/message.el index dacc08b..a2ddb22 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -356,14 +356,21 @@ should return the new buffer name." :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." + "*Function used to prompt user whether to kill the message buffer. If +it is t, the buffer will be killed unconditionally." :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) +(defcustom message-kill-buffer-and-remove-file t + "*Non-nil means that the associated file will be removed before +removing the message buffer. However, it is treated as nil when the +command `message-mimic-kill-buffer' is used." + :group 'message-buffers + :type 'boolean) + (eval-when-compile (defvar gnus-local-organization)) (defcustom message-user-organization @@ -2875,7 +2882,8 @@ The text will also be indented the normal way." (org-frame message-original-frame)) (setq buffer-file-name nil) (kill-buffer (current-buffer)) - (when (and (or (and auto-save-file-name + (when (and message-kill-buffer-and-remove-file + (or (and auto-save-file-name (file-exists-p auto-save-file-name)) (and file-name (file-exists-p file-name))) @@ -2890,18 +2898,16 @@ The text will also be indented the normal way." (message "")) (defun message-mimic-kill-buffer () - "Kill the current buffer with query." + "Kill the current buffer with query. This is an imitation for +`kill-buffer', but it will delete a message frame." (interactive) - (unless (eq 'message-mode major-mode) - (error "%s must be invoked from a message buffer." this-command)) - (let ((command this-command) - (bufname (read-buffer (format "Kill buffer: (default %s) " - (buffer-name))))) - (if (or (not bufname) - (string-equal bufname "") - (string-equal bufname (buffer-name))) - (message-kill-buffer) - (message "%s must be invoked only for the current buffer." command)))) + (let ((bufname (read-buffer (format "Kill buffer: (default %s) " + (buffer-name)))) + message-kill-buffer-and-remove-file) + (when (or (not bufname) + (string-equal bufname "") + (string-equal bufname (buffer-name))) + (message-kill-buffer)))) (defun message-delete-frame (frame org-frame) "Delete frame for editing message." diff --git a/texi/message-ja.texi b/texi/message-ja.texi index af48338..5b7e941 100644 --- a/texi/message-ja.texi +++ b/texi/message-ja.texi @@ -751,7 +751,20 @@ documentation of your OpenPGP implementation, so we refer to it. @item C-c C-k @kindex C-c C-k @findex message-kill-buffer -メッセージバッファを切って終了します (@code{message-kill-buffer})。 +@vindex message-kill-buffer-and-remove-file +メッセージバッファを切って終了します (@code{message-kill-buffer})。その +フレームがメッセージ専用に作られたものだった場合は、フレームを削除します。 +@code{message-kill-buffer-and-remove-file} が非-@code{nil} で、かつバッ +クアップファイルができていたら、ユーザに確認してからそれも削除します。 + +@item C-x k +@kindex C-x k +@findex message-mimic-kill-buffer +@vindex message-kill-buffer-and-remove-file +@code{kill-buffer} のイミテーションで +す (@code{message-mimic-kill-buffer})。 +@code{message-kill-buffer-and-remove-file} を一時的に @code{nil} に束縛 +して @code{message-kill-buffer} を呼びます。 @end table @node Mail Aliases @@ -1474,8 +1487,29 @@ Message はあなたがメッセージバッファを要求したときに、他に無い唯一のバッ @end lisp @item message-kill-buffer-on-exit -@findex message-kill-buffer-on-exit +@vindex message-kill-buffer-on-exit @code{nil} でなければ、終了時にすぐにバッファを削除します。 + +@item message-kill-buffer-query-function +@vindex message-kill-buffer-query-function +@findex message-kill-buffer +@findex message-mimic-kill-buffer +コマン +ド @code{message-kill-buffer} や @code{message-mimic-kill-buffer} で、バッ +ファを削除するかどうかをユーザに尋ねるときに使う関数の指定です。ディフォ +ルトは @code{yes-or-no-p} ですが、 +@code{y-or-n-p} や @code{nnheader-Y-or-n-p} などを使うこともできます。 +@code{t} にすると無条件にバッファを削除します。 + +@item message-kill-buffer-and-remove-file +@vindex message-kill-buffer-and-remove-file +@findex message-kill-buffer +@findex message-mimic-kill-buffer +非-@code{nil} だったら、バッファを削除した後でもしバックアップファイルが +あったら、ユーザに確認してからそれも削除します。@code{nil} ではファイル +を削除しません。ディフォルトは @code{t} です。ただし、コマン +ド @code{message-mimic-kill-buffer} はこれが @code{nil} であるものとして +動作します。 @end table @node Message Actions diff --git a/texi/message.texi b/texi/message.texi index e74c195..eeac72f 100644 --- a/texi/message.texi +++ b/texi/message.texi @@ -776,7 +776,21 @@ Bury the message buffer and exit (@code{message-dont-send}). @item C-c C-k @kindex C-c C-k @findex message-kill-buffer -Kill the message buffer and exit (@code{message-kill-buffer}). +Kill the message buffer and exit (@code{message-kill-buffer}). It will +delete the message frame if it has been created exclusively for the +message buffer. If the option +@code{message-kill-buffer-and-remove-file} is non-@code{nil} and the +backup file has been created for the message buffer, it will also remove +the file after prompting to the user. + +@item C-x k +@kindex C-x k +@findex message-mimic-kill-buffer +@vindex message-kill-buffer-and-remove-file +This is an imitation for @code{kill-buffer} +(@code{message-mimic-kill-buffer}). It dynamically binds the variable +@code{message-kill-buffer-and-remove-file} to @code{nil} and calls the +function @code{message-kill-buffer}. @end table @@ -1534,9 +1548,28 @@ say: @end lisp @item message-kill-buffer-on-exit -@findex message-kill-buffer-on-exit +@vindex message-kill-buffer-on-exit If non-@code{nil}, kill the buffer immediately on exit. +@item message-kill-buffer-query-function +@vindex message-kill-buffer-query-function +@findex message-kill-buffer +@findex message-mimic-kill-buffer +Function used to prompt user whether to kill the message buffer when the +command @code{message-kill-buffer} or @code{message-mimic-kill-buffer} +is used. It defaults to @code{yes-or-no-p}. You may alter the value to +@code{y-or-n-p}, @code{nnheader-Y-or-n-p}, etc. If it is @code{t}, the +buffer will be killed without query. + +@item message-kill-buffer-and-remove-file +@vindex message-kill-buffer-and-remove-file +@findex message-kill-buffer +@findex message-mimic-kill-buffer +If it is non-@code{nil}, remove the backup file if it exists with a +query to the user, after the message buffer is killed. Otherwise the +file won't be removed. It defaults to @code{t}. However, it is treated +as @code{nil} when the command `message-mimic-kill-buffer' is used. + @end table -- 1.7.10.4