Mercurial > emacs
annotate lisp/gnus/gnus-draft.el @ 66850:abf023447afb
* net/tramp-util.el (top): Fix compilation warning.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Sun, 13 Nov 2005 22:12:59 +0000 |
parents | fafd692d1e40 |
children | 1077b8039c32 2d92f5c9d6ae |
rev | line source |
---|---|
24358 | 1 ;;; gnus-draft.el --- draft message support for Gnus |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
2 |
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
4 ;; 2005 Free Software Foundation, Inc. |
24358 | 5 |
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> | |
7 ;; Keywords: news | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02110-1301, USA. | |
24358 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;;; Code: | |
29 | |
30 (require 'gnus) | |
31 (require 'gnus-sum) | |
32 (require 'message) | |
33 (require 'gnus-msg) | |
34 (require 'nndraft) | |
35 (require 'gnus-agent) | |
36 (eval-when-compile (require 'cl)) | |
37 | |
38 ;;; Draft minor mode | |
39 | |
40 (defvar gnus-draft-mode nil | |
41 "Minor mode for providing a draft summary buffers.") | |
42 | |
43 (defvar gnus-draft-mode-map nil) | |
44 | |
45 (unless gnus-draft-mode-map | |
46 (setq gnus-draft-mode-map (make-sparse-keymap)) | |
47 | |
48 (gnus-define-keys gnus-draft-mode-map | |
49 "Dt" gnus-draft-toggle-sending | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
50 "e" gnus-draft-edit-message ;; Use `B w' for `gnus-summary-edit-article' |
24358 | 51 "De" gnus-draft-edit-message |
52 "Ds" gnus-draft-send-message | |
53 "DS" gnus-draft-send-all-messages)) | |
54 | |
55 (defun gnus-draft-make-menu-bar () | |
56 (unless (boundp 'gnus-draft-menu) | |
57 (easy-menu-define | |
58 gnus-draft-menu gnus-draft-mode-map "" | |
59 '("Drafts" | |
60 ["Toggle whether to send" gnus-draft-toggle-sending t] | |
61 ["Edit" gnus-draft-edit-message t] | |
62 ["Send selected message(s)" gnus-draft-send-message t] | |
63 ["Send all messages" gnus-draft-send-all-messages t] | |
64 ["Delete draft" gnus-summary-delete-article t])))) | |
65 | |
66 (defun gnus-draft-mode (&optional arg) | |
67 "Minor mode for providing a draft summary buffers. | |
68 | |
69 \\{gnus-draft-mode-map}" | |
70 (interactive "P") | |
71 (when (eq major-mode 'gnus-summary-mode) | |
72 (when (set (make-local-variable 'gnus-draft-mode) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24358
diff
changeset
|
73 (if (null arg) (not gnus-draft-mode) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24358
diff
changeset
|
74 (> (prefix-numeric-value arg) 0))) |
24358 | 75 ;; Set up the menu. |
76 (when (gnus-visual-p 'draft-menu 'menu) | |
77 (gnus-draft-make-menu-bar)) | |
78 (gnus-add-minor-mode 'gnus-draft-mode " Draft" gnus-draft-mode-map) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24358
diff
changeset
|
79 (mml-mode) |
24358 | 80 (gnus-run-hooks 'gnus-draft-mode-hook)))) |
81 | |
82 ;;; Commands | |
83 | |
84 (defun gnus-draft-toggle-sending (article) | |
85 "Toggle whether to send an article or not." | |
86 (interactive (list (gnus-summary-article-number))) | |
87 (if (gnus-draft-article-sendable-p article) | |
88 (progn | |
89 (push article gnus-newsgroup-unsendable) | |
90 (gnus-summary-mark-article article gnus-unsendable-mark)) | |
91 (setq gnus-newsgroup-unsendable | |
92 (delq article gnus-newsgroup-unsendable)) | |
93 (gnus-summary-mark-article article gnus-unread-mark)) | |
94 (gnus-summary-position-point)) | |
95 | |
96 (defun gnus-draft-edit-message () | |
97 "Enter a mail/post buffer to edit and send the draft." | |
98 (interactive) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
99 (let ((article (gnus-summary-article-number)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
100 (group gnus-newsgroup-name)) |
24358 | 101 (gnus-summary-mark-as-read article gnus-canceled-mark) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
102 (gnus-draft-setup article group t) |
24358 | 103 (set-buffer-modified-p t) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
104 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
105 (save-restriction |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
106 (message-narrow-to-headers) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
107 (message-remove-header "date"))) |
24358 | 108 (save-buffer) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24358
diff
changeset
|
109 (let ((gnus-verbose-backends nil)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
110 (gnus-request-expire-articles (list article) group t)) |
24358 | 111 (push |
112 `((lambda () | |
113 (when (gnus-buffer-exists-p ,gnus-summary-buffer) | |
114 (save-excursion | |
115 (set-buffer ,gnus-summary-buffer) | |
116 (gnus-cache-possibly-remove-article ,article nil nil nil t))))) | |
117 message-send-actions))) | |
118 | |
119 (defun gnus-draft-send-message (&optional n) | |
120 "Send the current draft." | |
121 (interactive "P") | |
32996
d4de00df3e68
2000-10-08 Christoph Conrad <christoph.conrad@gmx.de>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
122 (let* ((articles (gnus-summary-work-articles n)) |
d4de00df3e68
2000-10-08 Christoph Conrad <christoph.conrad@gmx.de>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
123 (total (length articles)) |
d4de00df3e68
2000-10-08 Christoph Conrad <christoph.conrad@gmx.de>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
124 article) |
24358 | 125 (while (setq article (pop articles)) |
126 (gnus-summary-remove-process-mark article) | |
127 (unless (memq article gnus-newsgroup-unsendable) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
33342
diff
changeset
|
128 (let ((message-sending-message |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
33342
diff
changeset
|
129 (format "Sending message %d of %d..." |
32996
d4de00df3e68
2000-10-08 Christoph Conrad <christoph.conrad@gmx.de>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
130 (- total (length articles)) total))) |
d4de00df3e68
2000-10-08 Christoph Conrad <christoph.conrad@gmx.de>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
131 (gnus-draft-send article gnus-newsgroup-name t)) |
24358 | 132 (gnus-summary-mark-article article gnus-canceled-mark))))) |
133 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24358
diff
changeset
|
134 (defun gnus-draft-send (article &optional group interactive) |
24358 | 135 "Send message ARTICLE." |
57617
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
136 (let* ((is-queue (or (not group) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
137 (equal group "nndraft:queue"))) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
138 (message-syntax-checks (if interactive message-syntax-checks |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
139 'dont-check-for-anything-just-trust-me)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
140 (message-hidden-headers nil) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
141 (message-inhibit-body-encoding (or is-queue |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
142 message-inhibit-body-encoding)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
143 (message-send-hook (and (not is-queue) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
144 message-send-hook)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
145 (message-setup-hook (and (not is-queue) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
146 message-setup-hook)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
147 (gnus-agent-queue-mail (and (not is-queue) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
148 gnus-agent-queue-mail)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
149 (rfc2047-encode-encoded-words nil) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
150 type method move-to) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24358
diff
changeset
|
151 (gnus-draft-setup article (or group "nndraft:queue")) |
24358 | 152 ;; We read the meta-information that says how and where |
153 ;; this message is to be sent. | |
154 (save-restriction | |
155 (message-narrow-to-head) | |
156 (when (re-search-forward | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
157 (concat "^" (regexp-quote gnus-agent-target-move-group-header) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
158 ":") nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
159 (skip-syntax-forward "-") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
160 (setq move-to (buffer-substring (point) (gnus-point-at-eol))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
161 (message-remove-header gnus-agent-target-move-group-header)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
162 (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
163 (when (re-search-forward |
24358 | 164 (concat "^" (regexp-quote gnus-agent-meta-information-header) ":") |
165 nil t) | |
166 (setq type (ignore-errors (read (current-buffer))) | |
167 method (ignore-errors (read (current-buffer)))) | |
168 (message-remove-header gnus-agent-meta-information-header))) | |
32996
d4de00df3e68
2000-10-08 Christoph Conrad <christoph.conrad@gmx.de>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
169 ;; Let Agent restore any GCC lines and have message.el perform them. |
d4de00df3e68
2000-10-08 Christoph Conrad <christoph.conrad@gmx.de>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
170 (gnus-agent-restore-gcc) |
24358 | 171 ;; Then we send it. If we have no meta-information, we just send |
172 ;; it and let Message figure out how. | |
173 (when (and (or (null method) | |
174 (gnus-server-opened method) | |
175 (gnus-open-server method)) | |
176 (if type | |
177 (let ((message-this-is-news (eq type 'news)) | |
178 (message-this-is-mail (eq type 'mail)) | |
179 (gnus-post-method method) | |
180 (message-post-method method)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
181 (if move-to |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
182 (gnus-inews-do-gcc move-to) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
183 (message-send-and-exit))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
184 (if move-to |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
185 (gnus-inews-do-gcc move-to) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
186 (message-send-and-exit)))) |
24358 | 187 (let ((gnus-verbose-backends nil)) |
188 (gnus-request-expire-articles | |
189 (list article) (or group "nndraft:queue") t))))) | |
190 | |
191 (defun gnus-draft-send-all-messages () | |
192 "Send all the sendable drafts." | |
193 (interactive) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
194 (when (or |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
195 gnus-expert-user |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
196 (gnus-y-or-n-p |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
197 "Send all drafts? ")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
198 (gnus-uu-mark-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
199 (gnus-draft-send-message))) |
24358 | 200 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
201 (defun gnus-group-send-queue () |
24358 | 202 "Send all sendable articles from the queue group." |
203 (interactive) | |
57617
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
204 (when (or gnus-plugged |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
205 (not gnus-agent-prompt-send-queue) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
206 (gnus-y-or-n-p "Gnus is unplugged; really send queue? ")) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
207 (gnus-activate-group "nndraft:queue") |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
208 (save-excursion |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
209 (let* ((articles (nndraft-articles)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
210 (unsendable (gnus-uncompress-range |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
211 (cdr (assq 'unsend |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
212 (gnus-info-marks |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
213 (gnus-get-info "nndraft:queue")))))) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
214 (gnus-posting-styles nil) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
215 (total (length articles)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
216 article) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
217 (while (setq article (pop articles)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
218 (unless (memq article unsendable) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
219 (let ((message-sending-message |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
220 (format "Sending message %d of %d..." |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
221 (- total (length articles)) total))) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
222 (gnus-draft-send article)))))))) |
24358 | 223 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
224 ;;;###autoload |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
225 (defun gnus-draft-reminder () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
226 "Reminder user if there are unsent drafts." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
227 (interactive) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
228 (if (gnus-alive-p) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
229 (let (active) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
230 (catch 'continue |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
231 (dolist (group '("nndraft:drafts" "nndraft:queue")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
232 (setq active (gnus-activate-group group)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
233 (if (and active (>= (cdr active) (car active))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
234 (if (y-or-n-p "There are unsent drafts. Confirm to exit? ") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
235 (throw 'continue t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
236 (error "Stop!")))))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
237 |
24358 | 238 ;;; Utility functions |
239 | |
240 ;;;!!!If this is byte-compiled, it fails miserably. | |
241 ;;;!!!This is because `gnus-setup-message' uses uninterned symbols. | |
242 ;;;!!!This has been fixed in recent versions of Emacs and XEmacs, | |
243 ;;;!!!but for the time being, we'll just run this tiny function uncompiled. | |
244 | |
245 (progn | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24358
diff
changeset
|
246 (defun gnus-draft-setup (narticle group &optional restore) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
247 (let (ga) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
248 (gnus-setup-message 'forward |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
249 (let ((article narticle)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
250 (message-mail) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
251 (erase-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
252 (if (not (gnus-request-restore-buffer article group)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
253 (error "Couldn't restore the article") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
254 (when (and restore |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
255 (equal group "nndraft:queue")) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24358
diff
changeset
|
256 (mime-to-mml)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
257 ;; Insert the separator. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
258 (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
259 (search-forward "\n\n") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
260 (forward-char -1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
261 (insert mail-header-separator) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
262 (forward-line 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
263 (setq ga (message-fetch-field gnus-draft-meta-information-header)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
264 (message-set-auto-save-file-name)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
265 (gnus-backlog-remove-article group narticle) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
266 (when (and ga |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
267 (ignore-errors (setq ga (car (read-from-string ga))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
268 (setq gnus-newsgroup-name |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
269 (if (equal (car ga) "") nil (car ga))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
270 (gnus-configure-posting-styles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
271 (setq gnus-message-group-art (cons gnus-newsgroup-name (cadr ga))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
272 (setq message-post-method |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
273 `(lambda (arg) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
274 (gnus-post-method arg ,(car ga)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
275 (unless (equal (cadr ga) "") |
57617
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
276 (dolist (article (cdr ga)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
277 (message-add-action |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
278 `(progn |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
279 (gnus-add-mark ,(car ga) 'replied ,article) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
280 (gnus-request-set-mark ,(car ga) (list (list (list ,article) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
281 'add '(reply))))) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
282 'send))))))) |
24358 | 283 |
284 (defun gnus-draft-article-sendable-p (article) | |
285 "Say whether ARTICLE is sendable." | |
286 (not (memq article gnus-newsgroup-unsendable))) | |
287 | |
288 (provide 'gnus-draft) | |
289 | |
52401 | 290 ;;; arch-tag: 3d92af58-8c97-4a5c-9db4-a98e85198022 |
24358 | 291 ;;; gnus-draft.el ends here |