From a2fc03c563f0e055de46ad25ff7f678a7e77cd80 Mon Sep 17 00:00:00 2001 From: ueno Date: Sat, 20 Apr 2002 06:11:38 +0000 Subject: [PATCH] * gnus-vers.el (gnus-revision-number): Increment to 02. * gnus-delay.el (gnus-delay-article): Undo the last change. * gnus-draft.el: Revert to the original implementation. (gnus-draft-edit-message): Pass restore as the 3rd argument of gnus-draft-setup; call save-buffer instead of message-save-drafts. (gnus-draft-setup): Rename from gnus-draft-setup-for-editing. (gnus-draft-setup-for-sending): Abolish. * gnus-i18n.el (gnus-newsgroup-default-charset-alist): Don't decode headers of articles stored in nndraft:drafts. * nnheader.el (nnheader-auto-save-coding-system): New variable. * message.el (message-draft-coding-system): Delegate the value to nnheader-auto-save-coding-system. (message-mode-map): Don't bind message-save-drafts. (message-dont-send): Use save-buffer instead of message-save-buffer. (message-save-drafts): Abolish. * nndraft.el (nndraft-request-article): Revert to the original implementation. --- lisp/gnus-delay.el | 2 +- lisp/gnus-draft.el | 31 +++++++++++++------------------ lisp/gnus-i18n.el | 11 ++++++----- lisp/gnus-vers.el | 2 +- lisp/message.el | 30 +++--------------------------- lisp/nndraft.el | 7 ++++++- lisp/nnheader.el | 12 ++++++++++++ 7 files changed, 42 insertions(+), 53 deletions(-) diff --git a/lisp/gnus-delay.el b/lisp/gnus-delay.el index cbccfda..7e712b8 100644 --- a/lisp/gnus-delay.el +++ b/lisp/gnus-delay.el @@ -135,7 +135,7 @@ DELAY is a string, giving the length of the time. Possible values are: (nndraft-request-create-group gnus-delay-group) (message-disassociate-draft) (nndraft-request-associate-buffer gnus-delay-group) - (message-save-drafts) + (save-buffer 0) (kill-buffer (current-buffer)) (message-do-actions message-postpone-actions)) diff --git a/lisp/gnus-draft.el b/lisp/gnus-draft.el index b966012..47cfac7 100644 --- a/lisp/gnus-draft.el +++ b/lisp/gnus-draft.el @@ -98,13 +98,13 @@ (let ((article (gnus-summary-article-number)) (group gnus-newsgroup-name)) (gnus-summary-mark-as-read article gnus-canceled-mark) - (gnus-draft-setup-for-editing article group) + (gnus-draft-setup article group t) (set-buffer-modified-p t) (save-excursion (save-restriction (message-narrow-to-headers) (message-remove-header "date"))) - (message-save-drafts) + (save-buffer) (let ((gnus-verbose-backends nil)) (gnus-request-expire-articles (list article) group t)) (push @@ -135,11 +135,14 @@ (let ((message-syntax-checks (if interactive message-syntax-checks 'dont-check-for-anything-just-trust-me)) (message-inhibit-body-encoding (or (not group) + (equal group "nndraft:queue") message-inhibit-body-encoding)) - (message-send-hook (and group message-send-hook)) - (message-setup-hook (and group message-setup-hook)) + (message-send-hook (and group (not (equal group "nndraft:queue")) + message-send-hook)) + (message-setup-hook (and group (not (equal group "nndraft:queue")) + message-setup-hook)) type method) - (gnus-draft-setup-for-editing article (or group "nndraft:queue")) + (gnus-draft-setup article (or group "nndraft:queue")) ;; We read the meta-information that says how and where ;; this message is to be sent. (save-restriction @@ -191,7 +194,7 @@ (let ((message-sending-message (format "Sending message %d of %d..." (- total (length articles)) total))) - (gnus-draft-send article "nndraft:queue" t))))))) + (gnus-draft-send article))))))) ;;;###autoload (defun gnus-draft-reminder () @@ -220,7 +223,7 @@ ;;;!!!This has been fixed in recent versions of Emacs and XEmacs, ;;;!!!but for the time being, we'll just run this tiny function uncompiled. -(defun gnus-draft-setup-for-editing (narticle group) +(defun gnus-draft-setup (narticle group &optional restore) (let (ga) (gnus-setup-message 'forward (let ((article narticle)) @@ -228,7 +231,9 @@ (erase-buffer) (if (not (gnus-request-restore-buffer article group)) (error "Couldn't restore the article") - (funcall gnus-draft-decoding-function) + (when (and restore + (equal group "nndraft:queue")) + (funcall gnus-draft-decoding-function)) ;; Insert the separator. (goto-char (point-min)) (search-forward "\n\n") @@ -253,16 +258,6 @@ 'add '(reply))))) 'send))))) -(defvar gnus-draft-send-draft-buffer " *send draft*") -(defun gnus-draft-setup-for-sending (narticle group) - (let ((article narticle)) - (if (not (get-buffer gnus-draft-send-draft-buffer)) - (get-buffer-create gnus-draft-send-draft-buffer)) - (set-buffer gnus-draft-send-draft-buffer) - (erase-buffer) - (if (not (gnus-request-restore-buffer article group)) - (error "Couldn't restore the article")))) - (defun gnus-draft-article-sendable-p (article) "Say whether ARTICLE is sendable." (not (memq article gnus-newsgroup-unsendable))) diff --git a/lisp/gnus-i18n.el b/lisp/gnus-i18n.el index c71b1e2..9d1a0ae 100644 --- a/lisp/gnus-i18n.el +++ b/lisp/gnus-i18n.el @@ -36,6 +36,7 @@ ("\\(^\\|:\\)hk\\(star\\)?\\." . cn-big5) ("\\(^\\|:\\)tw\\." . cn-big5) ("\\(^\\|:\\)alt\\.chinese" . hz-gb-2312) + ("\\`nndraft:\\(drafts\\|delayed\\)\\'" . nil) ) "Alist of newsgroup patterns vs. corresponding default MIME charset. Each element looks like (REGEXP . SYMBOL). REGEXP is pattern for @@ -62,7 +63,7 @@ newsgroup name. SYMBOL is MIME charset or coding-system.") It is specified by variable `gnus-newsgroup-default-charset-alist' \(cf. function `gnus-set-newsgroup-default-charset')." (if (buffer-live-p gnus-summary-buffer) - (let ((charset + (let ((regexp-to-charset (catch 'found (let ((group (save-excursion @@ -72,18 +73,18 @@ It is specified by variable `gnus-newsgroup-default-charset-alist' (while alist (let ((pair (car alist))) (if (string-match (car pair) group) - (throw 'found (cdr pair)) + (throw 'found pair) )) (setq alist (cdr alist))) )))) - (if charset + (if regexp-to-charset (progn (save-excursion (set-buffer gnus-summary-buffer) (make-local-variable 'default-mime-charset) - (setq default-mime-charset charset)) + (setq default-mime-charset (cdr regexp-to-charset))) (make-local-variable 'default-mime-charset) - (setq default-mime-charset charset)) + (setq default-mime-charset (cdr regexp-to-charset))) (kill-local-variable 'default-mime-charset))))) diff --git a/lisp/gnus-vers.el b/lisp/gnus-vers.el index 2e22166..bac3f77 100644 --- a/lisp/gnus-vers.el +++ b/lisp/gnus-vers.el @@ -34,7 +34,7 @@ (require 'product) (provide 'gnus-vers) -(defconst gnus-revision-number "01" +(defconst gnus-revision-number "02" "Revision number for this version of gnus.") ;; Product information of this gnus. diff --git a/lisp/message.el b/lisp/message.el index cba3cc5..bb1190e 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -1248,15 +1248,7 @@ The cdr of ech entry is a function for applying the face to a region.") (const :tag "ask" ask))) (defvar message-draft-coding-system - (cond - ((boundp 'MULE) '*junet*) - ((not (fboundp 'find-coding-system)) nil) - ((find-coding-system 'emacs-mule) - (if (memq system-type '(windows-nt ms-dos ms-windows)) - 'emacs-mule-dos 'emacs-mule)) - ((find-coding-system 'escape-quoted) 'escape-quoted) - ((find-coding-system 'no-conversion) 'no-conversion) - (t nil)) + nnheader-auto-save-coding-system "Coding system to compose mail.") (defcustom message-send-mail-partially-limit 1000000 @@ -1837,7 +1829,6 @@ Point is left at the beginning of the narrowed-to region." (define-key message-mode-map "\t" 'message-tab) (define-key message-mode-map "\M-;" 'comment-region) - (define-key message-mode-map "\C-x\C-s" 'message-save-drafts) (define-key message-mode-map "\C-xk" 'message-mimic-kill-buffer)) (easy-menu-define @@ -2950,7 +2941,8 @@ The text will also be indented the normal way." "Don't send the message you have been editing. Instead, just auto-save the buffer and then bury it." (interactive) - (message-save-drafts) + (set-buffer-modified-p t) + (save-buffer) (let ((actions message-postpone-actions) (frame (selected-frame)) (org-frame message-original-frame)) @@ -6430,22 +6422,6 @@ regexp varstr." (require 'messagexmas) (message-xmas-redefine)) -(defun message-save-drafts () - "Postponing the message." - (interactive) - (message "Saving %s..." buffer-file-name) - (let ((reply-headers message-reply-headers) - (buffer (current-buffer))) - (with-temp-file buffer-file-name - (insert-buffer-substring buffer) - (setq message-reply-headers reply-headers) - (message-generate-headers '((optional . In-Reply-To))) - (let ((mime-header-encode-method-alist - '((eword-encode-unstructured-field-body)))) - (mime-edit-translate-buffer))) - (set-buffer-modified-p nil)) - (message "Saving %s...done" buffer-file-name)) - (provide 'message) (run-hooks 'message-load-hook) diff --git a/lisp/nndraft.el b/lisp/nndraft.el index b2ad87f..57397fb 100644 --- a/lisp/nndraft.el +++ b/lisp/nndraft.el @@ -109,7 +109,12 @@ (newest (if (file-newer-than-file-p file auto) file auto)) (nntp-server-buffer (or buffer nntp-server-buffer))) (when (and (file-exists-p newest) - (let ((nnmail-file-coding-system nnheader-text-coding-system)) + (let ((nnmail-file-coding-system + (if (file-newer-than-file-p file auto) + (if (equal group "drafts") + message-draft-coding-system + nnheader-text-coding-system) + nnheader-auto-save-coding-system))) (nnmail-find-file newest))) (save-excursion (set-buffer nntp-server-buffer) diff --git a/lisp/nnheader.el b/lisp/nnheader.el index 0235b0c..8fdfc2a 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -97,6 +97,18 @@ This variable is a substitute for `mm-text-coding-system'.") "Text coding system for write. This variable is a substitute for `mm-text-coding-system-for-write'.") +(defvar nnheader-auto-save-coding-system + (cond + ((boundp 'MULE) '*junet*) + ((not (fboundp 'find-coding-system)) nil) + ((find-coding-system 'emacs-mule) + (if (memq system-type '(windows-nt ms-dos ms-windows)) + 'emacs-mule-dos 'emacs-mule)) + ((find-coding-system 'escape-quoted) 'escape-quoted) + ((find-coding-system 'no-conversion) 'no-conversion) + (t nil)) + "Coding system of auto save file.") + (eval-and-compile (autoload 'nnmail-message-id "nnmail") (autoload 'mail-position-on-field "sendmail") -- 1.7.10.4