From 1611a60cb0dbdf7d21dfa087c7def87eede16cf2 Mon Sep 17 00:00:00 2001 From: keiichi Date: Fri, 16 Oct 1998 03:04:40 +0000 Subject: [PATCH] (message-mode): Set file coding system in message buffer. (message-file-coding-system): New variable. (message-maybe-setup-default-charset): Move to gnus-msg.el and rename to `gnus-message-maybe-setup-default-charset'. --- lisp/message.el | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/lisp/message.el b/lisp/message.el index a878ef0..a0abddd 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -464,13 +464,18 @@ variable isn't used." :group 'message-headers :type 'boolean) -(defcustom message-setup-hook - '(message-maybe-setup-default-charset turn-on-mime-edit) +(defcustom message-setup-hook nil "Normal hook, run each time a new outgoing message is initialized. The function `message-setup' runs this hook." :group 'message-various :type 'hook) +(defcustom message-mime-setup-function + 'turn-on-mime-edit + "*A function called to set up MIME edit mode." + :group 'message-various + :type 'function) + (defcustom message-signature-setup-hook nil "Normal hook, run each time a new outgoing message is initialized. It is run after the headers have been inserted and before @@ -892,6 +897,9 @@ The cdr of ech entry is a function for applying the face to a region.") (defvar message-send-coding-system 'binary "Coding system to encode outgoing mail.") +(defvar message-file-coding-system 'None + "Coding system for saving message.") + ;;; Internal variables. (defvar message-buffer-list nil) @@ -1435,6 +1443,12 @@ C-c C-r message-caesar-buffer-body (rot13 the message body)." (setq adaptive-fill-first-line-regexp (concat "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|" adaptive-fill-first-line-regexp)) + (cond ((coding-system-p message-file-coding-system) + (set-buffer-file-coding-system message-file-coding-system)) + ((fboundp message-file-coding-system) + (let ((codesys (funcall message-file-coding-system))) + (if (coding-system-p codesys) + (set-buffer-file-coding-system codesys))))) (run-hooks 'text-mode-hook 'message-mode-hook)) @@ -3518,6 +3532,8 @@ Headers already prepared in the buffer are not modified." (run-hooks 'message-header-setup-hook)) (set-buffer-modified-p nil) (setq buffer-undo-list nil) + (when (functionp message-mime-setup-function) + (funcall message-mime-setup-function)) (run-hooks 'message-setup-hook) (message-position-point) (undo-boundary)) @@ -4313,19 +4329,6 @@ regexp varstr." ;;; @ for MIME Edit mode ;;; -(defun message-maybe-setup-default-charset () - (let ((charset - (and (boundp 'gnus-summary-buffer) - (buffer-live-p gnus-summary-buffer) - (save-excursion - (set-buffer gnus-summary-buffer) - default-mime-charset)))) - (if charset - (progn - (make-local-variable 'default-mime-charset) - (setq default-mime-charset charset) - )))) - (defun message-maybe-encode () (when message-mime-mode (run-hooks 'mime-edit-translate-hook) -- 1.7.10.4