comparison lisp/gnus/gnus-draft.el @ 31716:9968f55ad26e

Update to emacs-21-branch of the Gnus CVS repository.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 19 Sep 2000 13:37:09 +0000
parents a7e0a6973e7c
children d4de00df3e68
comparison
equal deleted inserted replaced
31715:7c896543d225 31716:9968f55ad26e
1 ;;; gnus-draft.el --- draft message support for Gnus 1 ;;; gnus-draft.el --- draft message support for Gnus
2 ;; Copyright (C) 1997,98 Free Software Foundation, Inc. 2 ;; Copyright (C) 1997, 1998, 1999, 2000
3 ;; Free Software Foundation, Inc.
3 4
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> 5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; Keywords: news 6 ;; Keywords: news
6 7
7 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
65 66
66 \\{gnus-draft-mode-map}" 67 \\{gnus-draft-mode-map}"
67 (interactive "P") 68 (interactive "P")
68 (when (eq major-mode 'gnus-summary-mode) 69 (when (eq major-mode 'gnus-summary-mode)
69 (when (set (make-local-variable 'gnus-draft-mode) 70 (when (set (make-local-variable 'gnus-draft-mode)
70 (if (null arg) (not gnus-draft-mode) 71 (if (null arg) (not gnus-draft-mode)
71 (> (prefix-numeric-value arg) 0))) 72 (> (prefix-numeric-value arg) 0)))
72 ;; Set up the menu. 73 ;; Set up the menu.
73 (when (gnus-visual-p 'draft-menu 'menu) 74 (when (gnus-visual-p 'draft-menu 'menu)
74 (gnus-draft-make-menu-bar)) 75 (gnus-draft-make-menu-bar))
75 (gnus-add-minor-mode 'gnus-draft-mode " Draft" gnus-draft-mode-map) 76 (gnus-add-minor-mode 'gnus-draft-mode " Draft" gnus-draft-mode-map)
77 (mml-mode)
76 (gnus-run-hooks 'gnus-draft-mode-hook)))) 78 (gnus-run-hooks 'gnus-draft-mode-hook))))
77 79
78 ;;; Commands 80 ;;; Commands
79 81
80 (defun gnus-draft-toggle-sending (article) 82 (defun gnus-draft-toggle-sending (article)
92 (defun gnus-draft-edit-message () 94 (defun gnus-draft-edit-message ()
93 "Enter a mail/post buffer to edit and send the draft." 95 "Enter a mail/post buffer to edit and send the draft."
94 (interactive) 96 (interactive)
95 (let ((article (gnus-summary-article-number))) 97 (let ((article (gnus-summary-article-number)))
96 (gnus-summary-mark-as-read article gnus-canceled-mark) 98 (gnus-summary-mark-as-read article gnus-canceled-mark)
97 (gnus-draft-setup article gnus-newsgroup-name) 99 (gnus-draft-setup article gnus-newsgroup-name t)
98 (set-buffer-modified-p t) 100 (set-buffer-modified-p t)
99 (save-buffer) 101 (save-buffer)
102 (let ((gnus-verbose-backends nil))
103 (gnus-request-expire-articles (list article) gnus-newsgroup-name t))
100 (push 104 (push
101 `((lambda () 105 `((lambda ()
102 (when (gnus-buffer-exists-p ,gnus-summary-buffer) 106 (when (gnus-buffer-exists-p ,gnus-summary-buffer)
103 (save-excursion 107 (save-excursion
104 (set-buffer ,gnus-summary-buffer) 108 (set-buffer ,gnus-summary-buffer)
111 (let ((articles (gnus-summary-work-articles n)) 115 (let ((articles (gnus-summary-work-articles n))
112 article) 116 article)
113 (while (setq article (pop articles)) 117 (while (setq article (pop articles))
114 (gnus-summary-remove-process-mark article) 118 (gnus-summary-remove-process-mark article)
115 (unless (memq article gnus-newsgroup-unsendable) 119 (unless (memq article gnus-newsgroup-unsendable)
116 (gnus-draft-send article gnus-newsgroup-name) 120 (gnus-draft-send article gnus-newsgroup-name t)
117 (gnus-summary-mark-article article gnus-canceled-mark))))) 121 (gnus-summary-mark-article article gnus-canceled-mark)))))
118 122
119 (defun gnus-draft-send (article &optional group) 123 (defun gnus-draft-send (article &optional group interactive)
120 "Send message ARTICLE." 124 "Send message ARTICLE."
121 (gnus-draft-setup article (or group "nndraft:queue")) 125 (let ((message-syntax-checks (if interactive nil
122 (let ((message-syntax-checks 'dont-check-for-anything-just-trust-me) 126 'dont-check-for-anything-just-trust-me))
123 message-send-hook type method) 127 (message-inhibit-body-encoding (or (not group)
128 (equal group "nndraft:queue")
129 message-inhibit-body-encoding))
130 (message-send-hook (and group (not (equal group "nndraft:queue"))
131 message-send-hook))
132 (message-setup-hook (and group (not (equal group "nndraft:queue"))
133 message-setup-hook))
134 type method)
135 (gnus-draft-setup article (or group "nndraft:queue"))
124 ;; We read the meta-information that says how and where 136 ;; We read the meta-information that says how and where
125 ;; this message is to be sent. 137 ;; this message is to be sent.
126 (save-restriction 138 (save-restriction
127 (message-narrow-to-head) 139 (message-narrow-to-head)
128 (when (re-search-forward 140 (when (re-search-forward
174 ;;;!!!This is because `gnus-setup-message' uses uninterned symbols. 186 ;;;!!!This is because `gnus-setup-message' uses uninterned symbols.
175 ;;;!!!This has been fixed in recent versions of Emacs and XEmacs, 187 ;;;!!!This has been fixed in recent versions of Emacs and XEmacs,
176 ;;;!!!but for the time being, we'll just run this tiny function uncompiled. 188 ;;;!!!but for the time being, we'll just run this tiny function uncompiled.
177 189
178 (progn 190 (progn
179 (defun gnus-draft-setup (narticle group) 191 (defun gnus-draft-setup (narticle group &optional restore)
180 (gnus-setup-message 'forward 192 (gnus-setup-message 'forward
181 (let ((article narticle)) 193 (let ((article narticle))
182 (message-mail) 194 (message-mail)
183 (erase-buffer) 195 (erase-buffer)
184 (if (not (gnus-request-restore-buffer article group)) 196 (if (not (gnus-request-restore-buffer article group))
185 (error "Couldn't restore the article") 197 (error "Couldn't restore the article")
186 ;; Insert the separator. 198 (if (and restore (equal group "nndraft:queue"))
187 (goto-char (point-min)) 199 (mime-to-mml))
188 (search-forward "\n\n") 200 ;; Insert the separator.
189 (forward-char -1) 201 (goto-char (point-min))
190 (insert mail-header-separator) 202 (search-forward "\n\n")
191 (forward-line 1) 203 (forward-char -1)
192 (message-set-auto-save-file-name)))))) 204 (insert mail-header-separator)
205 (forward-line 1)
206 (message-set-auto-save-file-name))))))
193 207
194 (defun gnus-draft-article-sendable-p (article) 208 (defun gnus-draft-article-sendable-p (article)
195 "Say whether ARTICLE is sendable." 209 "Say whether ARTICLE is sendable."
196 (not (memq article gnus-newsgroup-unsendable))) 210 (not (memq article gnus-newsgroup-unsendable)))
197 211