Mercurial > emacs
annotate lisp/gnus/gnus-uu.el @ 68405:3f56050552c3
(advertised-widget-backward): New alias.
(widget-keymap): Use advertised-widget-backward for S-TAB.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 26 Jan 2006 17:59:01 +0000 |
parents | 41260182da5b |
children | 1077b8039c32 ee12d75eb214 |
rev | line source |
---|---|
17493 | 1 ;;; gnus-uu.el --- extract (uu)encoded files in Gnus |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64712
diff
changeset
|
2 |
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64712
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, |
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64712
diff
changeset
|
4 ;; 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
17493 | 5 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 7 ;; Created: 2 Oct 1993 |
8 ;; Keyword: news | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
17493 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;;; Code: | |
30 | |
19634
118761d47324
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
31 (eval-when-compile (require 'cl)) |
118761d47324
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
32 |
17493 | 33 (require 'gnus) |
34 (require 'gnus-art) | |
35 (require 'message) | |
36 (require 'gnus-msg) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
37 (require 'mm-decode) |
17493 | 38 |
39 (defgroup gnus-extract nil | |
40 "Extracting encoded files." | |
41 :prefix "gnus-uu-" | |
42 :group 'gnus) | |
43 | |
44 (defgroup gnus-extract-view nil | |
45 "Viewwing extracted files." | |
46 :group 'gnus-extract) | |
47 | |
48 (defgroup gnus-extract-archive nil | |
49 "Extracting encoded archives." | |
50 :group 'gnus-extract) | |
51 | |
52 (defgroup gnus-extract-post nil | |
53 "Extracting encoded archives." | |
54 :prefix "gnus-uu-post" | |
55 :group 'gnus-extract) | |
56 | |
57 ;; Default viewing action rules | |
58 | |
59 (defcustom gnus-uu-default-view-rules | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
60 '(("\\.te?xt$\\|\\.doc$\\|read.*me\\|\\.c?$\\|\\.h$\\|\\.bat$\\|\\.asm$\\|makefile" "cat %s | sed 's/\r$//'") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
61 ("\\.pas$" "cat %s | sed 's/\r$//'") |
17493 | 62 ("\\.[1-9]$" "groff -mandoc -Tascii %s | sed s/\b.//g") |
29734
afc9d8eb0666
(gnus-uu-default-view-rules): Don't use `xv'.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
63 ("\\.\\(jpe?g\\|gif\\|tiff?\\|p[pgb]m\\|xwd\\|xbm\\|pcx\\)$" "display") |
afc9d8eb0666
(gnus-uu-default-view-rules): Don't use `xv'.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
64 ("\\.tga$" "tgatoppm %s | ee -") |
17493 | 65 ("\\.\\(wav\\|aiff\\|hcom\\|u[blw]\\|s[bfw]\\|voc\\|smp\\)$" |
66 "sox -v .5 %s -t .au -u - > /dev/audio") | |
67 ("\\.au$" "cat %s > /dev/audio") | |
68 ("\\.midi?$" "playmidi -f") | |
69 ("\\.mod$" "str32") | |
70 ("\\.ps$" "ghostview") | |
71 ("\\.dvi$" "xdvi") | |
72 ("\\.html$" "xmosaic") | |
73 ("\\.mpe?g$" "mpeg_play") | |
74 ("\\.\\(flc\\|fli\\|rle\\|iff\\|pfx\\|avi\\|sme\\|rpza\\|dl\\|qt\\|rsrc\\|mov\\)$" "xanim") | |
75 ("\\.\\(tar\\|arj\\|zip\\|zoo\\|arc\\|gz\\|Z\\|lzh\\|ar\\|lha\\)$" | |
76 "gnus-uu-archive")) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
77 "*Default actions to be taken when the user asks to view a file. |
17493 | 78 To change the behaviour, you can either edit this variable or set |
79 `gnus-uu-user-view-rules' to something useful. | |
80 | |
81 For example: | |
82 | |
83 To make gnus-uu use 'xli' to display JPEG and GIF files, put the | |
84 following in your .emacs file: | |
85 | |
86 (setq gnus-uu-user-view-rules '((\"jpg$\\\\|gif$\" \"xli\"))) | |
87 | |
88 Both these variables are lists of lists with two string elements. The | |
89 first string is a regular expression. If the file name matches this | |
90 regular expression, the command in the second string is executed with | |
91 the file as an argument. | |
92 | |
93 If the command string contains \"%s\", the file name will be inserted | |
94 at that point in the command string. If there's no \"%s\" in the | |
95 command string, the file name will be appended to the command string | |
96 before executing. | |
97 | |
98 There are several user variables to tailor the behaviour of gnus-uu to | |
99 your needs. First we have `gnus-uu-user-view-rules', which is the | |
100 variable gnus-uu first consults when trying to decide how to view a | |
101 file. If this variable contains no matches, gnus-uu examines the | |
102 default rule variable provided in this package. If gnus-uu finds no | |
103 match here, it uses `gnus-uu-user-view-rules-end' to try to make a | |
104 match." | |
105 :group 'gnus-extract-view | |
106 :type '(repeat (group regexp (string :tag "Command")))) | |
107 | |
108 (defcustom gnus-uu-user-view-rules nil | |
109 "What actions are to be taken to view a file. | |
110 See the documentation on the `gnus-uu-default-view-rules' variable for | |
111 details." | |
112 :group 'gnus-extract-view | |
113 :type '(repeat (group regexp (string :tag "Command")))) | |
114 | |
115 (defcustom gnus-uu-user-view-rules-end | |
116 '(("" "file")) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
117 "*What actions are to be taken if no rule matched the file name. |
17493 | 118 See the documentation on the `gnus-uu-default-view-rules' variable for |
119 details." | |
120 :group 'gnus-extract-view | |
121 :type '(repeat (group regexp (string :tag "Command")))) | |
122 | |
123 ;; Default unpacking commands | |
124 | |
125 (defcustom gnus-uu-default-archive-rules | |
126 '(("\\.tar$" "tar xf") | |
127 ("\\.zip$" "unzip -o") | |
128 ("\\.ar$" "ar x") | |
129 ("\\.arj$" "unarj x") | |
130 ("\\.zoo$" "zoo -e") | |
131 ("\\.\\(lzh\\|lha\\)$" "lha x") | |
132 ("\\.Z$" "uncompress") | |
133 ("\\.gz$" "gunzip") | |
134 ("\\.arc$" "arc -x")) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
135 "*See `gnus-uu-user-archive-rules'." |
17493 | 136 :group 'gnus-extract-archive |
137 :type '(repeat (group regexp (string :tag "Command")))) | |
138 | |
139 (defvar gnus-uu-destructive-archivers | |
140 (list "uncompress" "gunzip")) | |
141 | |
142 (defcustom gnus-uu-user-archive-rules nil | |
143 "A list that can be set to override the default archive unpacking commands. | |
144 To use, for instance, 'untar' to unpack tar files and 'zip -x' to | |
145 unpack zip files, say the following: | |
146 (setq gnus-uu-user-archive-rules | |
147 '((\"\\\\.tar$\" \"untar\") | |
148 (\"\\\\.zip$\" \"zip -x\")))" | |
149 :group 'gnus-extract-archive | |
150 :type '(repeat (group regexp (string :tag "Command")))) | |
151 | |
152 (defcustom gnus-uu-ignore-files-by-name nil | |
153 "*A regular expression saying what files should not be viewed based on name. | |
154 If, for instance, you want gnus-uu to ignore all .au and .wav files, | |
155 you could say something like | |
156 | |
157 (setq gnus-uu-ignore-files-by-name \"\\\\.au$\\\\|\\\\.wav$\") | |
158 | |
159 Note that this variable can be used in conjunction with the | |
160 `gnus-uu-ignore-files-by-type' variable." | |
161 :group 'gnus-extract | |
162 :type '(choice (const :tag "off" nil) | |
163 (regexp :format "%v"))) | |
164 | |
165 (defcustom gnus-uu-ignore-files-by-type nil | |
166 "*A regular expression saying what files that shouldn't be viewed, based on MIME file type. | |
167 If, for instance, you want gnus-uu to ignore all audio files and all mpegs, | |
168 you could say something like | |
169 | |
170 (setq gnus-uu-ignore-files-by-type \"audio/\\\\|video/mpeg\") | |
171 | |
172 Note that this variable can be used in conjunction with the | |
173 `gnus-uu-ignore-files-by-name' variable." | |
174 :group 'gnus-extract | |
175 :type '(choice (const :tag "off" nil) | |
176 (regexp :format "%v"))) | |
177 | |
178 ;; Pseudo-MIME support | |
179 | |
180 (defconst gnus-uu-ext-to-mime-list | |
181 '(("\\.gif$" "image/gif") | |
182 ("\\.jpe?g$" "image/jpeg") | |
183 ("\\.tiff?$" "image/tiff") | |
184 ("\\.xwd$" "image/xwd") | |
185 ("\\.pbm$" "image/pbm") | |
186 ("\\.pgm$" "image/pgm") | |
187 ("\\.ppm$" "image/ppm") | |
188 ("\\.xbm$" "image/xbm") | |
189 ("\\.pcx$" "image/pcx") | |
190 ("\\.tga$" "image/tga") | |
191 ("\\.ps$" "image/postscript") | |
192 ("\\.fli$" "video/fli") | |
193 ("\\.wav$" "audio/wav") | |
194 ("\\.aiff$" "audio/aiff") | |
195 ("\\.hcom$" "audio/hcom") | |
196 ("\\.voc$" "audio/voc") | |
197 ("\\.smp$" "audio/smp") | |
198 ("\\.mod$" "audio/mod") | |
199 ("\\.dvi$" "image/dvi") | |
200 ("\\.mpe?g$" "video/mpeg") | |
201 ("\\.au$" "audio/basic") | |
202 ("\\.\\(te?xt\\|doc\\|c\\|h\\)$" "text/plain") | |
203 ("\\.\\(c\\|h\\)$" "text/source") | |
204 ("read.*me" "text/plain") | |
205 ("\\.html$" "text/html") | |
206 ("\\.bat$" "text/bat") | |
207 ("\\.[1-6]$" "text/man") | |
208 ("\\.flc$" "video/flc") | |
209 ("\\.rle$" "video/rle") | |
210 ("\\.pfx$" "video/pfx") | |
211 ("\\.avi$" "video/avi") | |
212 ("\\.sme$" "video/sme") | |
213 ("\\.rpza$" "video/prza") | |
214 ("\\.dl$" "video/dl") | |
215 ("\\.qt$" "video/qt") | |
216 ("\\.rsrc$" "video/rsrc") | |
217 ("\\..*$" "unknown/unknown"))) | |
218 | |
219 ;; Various variables users may set | |
220 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
221 (defcustom gnus-uu-tmp-dir |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
222 (cond ((fboundp 'temp-directory) (temp-directory)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
223 ((boundp 'temporary-file-directory) temporary-file-directory) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
224 ("/tmp/")) |
17493 | 225 "*Variable saying where gnus-uu is to do its work. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
226 Default is \"/tmp/\"." |
17493 | 227 :group 'gnus-extract |
228 :type 'directory) | |
229 | |
230 (defcustom gnus-uu-do-not-unpack-archives nil | |
231 "*Non-nil means that gnus-uu won't peek inside archives looking for files to display. | |
232 Default is nil." | |
233 :group 'gnus-extract-archive | |
234 :type 'boolean) | |
235 | |
236 (defcustom gnus-uu-ignore-default-view-rules nil | |
237 "*Non-nil means that gnus-uu will ignore the default viewing rules. | |
238 Only the user viewing rules will be consulted. Default is nil." | |
239 :group 'gnus-extract-view | |
240 :type 'boolean) | |
241 | |
242 (defcustom gnus-uu-grabbed-file-functions nil | |
243 "Functions run on each file after successful decoding. | |
244 They will be called with the name of the file as the argument. | |
245 Likely functions you can use in this list are `gnus-uu-grab-view' | |
246 and `gnus-uu-grab-move'." | |
247 :group 'gnus-extract | |
248 :options '(gnus-uu-grab-view gnus-uu-grab-move) | |
249 :type 'hook) | |
250 | |
251 (defcustom gnus-uu-ignore-default-archive-rules nil | |
252 "*Non-nil means that gnus-uu will ignore the default archive unpacking commands. | |
253 Only the user unpacking commands will be consulted. Default is nil." | |
254 :group 'gnus-extract-archive | |
255 :type 'boolean) | |
256 | |
257 (defcustom gnus-uu-kill-carriage-return t | |
258 "*Non-nil means that gnus-uu will strip all carriage returns from articles. | |
259 Default is t." | |
260 :group 'gnus-extract | |
261 :type 'boolean) | |
262 | |
263 (defcustom gnus-uu-view-with-metamail nil | |
264 "*Non-nil means that files will be viewed with metamail. | |
265 The gnus-uu viewing functions will be ignored and gnus-uu will try | |
266 to guess at a content-type based on file name suffixes. Default | |
267 it nil." | |
268 :group 'gnus-extract | |
269 :type 'boolean) | |
270 | |
271 (defcustom gnus-uu-unmark-articles-not-decoded nil | |
272 "*Non-nil means that gnus-uu will mark articles that were unsuccessfully decoded as unread. | |
273 Default is nil." | |
274 :group 'gnus-extract | |
275 :type 'boolean) | |
276 | |
277 (defcustom gnus-uu-correct-stripped-uucode nil | |
278 "*Non-nil means that gnus-uu will *try* to fix uuencoded files that have had trailing spaces deleted. | |
279 Default is nil." | |
280 :group 'gnus-extract | |
281 :type 'boolean) | |
282 | |
283 (defcustom gnus-uu-save-in-digest nil | |
284 "*Non-nil means that gnus-uu, when asked to save without decoding, will save in digests. | |
285 If this variable is nil, gnus-uu will just save everything in a | |
286 file without any embellishments. The digesting almost conforms to RFC1153 - | |
287 no easy way to specify any meaningful volume and issue numbers were found, | |
288 so I simply dropped them." | |
289 :group 'gnus-extract | |
290 :type 'boolean) | |
291 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
292 (defcustom gnus-uu-pre-uudecode-hook nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
293 "Hook run before sending a message to uudecode." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
294 :group 'gnus-extract |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
295 :type 'hook) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
296 |
17493 | 297 (defcustom gnus-uu-digest-headers |
298 '("^Date:" "^From:" "^To:" "^Cc:" "^Subject:" "^Message-ID:" "^Keywords:" | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
299 "^Summary:" "^References:" "^Content-Type:" "^Content-Transfer-Encoding:" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
300 "^MIME-Version:" "^Content-Disposition:" "^Content-Description:" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
301 "^Content-ID:") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
302 "*List of regexps to match headers included in digested messages. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
303 The headers will be included in the sequence they are matched. If nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
304 include all headers." |
17493 | 305 :group 'gnus-extract |
306 :type '(repeat regexp)) | |
307 | |
308 (defcustom gnus-uu-save-separate-articles nil | |
309 "*Non-nil means that gnus-uu will save articles in separate files." | |
310 :group 'gnus-extract | |
311 :type 'boolean) | |
312 | |
313 (defcustom gnus-uu-be-dangerous 'ask | |
314 "*Specifies what to do if unusual situations arise during decoding. | |
315 If nil, be as conservative as possible. If t, ignore things that | |
316 didn't work, and overwrite existing files. Otherwise, ask each time." | |
317 :group 'gnus-extract | |
318 :type '(choice (const :tag "conservative" nil) | |
319 (const :tag "ask" ask) | |
320 (const :tag "liberal" t))) | |
321 | |
322 ;; Internal variables | |
323 | |
324 (defvar gnus-uu-saved-article-name nil) | |
325 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
326 (defvar gnus-uu-begin-string "^begin[ \t]+0?[0-7][0-7][0-7][ \t]+\\(.*\\)$") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
327 (defvar gnus-uu-end-string "^end[ \t]*$") |
17493 | 328 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
329 (defvar gnus-uu-body-line "^M") |
17493 | 330 (let ((i 61)) |
331 (while (> (setq i (1- i)) 0) | |
332 (setq gnus-uu-body-line (concat gnus-uu-body-line "[^a-z]"))) | |
333 (setq gnus-uu-body-line (concat gnus-uu-body-line ".?$"))) | |
334 | |
335 ;"^M.............................................................?$" | |
336 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
337 (defvar gnus-uu-shar-begin-string "^#! */bin/sh") |
17493 | 338 |
339 (defvar gnus-uu-shar-file-name nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
340 (defvar gnus-uu-shar-name-marker |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
341 "begin 0?[0-7][0-7][0-7][ \t]+\\(\\(\\w\\|[.\\:]\\)*\\b\\)") |
17493 | 342 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
343 (defvar gnus-uu-postscript-begin-string "^%!PS-") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
344 (defvar gnus-uu-postscript-end-string "^%%EOF$") |
17493 | 345 |
346 (defvar gnus-uu-file-name nil) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
347 (defvar gnus-uu-uudecode-process nil) |
17493 | 348 (defvar gnus-uu-binhex-article-name nil) |
349 | |
350 (defvar gnus-uu-work-dir nil) | |
351 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
352 (defvar gnus-uu-output-buffer-name " *Gnus UU Output*") |
17493 | 353 |
354 (defvar gnus-uu-default-dir gnus-article-save-directory) | |
355 (defvar gnus-uu-digest-from-subject nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
356 (defvar gnus-uu-digest-buffer nil) |
17493 | 357 |
358 ;; Commands. | |
359 | |
360 (defun gnus-uu-decode-uu (&optional n) | |
361 "Uudecodes the current article." | |
362 (interactive "P") | |
363 (gnus-uu-decode-with-method 'gnus-uu-uustrip-article n)) | |
364 | |
365 (defun gnus-uu-decode-uu-and-save (n dir) | |
366 "Decodes and saves the resulting file." | |
367 (interactive | |
368 (list current-prefix-arg | |
369 (file-name-as-directory | |
370 (read-file-name "Uudecode and save in dir: " | |
371 gnus-uu-default-dir | |
372 gnus-uu-default-dir t)))) | |
373 (gnus-uu-decode-with-method 'gnus-uu-uustrip-article n dir nil nil t)) | |
374 | |
375 (defun gnus-uu-decode-unshar (&optional n) | |
376 "Unshars the current article." | |
377 (interactive "P") | |
378 (gnus-uu-decode-with-method 'gnus-uu-unshar-article n nil nil 'scan t)) | |
379 | |
380 (defun gnus-uu-decode-unshar-and-save (n dir) | |
381 "Unshars and saves the current article." | |
382 (interactive | |
383 (list current-prefix-arg | |
384 (file-name-as-directory | |
385 (read-file-name "Unshar and save in dir: " | |
386 gnus-uu-default-dir | |
387 gnus-uu-default-dir t)))) | |
388 (gnus-uu-decode-with-method 'gnus-uu-unshar-article n dir nil 'scan t)) | |
389 | |
390 (defun gnus-uu-decode-save (n file) | |
391 "Saves the current article." | |
392 (interactive | |
393 (list current-prefix-arg | |
394 (read-file-name | |
395 (if gnus-uu-save-separate-articles | |
396 "Save articles is dir: " | |
397 "Save articles in file: ") | |
398 gnus-uu-default-dir | |
399 gnus-uu-default-dir))) | |
400 (setq gnus-uu-saved-article-name file) | |
401 (gnus-uu-decode-with-method 'gnus-uu-save-article n nil t)) | |
402 | |
403 (defun gnus-uu-decode-binhex (n dir) | |
404 "Unbinhexes the current article." | |
405 (interactive | |
406 (list current-prefix-arg | |
407 (file-name-as-directory | |
408 (read-file-name "Unbinhex and save in dir: " | |
409 gnus-uu-default-dir | |
410 gnus-uu-default-dir)))) | |
411 (setq gnus-uu-binhex-article-name | |
44075
7782e54757bb
* mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38413
diff
changeset
|
412 (mm-make-temp-file (expand-file-name "binhex" gnus-uu-work-dir))) |
17493 | 413 (gnus-uu-decode-with-method 'gnus-uu-binhex-article n dir)) |
414 | |
415 (defun gnus-uu-decode-uu-view (&optional n) | |
416 "Uudecodes and views the current article." | |
417 (interactive "P") | |
418 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic))) | |
419 (gnus-uu-decode-uu n))) | |
420 | |
421 (defun gnus-uu-decode-uu-and-save-view (n dir) | |
422 "Decodes, views and saves the resulting file." | |
423 (interactive | |
424 (list current-prefix-arg | |
425 (read-file-name "Uudecode, view and save in dir: " | |
426 gnus-uu-default-dir | |
427 gnus-uu-default-dir t))) | |
428 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic))) | |
429 (gnus-uu-decode-uu-and-save n dir))) | |
430 | |
431 (defun gnus-uu-decode-unshar-view (&optional n) | |
432 "Unshars and views the current article." | |
433 (interactive "P") | |
434 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic))) | |
435 (gnus-uu-decode-unshar n))) | |
436 | |
437 (defun gnus-uu-decode-unshar-and-save-view (n dir) | |
438 "Unshars and saves the current article." | |
439 (interactive | |
440 (list current-prefix-arg | |
441 (read-file-name "Unshar, view and save in dir: " | |
442 gnus-uu-default-dir | |
443 gnus-uu-default-dir t))) | |
444 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic))) | |
445 (gnus-uu-decode-unshar-and-save n dir))) | |
446 | |
447 (defun gnus-uu-decode-save-view (n file) | |
448 "Saves and views the current article." | |
449 (interactive | |
450 (list current-prefix-arg | |
451 (read-file-name (if gnus-uu-save-separate-articles | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
452 "Save articles is dir: " |
17493 | 453 "Save articles in file: ") |
454 gnus-uu-default-dir gnus-uu-default-dir))) | |
455 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic))) | |
456 (gnus-uu-decode-save n file))) | |
457 | |
458 (defun gnus-uu-decode-binhex-view (n file) | |
459 "Unbinhexes and views the current article." | |
460 (interactive | |
461 (list current-prefix-arg | |
462 (read-file-name "Unbinhex, view and save in dir: " | |
463 gnus-uu-default-dir gnus-uu-default-dir))) | |
464 (setq gnus-uu-binhex-article-name | |
44075
7782e54757bb
* mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38413
diff
changeset
|
465 (mm-make-temp-file (expand-file-name "binhex" gnus-uu-work-dir))) |
17493 | 466 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic))) |
467 (gnus-uu-decode-binhex n file))) | |
468 | |
469 | |
470 ;; Digest and forward articles | |
471 | |
472 (defun gnus-uu-digest-mail-forward (&optional n post) | |
473 "Digests and forwards all articles in this series." | |
474 (interactive "P") | |
475 (let ((gnus-uu-save-in-digest t) | |
44075
7782e54757bb
* mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38413
diff
changeset
|
476 (file (mm-make-temp-file (nnheader-concat gnus-uu-tmp-dir "forward"))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
477 (message-forward-as-mime message-forward-as-mime) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
478 (mail-parse-charset gnus-newsgroup-charset) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
479 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
480 gnus-uu-digest-buffer subject from) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
481 (if (and n (not (numberp n))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
482 (setq message-forward-as-mime (not message-forward-as-mime) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
483 n nil)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
484 (let ((gnus-article-reply (gnus-summary-work-articles n))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
485 (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
|
486 (setq gnus-uu-digest-from-subject nil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
487 (setq gnus-uu-digest-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
488 (gnus-get-buffer-create " *gnus-uu-forward*")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
489 (gnus-uu-decode-save n file) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
490 (switch-to-buffer gnus-uu-digest-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
491 (let ((fs gnus-uu-digest-from-subject)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
492 (when fs |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
493 (setq from (caar fs) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
494 subject (gnus-simplify-subject-fuzzy (cdar fs)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
495 fs (cdr fs)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
496 (while (and fs (or from subject)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
497 (when from |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
498 (unless (string= from (caar fs)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
499 (setq from nil))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
500 (when subject |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
501 (unless (string= (gnus-simplify-subject-fuzzy (cdar fs)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
502 subject) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
503 (setq subject nil))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
504 (setq fs (cdr fs)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
505 (unless subject |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
506 (setq subject "Digested Articles")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
507 (unless from |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
508 (setq from |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
509 (if (gnus-news-group-p 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
|
510 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
|
511 "Various")))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
512 (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
|
513 (when (re-search-forward "^Subject: ") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
514 (delete-region (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
|
515 (insert subject)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
516 (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
|
517 (when (re-search-forward "^From:") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
518 (delete-region (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
|
519 (insert " " from)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
520 (let ((message-forward-decoded-p t)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
521 (message-forward post t)))) |
17493 | 522 (setq gnus-uu-digest-from-subject nil))) |
523 | |
524 (defun gnus-uu-digest-post-forward (&optional n) | |
525 "Digest and forward to a newsgroup." | |
526 (interactive "P") | |
527 (gnus-uu-digest-mail-forward n t)) | |
528 | |
529 ;; Process marking. | |
530 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
531 (defun gnus-message-process-mark (unmarkp new-marked) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
532 (let ((old (- (length gnus-newsgroup-processable) (length new-marked)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
533 (message "%d mark%s %s%s" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
534 (length new-marked) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
535 (if (= (length new-marked) 1) "" "s") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
536 (if unmarkp "removed" "added") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
537 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
538 ((and (zerop old) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
539 (not unmarkp)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
540 "") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
541 (unmarkp |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
542 (format ", %d remain marked" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
543 (length gnus-newsgroup-processable))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
544 (t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
545 (format ", %d already marked" old)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
546 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
547 (defun gnus-new-processable (unmarkp articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
548 (if unmarkp |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
549 (gnus-intersection gnus-newsgroup-processable articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
550 (gnus-set-difference articles gnus-newsgroup-processable))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
551 |
17493 | 552 (defun gnus-uu-mark-by-regexp (regexp &optional unmark) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
553 "Set the process mark on articles whose subjects match REGEXP. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
554 When called interactively, prompt for REGEXP. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
555 Optional UNMARK non-nil means unmark instead of mark." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
556 (interactive "sMark (regexp): \nP") |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
557 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
558 (let* ((articles (gnus-uu-find-articles-matching regexp)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
559 (new-marked (gnus-new-processable unmark articles))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
560 (while articles |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
561 (if unmark |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
562 (gnus-summary-remove-process-mark (pop articles)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
563 (gnus-summary-set-process-mark (pop articles)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
564 (gnus-message-process-mark unmark new-marked))) |
17493 | 565 (gnus-summary-position-point)) |
566 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
567 (defun gnus-uu-unmark-by-regexp (regexp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
568 "Remove the process mark from articles whose subjects match REGEXP. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
569 When called interactively, prompt for REGEXP." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
570 (interactive "sUnmark (regexp): ") |
17493 | 571 (gnus-uu-mark-by-regexp regexp t)) |
572 | |
573 (defun gnus-uu-mark-series () | |
574 "Mark the current series with the process mark." | |
575 (interactive) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
576 (let* ((articles (gnus-uu-find-articles-matching)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
577 (l (length articles))) |
17493 | 578 (while articles |
579 (gnus-summary-set-process-mark (car articles)) | |
580 (setq articles (cdr articles))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
581 (message "Marked %d articles" l)) |
17493 | 582 (gnus-summary-position-point)) |
583 | |
584 (defun gnus-uu-mark-region (beg end &optional unmark) | |
585 "Set the process mark on all articles between point and mark." | |
586 (interactive "r") | |
587 (save-excursion | |
588 (goto-char beg) | |
589 (while (< (point) end) | |
590 (if unmark | |
591 (gnus-summary-remove-process-mark (gnus-summary-article-number)) | |
592 (gnus-summary-set-process-mark (gnus-summary-article-number))) | |
593 (forward-line 1))) | |
594 (gnus-summary-position-point)) | |
595 | |
596 (defun gnus-uu-unmark-region (beg end) | |
597 "Remove the process mark from all articles between point and mark." | |
598 (interactive "r") | |
599 (gnus-uu-mark-region beg end t)) | |
600 | |
601 (defun gnus-uu-mark-buffer () | |
602 "Set the process mark on all articles in the buffer." | |
603 (interactive) | |
604 (gnus-uu-mark-region (point-min) (point-max))) | |
605 | |
606 (defun gnus-uu-unmark-buffer () | |
607 "Remove the process mark on all articles in the buffer." | |
608 (interactive) | |
609 (gnus-uu-mark-region (point-min) (point-max) t)) | |
610 | |
611 (defun gnus-uu-mark-thread () | |
612 "Marks all articles downwards in this thread." | |
613 (interactive) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
614 (gnus-save-hidden-threads |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
615 (let ((level (gnus-summary-thread-level))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
616 (while (and (gnus-summary-set-process-mark |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
617 (gnus-summary-article-number)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
618 (zerop (gnus-summary-next-subject 1 nil t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
619 (> (gnus-summary-thread-level) level))))) |
17493 | 620 (gnus-summary-position-point)) |
621 | |
622 (defun gnus-uu-unmark-thread () | |
623 "Unmarks all articles downwards in this thread." | |
624 (interactive) | |
625 (let ((level (gnus-summary-thread-level))) | |
626 (while (and (gnus-summary-remove-process-mark | |
627 (gnus-summary-article-number)) | |
628 (zerop (gnus-summary-next-subject 1)) | |
629 (> (gnus-summary-thread-level) level)))) | |
630 (gnus-summary-position-point)) | |
631 | |
632 (defun gnus-uu-invert-processable () | |
633 "Invert the list of process-marked articles." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
634 (interactive) |
17493 | 635 (let ((data gnus-newsgroup-data) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
636 number) |
17493 | 637 (save-excursion |
638 (while data | |
639 (if (memq (setq number (gnus-data-number (pop data))) | |
640 gnus-newsgroup-processable) | |
641 (gnus-summary-remove-process-mark number) | |
642 (gnus-summary-set-process-mark number))))) | |
643 (gnus-summary-position-point)) | |
644 | |
645 (defun gnus-uu-mark-over (&optional score) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
646 "Mark all articles with a score over SCORE (the prefix)." |
17493 | 647 (interactive "P") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
648 (let ((score (or score gnus-summary-default-score 0)) |
17493 | 649 (data gnus-newsgroup-data)) |
650 (save-excursion | |
651 (while data | |
652 (when (> (or (cdr (assq (gnus-data-number (car data)) | |
653 gnus-newsgroup-scored)) | |
654 gnus-summary-default-score 0) | |
655 score) | |
656 (gnus-summary-set-process-mark (caar data))) | |
657 (setq data (cdr data)))) | |
658 (gnus-summary-position-point))) | |
659 | |
660 (defun gnus-uu-mark-sparse () | |
661 "Mark all series that have some articles marked." | |
662 (interactive) | |
663 (let ((marked (nreverse gnus-newsgroup-processable)) | |
664 subject articles total headers) | |
665 (unless marked | |
666 (error "No articles marked with the process mark")) | |
667 (setq gnus-newsgroup-processable nil) | |
668 (save-excursion | |
669 (while marked | |
670 (and (vectorp (setq headers | |
671 (gnus-summary-article-header (car marked)))) | |
672 (setq subject (mail-header-subject headers) | |
673 articles (gnus-uu-find-articles-matching | |
674 (gnus-uu-reginize-string subject)) | |
675 total (nconc total articles))) | |
676 (while articles | |
677 (gnus-summary-set-process-mark (car articles)) | |
678 (setcdr marked (delq (car articles) (cdr marked))) | |
679 (setq articles (cdr articles))) | |
680 (setq marked (cdr marked))) | |
681 (setq gnus-newsgroup-processable (nreverse total))) | |
682 (gnus-summary-position-point))) | |
683 | |
684 (defun gnus-uu-mark-all () | |
685 "Mark all articles in \"series\" order." | |
686 (interactive) | |
687 (setq gnus-newsgroup-processable nil) | |
688 (save-excursion | |
689 (let ((data gnus-newsgroup-data) | |
690 number) | |
691 (while data | |
692 (when (and (not (memq (setq number (gnus-data-number (car data))) | |
693 gnus-newsgroup-processable)) | |
694 (vectorp (gnus-data-header (car data)))) | |
695 (gnus-summary-goto-subject number) | |
696 (gnus-uu-mark-series)) | |
697 (setq data (cdr data))))) | |
698 (gnus-summary-position-point)) | |
699 | |
700 ;; All PostScript functions written by Erik Selberg <speed@cs.washington.edu>. | |
701 | |
702 (defun gnus-uu-decode-postscript (&optional n) | |
703 "Gets postscript of the current article." | |
704 (interactive "P") | |
705 (gnus-uu-decode-with-method 'gnus-uu-decode-postscript-article n)) | |
706 | |
707 (defun gnus-uu-decode-postscript-view (&optional n) | |
708 "Gets and views the current article." | |
709 (interactive "P") | |
710 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic))) | |
711 (gnus-uu-decode-postscript n))) | |
712 | |
713 (defun gnus-uu-decode-postscript-and-save (n dir) | |
714 "Extracts postscript and saves the current article." | |
715 (interactive | |
716 (list current-prefix-arg | |
717 (file-name-as-directory | |
718 (read-file-name "Save in dir: " | |
719 gnus-uu-default-dir | |
720 gnus-uu-default-dir t)))) | |
721 (gnus-uu-decode-with-method 'gnus-uu-decode-postscript-article | |
722 n dir nil nil t)) | |
723 | |
724 (defun gnus-uu-decode-postscript-and-save-view (n dir) | |
725 "Decodes, views and saves the resulting file." | |
726 (interactive | |
727 (list current-prefix-arg | |
728 (read-file-name "Where do you want to save the file(s)? " | |
729 gnus-uu-default-dir | |
730 gnus-uu-default-dir t))) | |
731 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic))) | |
732 (gnus-uu-decode-postscript-and-save n dir))) | |
733 | |
734 | |
735 ;; Internal functions. | |
736 | |
737 (defun gnus-uu-decode-with-method (method n &optional save not-insert | |
738 scan cdir) | |
739 (gnus-uu-initialize scan) | |
740 (when save | |
741 (setq gnus-uu-default-dir save)) | |
742 ;; Create the directory we save to. | |
743 (when (and scan cdir save | |
744 (not (file-exists-p save))) | |
745 (make-directory save t)) | |
746 (let ((articles (gnus-uu-get-list-of-articles n)) | |
747 files) | |
748 (setq files (gnus-uu-grab-articles articles method t)) | |
749 (let ((gnus-current-article (car articles))) | |
750 (when scan | |
751 (setq files (gnus-uu-scan-directory gnus-uu-work-dir)))) | |
752 (when save | |
753 (gnus-uu-save-files files save)) | |
754 (when (eq gnus-uu-do-not-unpack-archives nil) | |
755 (setq files (gnus-uu-unpack-files files))) | |
756 (setq files (nreverse (gnus-uu-get-actions files))) | |
757 (or not-insert (not gnus-insert-pseudo-articles) | |
758 (gnus-summary-insert-pseudos files save)))) | |
759 | |
760 (defun gnus-uu-scan-directory (dir &optional rec) | |
761 "Return a list of all files under DIR." | |
762 (let ((files (directory-files dir t)) | |
763 out file) | |
764 (while (setq file (pop files)) | |
765 (unless (member (file-name-nondirectory file) '("." "..")) | |
766 (push (list (cons 'name file) | |
767 (cons 'article gnus-current-article)) | |
768 out) | |
769 (when (file-directory-p file) | |
770 (setq out (nconc (gnus-uu-scan-directory file t) out))))) | |
771 (if rec | |
772 out | |
773 (nreverse out)))) | |
774 | |
775 (defun gnus-uu-save-files (files dir) | |
776 "Save FILES in DIR." | |
777 (let ((len (length files)) | |
778 (reg (concat "^" (regexp-quote gnus-uu-work-dir))) | |
779 to-file file fromdir) | |
780 (while (setq file (cdr (assq 'name (pop files)))) | |
781 (when (file-exists-p file) | |
782 (string-match reg file) | |
783 (setq fromdir (substring file (match-end 0))) | |
784 (if (file-directory-p file) | |
785 (gnus-make-directory (concat dir fromdir)) | |
786 (setq to-file (concat dir fromdir)) | |
787 (when (or (not (file-exists-p to-file)) | |
788 (eq gnus-uu-be-dangerous t) | |
789 (and gnus-uu-be-dangerous | |
790 (gnus-y-or-n-p (format "%s exists; overwrite? " | |
791 to-file)))) | |
792 (copy-file file to-file t t))))) | |
793 (gnus-message 5 "Saved %d file%s" len (if (= len 1) "" "s")))) | |
794 | |
795 ;; Functions for saving and possibly digesting articles without | |
796 ;; any decoding. | |
797 | |
798 ;; Function called by gnus-uu-grab-articles to treat each article. | |
799 (defun gnus-uu-save-article (buffer in-state) | |
800 (cond | |
801 (gnus-uu-save-separate-articles | |
802 (save-excursion | |
803 (set-buffer buffer) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
804 (let ((coding-system-for-write mm-text-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
805 (gnus-write-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
806 (concat gnus-uu-saved-article-name gnus-current-article))) |
17493 | 807 (cond ((eq in-state 'first) (list gnus-uu-saved-article-name 'begin)) |
808 ((eq in-state 'first-and-last) (list gnus-uu-saved-article-name | |
809 'begin 'end)) | |
810 ((eq in-state 'last) (list 'end)) | |
811 (t (list 'middle))))) | |
812 ((not gnus-uu-save-in-digest) | |
813 (save-excursion | |
814 (set-buffer buffer) | |
815 (write-region (point-min) (point-max) gnus-uu-saved-article-name t) | |
816 (cond ((eq in-state 'first) (list gnus-uu-saved-article-name 'begin)) | |
817 ((eq in-state 'first-and-last) (list gnus-uu-saved-article-name | |
818 'begin 'end)) | |
819 ((eq in-state 'last) (list 'end)) | |
820 (t (list 'middle))))) | |
821 (t | |
822 (let ((header (gnus-summary-article-header))) | |
823 (push (cons (mail-header-from header) | |
824 (mail-header-subject header)) | |
825 gnus-uu-digest-from-subject)) | |
826 (let ((name (file-name-nondirectory gnus-uu-saved-article-name)) | |
827 beg subj headers headline sorthead body end-string state) | |
828 (if (or (eq in-state 'first) | |
829 (eq in-state 'first-and-last)) | |
830 (progn | |
831 (setq state (list 'begin)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
832 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
833 (set-buffer (gnus-get-buffer-create "*gnus-uu-body*")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
834 (erase-buffer)) |
17493 | 835 (save-excursion |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
836 (set-buffer (gnus-get-buffer-create "*gnus-uu-pre*")) |
17493 | 837 (erase-buffer) |
838 (insert (format | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
839 "Date: %s\nFrom: %s\nSubject: %s Digest\n\n" |
64780
4def766e2c3f
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-515
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
840 (message-make-date) name name)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
841 (when (and message-forward-as-mime gnus-uu-digest-buffer) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
842 (insert "<#part type=message/rfc822>\nSubject: Topics\n\n")) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
843 (insert "Topics:\n"))) |
17493 | 844 (when (not (eq in-state 'end)) |
845 (setq state (list 'middle)))) | |
846 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
847 (set-buffer "*gnus-uu-body*") |
17493 | 848 (goto-char (setq beg (point-max))) |
849 (save-excursion | |
850 (save-restriction | |
851 (set-buffer buffer) | |
852 (let (buffer-read-only) | |
853 (gnus-set-text-properties (point-min) (point-max) nil) | |
854 ;; These two are necessary for XEmacs 19.12 fascism. | |
855 (put-text-property (point-min) (point-max) 'invisible nil) | |
856 (put-text-property (point-min) (point-max) 'intangible nil)) | |
35957
a35d9c07d074
2001-02-07 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33765
diff
changeset
|
857 (when (and message-forward-as-mime |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
858 message-forward-show-mml |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
859 gnus-uu-digest-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
860 (mm-enable-multibyte) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
861 (mime-to-mml)) |
17493 | 862 (goto-char (point-min)) |
863 (re-search-forward "\n\n") | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
864 (unless (and message-forward-as-mime gnus-uu-digest-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
865 ;; Quote all 30-dash lines. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
866 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
867 (while (re-search-forward "^-" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
868 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
869 (delete-char 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
870 (insert "- ")))) |
17493 | 871 (setq body (buffer-substring (1- (point)) (point-max))) |
872 (narrow-to-region (point-min) (point)) | |
873 (if (not (setq headers gnus-uu-digest-headers)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
874 (setq sorthead (buffer-string)) |
17493 | 875 (while headers |
876 (setq headline (car headers)) | |
877 (setq headers (cdr headers)) | |
878 (goto-char (point-min)) | |
879 (while (re-search-forward headline nil t) | |
880 (setq sorthead | |
881 (concat sorthead | |
882 (buffer-substring | |
883 (match-beginning 0) | |
884 (or (and (re-search-forward "^[^ \t]" nil t) | |
885 (1- (point))) | |
886 (progn (forward-line 1) (point))))))))) | |
887 (widen))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
888 (if (and message-forward-as-mime gnus-uu-digest-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
889 (if message-forward-show-mml |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
890 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
891 (insert "\n<#mml type=message/rfc822>\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
892 (insert sorthead) (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
893 (insert body) (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
894 (insert "\n<#/mml>\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
895 (let ((buf (mml-generate-new-buffer " *mml*"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
896 (with-current-buffer buf |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
897 (insert sorthead) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
898 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
899 (when (re-search-forward "^Subject: \\(.*\\)$" nil t) |
35957
a35d9c07d074
2001-02-07 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33765
diff
changeset
|
900 (setq subj (buffer-substring (match-beginning 1) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
901 (match-end 1)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
902 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
903 (insert body)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
904 (insert "\n<#part type=message/rfc822" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
905 " buffer=\"" (buffer-name buf) "\">\n"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
906 (insert sorthead) (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
907 (insert body) (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
908 (insert (concat "\n" (make-string 30 ?-) "\n\n"))) |
17493 | 909 (goto-char beg) |
910 (when (re-search-forward "^Subject: \\(.*\\)$" nil t) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
911 (setq subj (buffer-substring (match-beginning 1) (match-end 1)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
912 (when subj |
17493 | 913 (save-excursion |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
914 (set-buffer "*gnus-uu-pre*") |
17493 | 915 (insert (format " %s\n" subj))))) |
916 (when (or (eq in-state 'last) | |
917 (eq in-state 'first-and-last)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
918 (if (and message-forward-as-mime gnus-uu-digest-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
919 (with-current-buffer gnus-uu-digest-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
920 (erase-buffer) |
64712
4db92b217e85
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
921 (insert-buffer-substring "*gnus-uu-pre*") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
922 (goto-char (point-max)) |
64712
4db92b217e85
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
923 (insert-buffer-substring "*gnus-uu-body*")) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
924 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
925 (set-buffer "*gnus-uu-pre*") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
926 (insert (format "\n\n%s\n\n" (make-string 70 ?-))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
927 (if gnus-uu-digest-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
928 (with-current-buffer gnus-uu-digest-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
929 (erase-buffer) |
64712
4db92b217e85
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
930 (insert-buffer-substring "*gnus-uu-pre*")) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
931 (let ((coding-system-for-write mm-text-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
932 (gnus-write-buffer gnus-uu-saved-article-name)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
933 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
934 (set-buffer "*gnus-uu-body*") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
935 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
936 (insert |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
937 (concat (setq end-string (format "End of %s Digest" name)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
938 "\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
939 (insert (concat (make-string (length end-string) ?*) "\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
940 (if gnus-uu-digest-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
941 (with-current-buffer gnus-uu-digest-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
942 (goto-char (point-max)) |
64712
4db92b217e85
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
943 (insert-buffer-substring "*gnus-uu-body*")) |
35957
a35d9c07d074
2001-02-07 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33765
diff
changeset
|
944 (let ((coding-system-for-write mm-text-coding-system) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
945 (file-name-coding-system nnmail-pathname-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
946 (write-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
947 (point-min) (point-max) gnus-uu-saved-article-name t))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
948 (gnus-kill-buffer "*gnus-uu-pre*") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
949 (gnus-kill-buffer "*gnus-uu-body*") |
17493 | 950 (push 'end state)) |
951 (if (memq 'begin state) | |
952 (cons gnus-uu-saved-article-name state) | |
953 state))))) | |
954 | |
955 ;; Binhex treatment - not very advanced. | |
956 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
957 (defvar gnus-uu-binhex-body-line |
17493 | 958 "^[^:]...............................................................$") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
959 (defvar gnus-uu-binhex-begin-line |
17493 | 960 "^:...............................................................$") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
961 (defvar gnus-uu-binhex-end-line |
17493 | 962 ":$") |
963 | |
964 (defun gnus-uu-binhex-article (buffer in-state) | |
965 (let (state start-char) | |
966 (save-excursion | |
967 (set-buffer buffer) | |
968 (widen) | |
969 (goto-char (point-min)) | |
970 (when (not (re-search-forward gnus-uu-binhex-begin-line nil t)) | |
971 (when (not (re-search-forward gnus-uu-binhex-body-line nil t)) | |
972 (setq state (list 'wrong-type)))) | |
973 | |
974 (if (memq 'wrong-type state) | |
975 () | |
976 (beginning-of-line) | |
977 (setq start-char (point)) | |
978 (if (looking-at gnus-uu-binhex-begin-line) | |
979 (progn | |
980 (setq state (list 'begin)) | |
44514
8bfbcb957964
(gnus-uu-binhex-article, gnus-uu-reginize-string, gnus-uu-expand-numbers)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44075
diff
changeset
|
981 (write-region (point-min) (point-min) |
8bfbcb957964
(gnus-uu-binhex-article, gnus-uu-reginize-string, gnus-uu-expand-numbers)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44075
diff
changeset
|
982 gnus-uu-binhex-article-name)) |
17493 | 983 (setq state (list 'middle))) |
984 (goto-char (point-max)) | |
985 (re-search-backward (concat gnus-uu-binhex-body-line "\\|" | |
986 gnus-uu-binhex-end-line) | |
987 nil t) | |
988 (when (looking-at gnus-uu-binhex-end-line) | |
989 (setq state (if (memq 'begin state) | |
990 (cons 'end state) | |
991 (list 'end)))) | |
992 (beginning-of-line) | |
993 (forward-line 1) | |
994 (when (file-exists-p gnus-uu-binhex-article-name) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
995 (mm-append-to-file start-char (point) gnus-uu-binhex-article-name)))) |
17493 | 996 (if (memq 'begin state) |
997 (cons gnus-uu-binhex-article-name state) | |
998 state))) | |
999 | |
1000 ;; PostScript | |
1001 | |
1002 (defun gnus-uu-decode-postscript-article (process-buffer in-state) | |
1003 (let ((state (list 'ok)) | |
1004 start-char end-char file-name) | |
1005 (save-excursion | |
1006 (set-buffer process-buffer) | |
1007 (goto-char (point-min)) | |
1008 (if (not (re-search-forward gnus-uu-postscript-begin-string nil t)) | |
1009 (setq state (list 'wrong-type)) | |
1010 (beginning-of-line) | |
1011 (setq start-char (point)) | |
1012 (if (not (re-search-forward gnus-uu-postscript-end-string nil t)) | |
1013 (setq state (list 'wrong-type)) | |
1014 (setq end-char (point)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1015 (set-buffer (gnus-get-buffer-create gnus-uu-output-buffer-name)) |
17493 | 1016 (insert-buffer-substring process-buffer start-char end-char) |
1017 (setq file-name (concat gnus-uu-work-dir | |
1018 (cdr gnus-article-current) ".ps")) | |
1019 (write-region (point-min) (point-max) file-name) | |
1020 (setq state (list file-name 'begin 'end))))) | |
1021 state)) | |
1022 | |
1023 | |
1024 ;; Find actions. | |
1025 | |
1026 (defun gnus-uu-get-actions (files) | |
1027 (let ((ofiles files) | |
1028 action name) | |
1029 (while files | |
1030 (setq name (cdr (assq 'name (car files)))) | |
1031 (and | |
1032 (setq action (gnus-uu-get-action name)) | |
1033 (setcar files (nconc (list (if (string= action "gnus-uu-archive") | |
1034 (cons 'action "file") | |
1035 (cons 'action action)) | |
1036 (cons 'execute (gnus-uu-command | |
1037 action name))) | |
1038 (car files)))) | |
1039 (setq files (cdr files))) | |
1040 ofiles)) | |
1041 | |
1042 (defun gnus-uu-get-action (file-name) | |
1043 (let (action) | |
1044 (setq action | |
1045 (gnus-uu-choose-action | |
1046 file-name | |
1047 (append | |
1048 gnus-uu-user-view-rules | |
1049 (if gnus-uu-ignore-default-view-rules | |
1050 nil | |
1051 gnus-uu-default-view-rules) | |
1052 gnus-uu-user-view-rules-end))) | |
1053 (when (and (not (string= (or action "") "gnus-uu-archive")) | |
1054 gnus-uu-view-with-metamail) | |
1055 (when (setq action | |
1056 (gnus-uu-choose-action file-name gnus-uu-ext-to-mime-list)) | |
1057 (setq action (format "metamail -d -b -c \"%s\"" action)))) | |
1058 action)) | |
1059 | |
1060 | |
1061 ;; Functions for treating subjects and collecting series. | |
1062 | |
1063 (defun gnus-uu-reginize-string (string) | |
1064 ;; Takes a string and puts a \ in front of every special character; | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1065 ;; replaces the last thing that looks like "2/3" with "[0-9]+/3" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1066 ;; or, if it can't find something like that, tries "2 of 3", then |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1067 ;; finally just replaces the next to last number with "[0-9]+". |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1068 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1069 (set-buffer (gnus-get-buffer-create gnus-uu-output-buffer-name)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1070 (buffer-disable-undo) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1071 (erase-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1072 (insert (regexp-quote string)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1073 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1074 (setq case-fold-search nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1075 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1076 (end-of-line) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1077 (if (re-search-backward "\\([^0-9]\\)[0-9]+/\\([0-9]+\\)" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1078 (replace-match "\\1[0-9]+/\\2") |
17493 | 1079 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1080 (end-of-line) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1081 (if (re-search-backward "\\([^0-9]\\)[0-9]+[ \t]*of[ \t]*\\([0-9]+\\)" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1082 nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1083 (replace-match "\\1[0-9]+ of \\2") |
17493 | 1084 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1085 (end-of-line) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1086 (if (re-search-backward "\\([^0-9]\\)[0-9]+\\([^0-9]+\\)[0-9]+" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1087 nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1088 (replace-match "\\1[0-9]+\\2[0-9]+" t nil nil nil)))) |
17493 | 1089 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1090 (goto-char 1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1091 (while (re-search-forward "[ \t]+" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1092 (replace-match "[ \t]+" t t)) |
17493 | 1093 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1094 (buffer-string))) |
17493 | 1095 |
1096 (defun gnus-uu-get-list-of-articles (n) | |
1097 ;; If N is non-nil, the article numbers of the N next articles | |
1098 ;; will be returned. | |
1099 ;; If any articles have been marked as processable, they will be | |
1100 ;; returned. | |
1101 ;; Failing that, articles that have subjects that are part of the | |
1102 ;; same "series" as the current will be returned. | |
1103 (let (articles) | |
1104 (cond | |
1105 (n | |
1106 (setq n (prefix-numeric-value n)) | |
1107 (let ((backward (< n 0)) | |
1108 (n (abs n))) | |
1109 (save-excursion | |
1110 (while (and (> n 0) | |
1111 (push (gnus-summary-article-number) | |
1112 articles) | |
1113 (gnus-summary-search-forward nil nil backward)) | |
1114 (setq n (1- n)))) | |
1115 (nreverse articles))) | |
1116 (gnus-newsgroup-processable | |
1117 (reverse gnus-newsgroup-processable)) | |
1118 (t | |
1119 (gnus-uu-find-articles-matching))))) | |
1120 | |
1121 (defun gnus-uu-string< (l1 l2) | |
1122 (string< (car l1) (car l2))) | |
1123 | |
1124 (defun gnus-uu-find-articles-matching | |
1125 (&optional subject only-unread do-not-translate) | |
1126 ;; Finds all articles that matches the regexp SUBJECT. If it is | |
1127 ;; nil, the current article name will be used. If ONLY-UNREAD is | |
1128 ;; non-nil, only unread articles are chosen. If DO-NOT-TRANSLATE is | |
1129 ;; non-nil, article names are not equalized before sorting. | |
1130 (let ((subject (or subject | |
1131 (gnus-uu-reginize-string (gnus-summary-article-subject)))) | |
1132 list-of-subjects) | |
1133 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1134 (when subject |
17493 | 1135 ;; Collect all subjects matching subject. |
1136 (let ((case-fold-search t) | |
1137 (data gnus-newsgroup-data) | |
1138 subj mark d) | |
1139 (while data | |
1140 (setq d (pop data)) | |
1141 (and (not (gnus-data-pseudo-p d)) | |
1142 (or (not only-unread) | |
1143 (= (setq mark (gnus-data-mark d)) | |
1144 gnus-unread-mark) | |
1145 (= mark gnus-ticked-mark) | |
1146 (= mark gnus-dormant-mark)) | |
1147 (setq subj (mail-header-subject (gnus-data-header d))) | |
1148 (string-match subject subj) | |
1149 (push (cons subj (gnus-data-number d)) | |
1150 list-of-subjects)))) | |
1151 | |
1152 ;; Expand numbers, sort, and return the list of article | |
1153 ;; numbers. | |
1154 (mapcar (lambda (sub) (cdr sub)) | |
1155 (sort (gnus-uu-expand-numbers | |
1156 list-of-subjects | |
1157 (not do-not-translate)) | |
1158 'gnus-uu-string<)))))) | |
1159 | |
1160 (defun gnus-uu-expand-numbers (string-list &optional translate) | |
1161 ;; Takes a list of strings and "expands" all numbers in all the | |
1162 ;; strings. That is, this function makes all numbers equal length by | |
1163 ;; prepending lots of zeroes before each number. This is to ease later | |
1164 ;; sorting to find out what sequence the articles are supposed to be | |
1165 ;; decoded in. Returns the list of expanded strings. | |
1166 (let ((out-list string-list) | |
1167 string) | |
1168 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1169 (set-buffer (gnus-get-buffer-create gnus-uu-output-buffer-name)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1170 (buffer-disable-undo) |
17493 | 1171 (while string-list |
1172 (erase-buffer) | |
1173 (insert (caar string-list)) | |
1174 ;; Translate multiple spaces to one space. | |
1175 (goto-char (point-min)) | |
1176 (while (re-search-forward "[ \t]+" nil t) | |
1177 (replace-match " ")) | |
1178 ;; Translate all characters to "a". | |
1179 (goto-char (point-min)) | |
1180 (when translate | |
1181 (while (re-search-forward "[A-Za-z]" nil t) | |
1182 (replace-match "a" t t))) | |
1183 ;; Expand numbers. | |
1184 (goto-char (point-min)) | |
1185 (while (re-search-forward "[0-9]+" nil t) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1186 (ignore-errors |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1187 (replace-match |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1188 (format "%06d" |
62907
88db2adda4b7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
1189 (string-to-number (buffer-substring |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1190 (match-beginning 0) (match-end 0))))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1191 (setq string (buffer-substring 1 (point-max))) |
17493 | 1192 (setcar (car string-list) string) |
1193 (setq string-list (cdr string-list)))) | |
1194 out-list)) | |
1195 | |
1196 | |
1197 ;; `gnus-uu-grab-articles' is the general multi-article treatment | |
1198 ;; function. It takes a list of articles to be grabbed and a function | |
1199 ;; to apply to each article. | |
1200 ;; | |
1201 ;; The function to be called should take two parameters. The first | |
1202 ;; parameter is the article buffer. The function should leave the | |
1203 ;; result, if any, in this buffer. Most treatment functions will just | |
1204 ;; generate files... | |
1205 ;; | |
1206 ;; The second parameter is the state of the list of articles, and can | |
1207 ;; have four values: `first', `middle', `last' and `first-and-last'. | |
1208 ;; | |
1209 ;; The function should return a list. The list may contain the | |
1210 ;; following symbols: | |
1211 ;; `error' if an error occurred | |
1212 ;; `begin' if the beginning of an encoded file has been received | |
1213 ;; If the list returned contains a `begin', the first element of | |
1214 ;; the list *must* be a string with the file name of the decoded | |
1215 ;; file. | |
1216 ;; `end' if the end of an encoded file has been received | |
1217 ;; `middle' if the article was a body part of an encoded file | |
1218 ;; `wrong-type' if the article was not a part of an encoded file | |
1219 ;; `ok', which can be used everything is ok | |
1220 | |
1221 (defvar gnus-uu-has-been-grabbed nil) | |
1222 | |
1223 (defun gnus-uu-unmark-list-of-grabbed (&optional dont-unmark-last-article) | |
1224 (let (art) | |
1225 (if (not (and gnus-uu-has-been-grabbed | |
1226 gnus-uu-unmark-articles-not-decoded)) | |
1227 () | |
1228 (when dont-unmark-last-article | |
1229 (setq art (car gnus-uu-has-been-grabbed)) | |
1230 (setq gnus-uu-has-been-grabbed (cdr gnus-uu-has-been-grabbed))) | |
1231 (while gnus-uu-has-been-grabbed | |
1232 (gnus-summary-tick-article (car gnus-uu-has-been-grabbed) t) | |
1233 (setq gnus-uu-has-been-grabbed (cdr gnus-uu-has-been-grabbed))) | |
1234 (when dont-unmark-last-article | |
1235 (setq gnus-uu-has-been-grabbed (list art)))))) | |
1236 | |
1237 ;; This function takes a list of articles and a function to apply to | |
1238 ;; each article grabbed. | |
1239 ;; | |
1240 ;; This function returns a list of files decoded if the grabbing and | |
1241 ;; the process-function has been successful and nil otherwise. | |
1242 (defun gnus-uu-grab-articles (articles process-function | |
1243 &optional sloppy limit no-errors) | |
1244 (let ((state 'first) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1245 (gnus-asynchronous nil) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1246 (gnus-inhibit-treatment t) |
17493 | 1247 has-been-begin article result-file result-files process-state |
1248 gnus-summary-display-article-function | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1249 gnus-article-prepare-hook gnus-display-mime-function |
17493 | 1250 article-series files) |
1251 | |
1252 (while (and articles | |
1253 (not (memq 'error process-state)) | |
1254 (or sloppy | |
1255 (not (memq 'end process-state)))) | |
1256 | |
1257 (setq article (pop articles)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1258 (when (vectorp (gnus-summary-article-header article)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1259 (push article article-series) |
17493 | 1260 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1261 (unless articles |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1262 (if (eq state 'first) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1263 (setq state 'first-and-last) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1264 (setq state 'last))) |
17493 | 1265 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1266 (let ((part (gnus-uu-part-number article))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1267 (gnus-message 6 "Getting article %d%s..." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1268 article (if (string= part "") "" (concat ", " part)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1269 (gnus-summary-display-article article) |
17493 | 1270 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1271 ;; Push the article to the processing function. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1272 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1273 (set-buffer gnus-original-article-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1274 (let ((buffer-read-only nil)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1275 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1276 (set-buffer gnus-summary-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1277 (setq process-state |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1278 (funcall process-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1279 gnus-original-article-buffer state))))) |
17493 | 1280 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1281 (gnus-summary-remove-process-mark article) |
17493 | 1282 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1283 ;; If this is the beginning of a decoded file, we push it |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1284 ;; on to a list. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1285 (when (or (memq 'begin process-state) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1286 (and (or (eq state 'first) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1287 (eq state 'first-and-last)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1288 (memq 'ok process-state))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1289 (when has-been-begin |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1290 ;; If there is a `result-file' here, that means that the |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1291 ;; file was unsuccessfully decoded, so we delete it. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1292 (when (and result-file |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1293 (file-exists-p result-file) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1294 (not gnus-uu-be-dangerous) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1295 (or (eq gnus-uu-be-dangerous t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1296 (gnus-y-or-n-p |
65688
41260182da5b
2005-09-25 Romain Francoise <romain@orebokech.com>
Romain Francoise <romain@orebokech.com>
parents:
64780
diff
changeset
|
1297 (format "Delete unsuccessfully decoded file %s? " |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1298 result-file)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1299 (delete-file result-file))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1300 (when (memq 'begin process-state) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1301 (setq result-file (car process-state))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1302 (setq has-been-begin t)) |
17493 | 1303 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1304 ;; Check whether we have decoded one complete file. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1305 (when (memq 'end process-state) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1306 (setq article-series nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1307 (setq has-been-begin nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1308 (if (stringp result-file) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1309 (setq files (list result-file)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1310 (setq files result-file)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1311 (setq result-file (car files)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1312 (while files |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1313 (push (list (cons 'name (pop files)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1314 (cons 'article article)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1315 result-files)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1316 ;; Allow user-defined functions to be run on this file. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1317 (when gnus-uu-grabbed-file-functions |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1318 (let ((funcs gnus-uu-grabbed-file-functions)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1319 (unless (listp funcs) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1320 (setq funcs (list funcs))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1321 (while funcs |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1322 (funcall (pop funcs) result-file)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1323 (setq result-file nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1324 ;; Check whether we have decoded enough articles. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1325 (and limit (= (length result-files) limit) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1326 (setq articles nil))) |
17493 | 1327 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1328 ;; If this is the last article to be decoded, and |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1329 ;; we still haven't reached the end, then we delete |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1330 ;; the partially decoded file. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1331 (and (or (eq state 'last) (eq state 'first-and-last)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1332 (not (memq 'end process-state)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1333 result-file |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1334 (file-exists-p result-file) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1335 (not gnus-uu-be-dangerous) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1336 (or (eq gnus-uu-be-dangerous t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1337 (gnus-y-or-n-p |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1338 (format "Delete incomplete file %s? " result-file))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1339 (delete-file result-file)) |
17493 | 1340 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1341 ;; If this was a file of the wrong sort, then |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1342 (when (and (or (memq 'wrong-type process-state) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1343 (memq 'error process-state)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1344 gnus-uu-unmark-articles-not-decoded) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1345 (gnus-summary-tick-article article t)) |
17493 | 1346 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1347 ;; Set the new series state. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1348 (if (and (not has-been-begin) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1349 (not sloppy) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1350 (or (memq 'end process-state) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1351 (memq 'middle process-state))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1352 (progn |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1353 (setq process-state (list 'error)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1354 (gnus-message 2 "No begin part at the beginning") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1355 (sleep-for 2)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1356 (setq state 'middle)))) |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64712
diff
changeset
|
1357 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1358 ;; When there are no result-files, then something must be wrong. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1359 (if result-files |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1360 (message "") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1361 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1362 ((not has-been-begin) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1363 (gnus-message 2 "Wrong type file")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1364 ((memq 'error process-state) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1365 (gnus-message 2 "An error occurred during decoding")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1366 ((not (or (memq 'ok process-state) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1367 (memq 'end process-state))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1368 (gnus-message 2 "End of articles reached before end of file"))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1369 ;; Make unsuccessfully decoded articles unread. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1370 (when gnus-uu-unmark-articles-not-decoded |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1371 (while article-series |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1372 (gnus-summary-tick-article (pop article-series) t)))) |
17493 | 1373 |
35957
a35d9c07d074
2001-02-07 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33765
diff
changeset
|
1374 ;; The original article buffer is hosed, shoot it down. |
a35d9c07d074
2001-02-07 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33765
diff
changeset
|
1375 (gnus-kill-buffer gnus-original-article-buffer) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1376 (setq gnus-current-article nil) |
17493 | 1377 result-files)) |
1378 | |
1379 (defun gnus-uu-grab-view (file) | |
1380 "View FILE using the gnus-uu methods." | |
1381 (let ((action (gnus-uu-get-action file))) | |
1382 (gnus-execute-command | |
1383 (if (string-match "%" action) | |
1384 (format action file) | |
1385 (concat action " " file)) | |
1386 (eq gnus-view-pseudos 'not-confirm)))) | |
1387 | |
1388 (defun gnus-uu-grab-move (file) | |
1389 "Move FILE to somewhere." | |
1390 (when gnus-uu-default-dir | |
1391 (let ((to-file (concat (file-name-as-directory gnus-uu-default-dir) | |
1392 (file-name-nondirectory file)))) | |
1393 (rename-file file to-file) | |
1394 (unless (file-exists-p file) | |
1395 (make-symbolic-link to-file file))))) | |
1396 | |
1397 (defun gnus-uu-part-number (article) | |
1398 (let* ((header (gnus-summary-article-header article)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1399 (subject (and header (mail-header-subject header))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1400 (part nil)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1401 (if subject |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1402 (while (string-match "[0-9]+/[0-9]+\\|[0-9]+[ \t]+of[ \t]+[0-9]+" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1403 subject) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1404 (setq part (match-string 0 subject)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1405 (setq subject (substring subject (match-end 0))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1406 (or part |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1407 (while (string-match "\\([0-9]+\\)[^0-9]+\\([0-9]+\\)" subject) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1408 (setq part (match-string 0 subject)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1409 (setq subject (substring subject (match-end 0))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1410 (or part ""))) |
17493 | 1411 |
1412 (defun gnus-uu-uudecode-sentinel (process event) | |
1413 (delete-process (get-process process))) | |
1414 | |
1415 (defun gnus-uu-uustrip-article (process-buffer in-state) | |
1416 ;; Uudecodes a file asynchronously. | |
1417 (save-excursion | |
1418 (set-buffer process-buffer) | |
1419 (let ((state (list 'wrong-type)) | |
1420 process-connection-type case-fold-search buffer-read-only | |
1421 files start-char) | |
1422 (goto-char (point-min)) | |
1423 | |
1424 ;; Deal with ^M at the end of the lines. | |
1425 (when gnus-uu-kill-carriage-return | |
1426 (save-excursion | |
1427 (while (search-forward "\r" nil t) | |
1428 (delete-backward-char 1)))) | |
1429 | |
1430 (while (or (re-search-forward gnus-uu-begin-string nil t) | |
1431 (re-search-forward gnus-uu-body-line nil t)) | |
1432 (setq state (list 'ok)) | |
1433 ;; Ok, we are at the first uucoded line. | |
1434 (beginning-of-line) | |
1435 (setq start-char (point)) | |
1436 | |
1437 (if (not (looking-at gnus-uu-begin-string)) | |
1438 (setq state (list 'middle)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
1439 ;; This is the beginning of a uuencoded article. |
17493 | 1440 ;; We replace certain characters that could make things messy. |
1441 (setq gnus-uu-file-name | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1442 (gnus-map-function |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64712
diff
changeset
|
1443 mm-file-name-rewrite-functions |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1444 (file-name-nondirectory (match-string 1)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1445 (replace-match (concat "begin 644 " gnus-uu-file-name) t t) |
17493 | 1446 |
1447 ;; Remove any non gnus-uu-body-line right after start. | |
1448 (forward-line 1) | |
1449 (while (and (not (eobp)) | |
1450 (not (looking-at gnus-uu-body-line))) | |
1451 (gnus-delete-line)) | |
1452 | |
1453 ;; If a process is running, we kill it. | |
1454 (when (and gnus-uu-uudecode-process | |
1455 (memq (process-status gnus-uu-uudecode-process) | |
1456 '(run stop))) | |
1457 (delete-process gnus-uu-uudecode-process) | |
1458 (gnus-uu-unmark-list-of-grabbed t)) | |
1459 | |
1460 ;; Start a new uudecoding process. | |
1461 (let ((cdir default-directory)) | |
1462 (unwind-protect | |
1463 (progn | |
1464 (cd gnus-uu-work-dir) | |
1465 (setq gnus-uu-uudecode-process | |
1466 (start-process | |
1467 "*uudecode*" | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1468 (gnus-get-buffer-create gnus-uu-output-buffer-name) |
17493 | 1469 shell-file-name shell-command-switch |
1470 (format "cd %s %s uudecode" gnus-uu-work-dir | |
1471 gnus-shell-command-separator)))) | |
1472 (cd cdir))) | |
1473 (set-process-sentinel | |
1474 gnus-uu-uudecode-process 'gnus-uu-uudecode-sentinel) | |
1475 (setq state (list 'begin)) | |
1476 (push (concat gnus-uu-work-dir gnus-uu-file-name) files)) | |
1477 | |
1478 ;; We look for the end of the thing to be decoded. | |
1479 (if (re-search-forward gnus-uu-end-string nil t) | |
1480 (push 'end state) | |
1481 (goto-char (point-max)) | |
1482 (re-search-backward gnus-uu-body-line nil t)) | |
1483 | |
1484 (forward-line 1) | |
1485 | |
1486 (when gnus-uu-uudecode-process | |
1487 (when (memq (process-status gnus-uu-uudecode-process) '(run stop)) | |
1488 ;; Try to correct mishandled uucode. | |
1489 (when gnus-uu-correct-stripped-uucode | |
1490 (gnus-uu-check-correct-stripped-uucode start-char (point))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1491 (gnus-run-hooks 'gnus-uu-pre-uudecode-hook) |
17493 | 1492 |
1493 ;; Send the text to the process. | |
1494 (condition-case nil | |
1495 (process-send-region | |
1496 gnus-uu-uudecode-process start-char (point)) | |
1497 (error | |
1498 (progn | |
1499 (delete-process gnus-uu-uudecode-process) | |
1500 (gnus-message 2 "gnus-uu: Couldn't uudecode") | |
1501 (setq state (list 'wrong-type))))) | |
1502 | |
1503 (if (memq 'end state) | |
1504 (progn | |
1505 ;; Send an EOF, just in case. | |
1506 (ignore-errors | |
1507 (process-send-eof gnus-uu-uudecode-process)) | |
1508 (while (memq (process-status gnus-uu-uudecode-process) | |
1509 '(open run)) | |
1510 (accept-process-output gnus-uu-uudecode-process 1))) | |
1511 (when (or (not gnus-uu-uudecode-process) | |
1512 (not (memq (process-status gnus-uu-uudecode-process) | |
1513 '(run stop)))) | |
1514 (setq state (list 'wrong-type))))))) | |
1515 | |
1516 (if (memq 'begin state) | |
1517 (cons (if (= (length files) 1) (car files) files) state) | |
1518 state)))) | |
1519 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1520 (defvar gnus-uu-unshar-warning |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1521 "*** WARNING *** |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1522 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1523 Shell archives are an archaic method of bundling files for distribution |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1524 across computer networks. During the unpacking process, arbitrary commands |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1525 are executed on your system, and all kinds of nasty things can happen. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1526 Please examine the archive very carefully before you instruct Emacs to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1527 unpack it. You can browse the archive buffer using \\[scroll-other-window]. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1528 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1529 If you are unsure what to do, please answer \"no\"." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1530 "Text of warning message displayed by `gnus-uu-unshar-article'. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1531 Make sure that this text consists only of few text lines. Otherwise, |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1532 Gnus might fail to display all of it.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1533 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1534 |
17493 | 1535 ;; This function is used by `gnus-uu-grab-articles' to treat |
1536 ;; a shared article. | |
1537 (defun gnus-uu-unshar-article (process-buffer in-state) | |
1538 (let ((state (list 'ok)) | |
1539 start-char) | |
1540 (save-excursion | |
1541 (set-buffer process-buffer) | |
1542 (goto-char (point-min)) | |
1543 (if (not (re-search-forward gnus-uu-shar-begin-string nil t)) | |
1544 (setq state (list 'wrong-type)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1545 (save-window-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1546 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1547 (switch-to-buffer (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1548 (delete-other-windows) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1549 (let ((buffer (get-buffer-create (generate-new-buffer-name |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1550 "*Warning*")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1551 (unless |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1552 (unwind-protect |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1553 (with-current-buffer buffer |
35957
a35d9c07d074
2001-02-07 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33765
diff
changeset
|
1554 (insert (substitute-command-keys |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1555 gnus-uu-unshar-warning)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1556 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1557 (display-buffer buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1558 (yes-or-no-p "This is a shell archive, unshar it? ")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1559 (kill-buffer buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1560 (setq state (list 'error)))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1561 (unless (memq 'error state) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1562 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1563 (setq start-char (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1564 (call-process-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1565 start-char (point-max) shell-file-name nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1566 (gnus-get-buffer-create gnus-uu-output-buffer-name) nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1567 shell-command-switch |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1568 (concat "cd " gnus-uu-work-dir " " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1569 gnus-shell-command-separator " sh"))))) |
17493 | 1570 state)) |
1571 | |
1572 ;; Returns the name of what the shar file is going to unpack. | |
1573 (defun gnus-uu-find-name-in-shar () | |
1574 (let ((oldpoint (point)) | |
1575 res) | |
1576 (goto-char (point-min)) | |
1577 (when (re-search-forward gnus-uu-shar-name-marker nil t) | |
1578 (setq res (buffer-substring (match-beginning 1) (match-end 1)))) | |
1579 (goto-char oldpoint) | |
1580 res)) | |
1581 | |
1582 ;; `gnus-uu-choose-action' chooses what action to perform given the name | |
1583 ;; and `gnus-uu-file-action-list'. Returns either nil if no action is | |
1584 ;; found, or the name of the command to run if such a rule is found. | |
1585 (defun gnus-uu-choose-action (file-name file-action-list &optional no-ignore) | |
1586 (let ((action-list (copy-sequence file-action-list)) | |
1587 (case-fold-search t) | |
1588 rule action) | |
1589 (and | |
1590 (unless no-ignore | |
1591 (and (not | |
1592 (and gnus-uu-ignore-files-by-name | |
1593 (string-match gnus-uu-ignore-files-by-name file-name))) | |
1594 (not | |
1595 (and gnus-uu-ignore-files-by-type | |
1596 (string-match gnus-uu-ignore-files-by-type | |
1597 (or (gnus-uu-choose-action | |
1598 file-name gnus-uu-ext-to-mime-list t) | |
1599 "")))))) | |
1600 (while (not (or (eq action-list ()) action)) | |
1601 (setq rule (car action-list)) | |
1602 (setq action-list (cdr action-list)) | |
1603 (when (string-match (car rule) file-name) | |
1604 (setq action (cadr rule))))) | |
1605 action)) | |
1606 | |
1607 (defun gnus-uu-treat-archive (file-path) | |
1608 ;; Unpacks an archive. Returns t if unpacking is successful. | |
1609 (let ((did-unpack t) | |
1610 action command dir) | |
1611 (setq action (gnus-uu-choose-action | |
1612 file-path (append gnus-uu-user-archive-rules | |
1613 (if gnus-uu-ignore-default-archive-rules | |
1614 nil | |
1615 gnus-uu-default-archive-rules)))) | |
1616 | |
1617 (when (not action) | |
1618 (error "No unpackers for the file %s" file-path)) | |
1619 | |
1620 (string-match "/[^/]*$" file-path) | |
1621 (setq dir (substring file-path 0 (match-beginning 0))) | |
1622 | |
1623 (when (member action gnus-uu-destructive-archivers) | |
1624 (copy-file file-path (concat file-path "~") t)) | |
1625 | |
1626 (setq command (format "cd %s ; %s" dir (gnus-uu-command action file-path))) | |
1627 | |
1628 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1629 (set-buffer (gnus-get-buffer-create gnus-uu-output-buffer-name)) |
17493 | 1630 (erase-buffer)) |
1631 | |
1632 (gnus-message 5 "Unpacking: %s..." (gnus-uu-command action file-path)) | |
1633 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1634 (if (eq 0 (call-process shell-file-name nil |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1635 (gnus-get-buffer-create gnus-uu-output-buffer-name) |
17493 | 1636 nil shell-command-switch command)) |
1637 (message "") | |
1638 (gnus-message 2 "Error during unpacking of archive") | |
1639 (setq did-unpack nil)) | |
1640 | |
1641 (when (member action gnus-uu-destructive-archivers) | |
1642 (rename-file (concat file-path "~") file-path t)) | |
1643 | |
1644 did-unpack)) | |
1645 | |
1646 (defun gnus-uu-dir-files (dir) | |
1647 (let ((dirs (directory-files dir t "[^/][^\\.][^\\.]?$")) | |
1648 files file) | |
1649 (while dirs | |
1650 (if (file-directory-p (setq file (car dirs))) | |
1651 (setq files (append files (gnus-uu-dir-files file))) | |
1652 (push file files)) | |
1653 (setq dirs (cdr dirs))) | |
1654 files)) | |
1655 | |
1656 (defun gnus-uu-unpack-files (files &optional ignore) | |
1657 ;; Go through FILES and look for files to unpack. | |
1658 (let* ((totfiles (gnus-uu-ls-r gnus-uu-work-dir)) | |
1659 (ofiles files) | |
1660 file did-unpack) | |
1661 (while files | |
1662 (setq file (cdr (assq 'name (car files)))) | |
1663 (when (and (not (member file ignore)) | |
1664 (equal (gnus-uu-get-action (file-name-nondirectory file)) | |
1665 "gnus-uu-archive")) | |
1666 (push file did-unpack) | |
1667 (unless (gnus-uu-treat-archive file) | |
1668 (gnus-message 2 "Error during unpacking of %s" file)) | |
1669 (let* ((newfiles (gnus-uu-ls-r gnus-uu-work-dir)) | |
1670 (nfiles newfiles)) | |
1671 (while nfiles | |
1672 (unless (member (car nfiles) totfiles) | |
1673 (push (list (cons 'name (car nfiles)) | |
1674 (cons 'original file)) | |
1675 ofiles)) | |
1676 (setq nfiles (cdr nfiles))) | |
1677 (setq totfiles newfiles))) | |
1678 (setq files (cdr files))) | |
1679 (if did-unpack | |
1680 (gnus-uu-unpack-files ofiles (append did-unpack ignore)) | |
1681 ofiles))) | |
1682 | |
1683 (defun gnus-uu-ls-r (dir) | |
1684 (let* ((files (gnus-uu-directory-files dir t)) | |
1685 (ofiles files)) | |
1686 (while files | |
1687 (when (file-directory-p (car files)) | |
1688 (setq ofiles (delete (car files) ofiles)) | |
1689 (setq ofiles (append ofiles (gnus-uu-ls-r (car files))))) | |
1690 (setq files (cdr files))) | |
1691 ofiles)) | |
1692 | |
1693 ;; Various stuff | |
1694 | |
1695 (defun gnus-uu-directory-files (dir &optional full) | |
1696 (let (files out file) | |
1697 (setq files (directory-files dir full)) | |
1698 (while files | |
1699 (setq file (car files)) | |
1700 (setq files (cdr files)) | |
1701 (unless (member (file-name-nondirectory file) '("." "..")) | |
1702 (push file out))) | |
1703 (setq out (nreverse out)) | |
1704 out)) | |
1705 | |
1706 (defun gnus-uu-check-correct-stripped-uucode (start end) | |
1707 (save-excursion | |
1708 (let (found beg length) | |
1709 (if (not gnus-uu-correct-stripped-uucode) | |
1710 () | |
1711 (goto-char start) | |
1712 | |
1713 (if (re-search-forward " \\|`" end t) | |
1714 (progn | |
1715 (goto-char start) | |
1716 (while (not (eobp)) | |
1717 (progn | |
1718 (when (looking-at "\n") | |
1719 (replace-match "")) | |
1720 (forward-line 1)))) | |
1721 | |
1722 (while (not (eobp)) | |
1723 (if (looking-at (concat gnus-uu-begin-string "\\|" | |
1724 gnus-uu-end-string)) | |
1725 () | |
1726 (when (not found) | |
1727 (beginning-of-line) | |
1728 (setq beg (point)) | |
1729 (end-of-line) | |
1730 (setq length (- (point) beg))) | |
1731 (setq found t) | |
1732 (beginning-of-line) | |
1733 (setq beg (point)) | |
1734 (end-of-line) | |
1735 (when (not (= length (- (point) beg))) | |
1736 (insert (make-string (- length (- (point) beg)) ? )))) | |
1737 (forward-line 1))))))) | |
1738 | |
1739 (defvar gnus-uu-tmp-alist nil) | |
1740 | |
1741 (defun gnus-uu-initialize (&optional scan) | |
1742 (let (entry) | |
1743 (if (and (not scan) | |
1744 (when (setq entry (assoc gnus-newsgroup-name gnus-uu-tmp-alist)) | |
1745 (if (file-exists-p (cdr entry)) | |
1746 (setq gnus-uu-work-dir (cdr entry)) | |
1747 (setq gnus-uu-tmp-alist (delq entry gnus-uu-tmp-alist)) | |
1748 nil))) | |
1749 t | |
1750 (setq gnus-uu-tmp-dir (file-name-as-directory | |
1751 (expand-file-name gnus-uu-tmp-dir))) | |
1752 (if (not (file-directory-p gnus-uu-tmp-dir)) | |
1753 (error "Temp directory %s doesn't exist" gnus-uu-tmp-dir) | |
1754 (when (not (file-writable-p gnus-uu-tmp-dir)) | |
1755 (error "Temp directory %s can't be written to" | |
1756 gnus-uu-tmp-dir))) | |
1757 | |
1758 (setq gnus-uu-work-dir | |
44075
7782e54757bb
* mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38413
diff
changeset
|
1759 (mm-make-temp-file (concat gnus-uu-tmp-dir "gnus") 'dir)) |
17493 | 1760 (set-file-modes gnus-uu-work-dir 448) |
1761 (setq gnus-uu-work-dir (file-name-as-directory gnus-uu-work-dir)) | |
1762 (push (cons gnus-newsgroup-name gnus-uu-work-dir) | |
1763 gnus-uu-tmp-alist)))) | |
1764 | |
1765 | |
1766 ;; Kills the temporary uu buffers, kills any processes, etc. | |
1767 (defun gnus-uu-clean-up () | |
1768 (let (buf) | |
1769 (and gnus-uu-uudecode-process | |
1770 (memq (process-status (or gnus-uu-uudecode-process "nevair")) | |
1771 '(stop run)) | |
1772 (delete-process gnus-uu-uudecode-process)) | |
1773 (when (setq buf (get-buffer gnus-uu-output-buffer-name)) | |
1774 (kill-buffer buf)))) | |
1775 | |
1776 ;; Inputs an action and a filename and returns a full command, making sure | |
1777 ;; that the filename will be treated as a single argument when the shell | |
1778 ;; executes the command. | |
1779 (defun gnus-uu-command (action file) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1780 (let ((quoted-file (mm-quote-arg file))) |
17493 | 1781 (if (string-match "%s" action) |
1782 (format action quoted-file) | |
1783 (concat action " " quoted-file)))) | |
1784 | |
1785 (defun gnus-uu-delete-work-dir (&optional dir) | |
1786 "Delete recursively all files and directories under `gnus-uu-work-dir'." | |
1787 (if dir | |
1788 (gnus-message 7 "Deleting directory %s..." dir) | |
1789 (setq dir gnus-uu-work-dir)) | |
1790 (when (and dir | |
1791 (file-exists-p dir)) | |
1792 (let ((files (directory-files dir t nil t)) | |
1793 file) | |
1794 (while (setq file (pop files)) | |
1795 (unless (member (file-name-nondirectory file) '("." "..")) | |
1796 (if (file-directory-p file) | |
1797 (gnus-uu-delete-work-dir file) | |
1798 (gnus-message 9 "Deleting file %s..." file) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1799 (condition-case err |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1800 (delete-file file) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1801 (error (gnus-message 3 "Deleting file %s failed... %s" file err)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1802 (condition-case err |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1803 (delete-directory dir) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1804 (error (gnus-message 3 "Deleting directory %s failed... %s" file err)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1805 (gnus-message 7 ""))) |
17493 | 1806 |
1807 ;; Initializing | |
1808 | |
1809 (add-hook 'gnus-exit-group-hook 'gnus-uu-clean-up) | |
1810 (add-hook 'gnus-exit-group-hook 'gnus-uu-delete-work-dir) | |
1811 | |
1812 | |
1813 | |
1814 ;;; | |
1815 ;;; uuencoded posting | |
1816 ;;; | |
1817 | |
1818 ;; Any function that is to be used as and encoding method will take two | |
1819 ;; parameters: PATH-NAME and FILE-NAME. (E.g. "/home/gaga/spiral.jpg" | |
1820 ;; and "spiral.jpg", respectively.) The function should return nil if | |
1821 ;; the encoding wasn't successful. | |
1822 (defcustom gnus-uu-post-encode-method 'gnus-uu-post-encode-uuencode | |
1823 "Function used for encoding binary files. | |
1824 There are three functions supplied with gnus-uu for encoding files: | |
1825 `gnus-uu-post-encode-uuencode', which does straight uuencoding; | |
1826 `gnus-uu-post-encode-mime', which encodes with base64 and adds MIME | |
1827 headers; and `gnus-uu-post-encode-mime-uuencode', which encodes with | |
1828 uuencode and adds MIME headers." | |
1829 :group 'gnus-extract-post | |
1830 :type '(radio (function-item gnus-uu-post-encode-uuencode) | |
1831 (function-item gnus-uu-post-encode-mime) | |
1832 (function-item gnus-uu-post-encode-mime-uuencode) | |
1833 (function :tag "Other"))) | |
1834 | |
1835 (defcustom gnus-uu-post-include-before-composing nil | |
1836 "Non-nil means that gnus-uu will ask for a file to encode before you compose the article. | |
1837 If this variable is t, you can either include an encoded file with | |
1838 \\[gnus-uu-post-insert-binary-in-article] or have one included for you when you post the article." | |
1839 :group 'gnus-extract-post | |
1840 :type 'boolean) | |
1841 | |
1842 (defcustom gnus-uu-post-length 990 | |
1843 "Maximum length of an article. | |
1844 The encoded file will be split into how many articles it takes to | |
1845 post the entire file." | |
1846 :group 'gnus-extract-post | |
1847 :type 'integer) | |
1848 | |
1849 (defcustom gnus-uu-post-threaded nil | |
1850 "Non-nil means that gnus-uu will post the encoded file in a thread. | |
1851 This may not be smart, as no other decoder I have seen are able to | |
1852 follow threads when collecting uuencoded articles. (Well, I have seen | |
1853 one package that does that - gnus-uu, but somehow, I don't think that | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
1854 counts...) The default is nil." |
17493 | 1855 :group 'gnus-extract-post |
1856 :type 'boolean) | |
1857 | |
1858 (defcustom gnus-uu-post-separate-description t | |
1859 "Non-nil means that the description will be posted in a separate article. | |
1860 The first article will typically be numbered (0/x). If this variable | |
1861 is nil, the description the user enters will be included at the | |
1862 beginning of the first article, which will be numbered (1/x). Default | |
1863 is t." | |
1864 :group 'gnus-extract-post | |
1865 :type 'boolean) | |
1866 | |
1867 (defvar gnus-uu-post-binary-separator "--binary follows this line--") | |
1868 (defvar gnus-uu-post-message-id nil) | |
1869 (defvar gnus-uu-post-inserted-file-name nil) | |
1870 (defvar gnus-uu-winconf-post-news nil) | |
1871 | |
1872 (defun gnus-uu-post-news () | |
1873 "Compose an article and post an encoded file." | |
1874 (interactive) | |
1875 (setq gnus-uu-post-inserted-file-name nil) | |
1876 (setq gnus-uu-winconf-post-news (current-window-configuration)) | |
1877 | |
1878 (gnus-summary-post-news) | |
1879 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1880 (let ((map (make-sparse-keymap))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1881 (set-keymap-parent map (current-local-map)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
29734
diff
changeset
|
1882 (use-local-map map)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1883 ;;(local-set-key "\C-c\C-c" 'gnus-summary-edit-article-done) |
17493 | 1884 (local-set-key "\C-c\C-c" 'gnus-uu-post-news-inews) |
1885 (local-set-key "\C-c\C-s" 'gnus-uu-post-news-inews) | |
1886 (local-set-key "\C-c\C-i" 'gnus-uu-post-insert-binary-in-article) | |
1887 | |
1888 (when gnus-uu-post-include-before-composing | |
1889 (save-excursion (setq gnus-uu-post-inserted-file-name | |
1890 (gnus-uu-post-insert-binary))))) | |
1891 | |
1892 (defun gnus-uu-post-insert-binary-in-article () | |
1893 "Inserts an encoded file in the buffer. | |
1894 The user will be asked for a file name." | |
1895 (interactive) | |
1896 (save-excursion | |
1897 (setq gnus-uu-post-inserted-file-name (gnus-uu-post-insert-binary)))) | |
1898 | |
1899 ;; Encodes with uuencode and substitutes all spaces with backticks. | |
1900 (defun gnus-uu-post-encode-uuencode (path file-name) | |
1901 (when (gnus-uu-post-encode-file "uuencode" path file-name) | |
1902 (goto-char (point-min)) | |
1903 (forward-line 1) | |
1904 (while (re-search-forward " " nil t) | |
1905 (replace-match "`")) | |
1906 t)) | |
1907 | |
1908 ;; Encodes with uuencode and adds MIME headers. | |
1909 (defun gnus-uu-post-encode-mime-uuencode (path file-name) | |
1910 (when (gnus-uu-post-encode-uuencode path file-name) | |
1911 (gnus-uu-post-make-mime file-name "x-uue") | |
1912 t)) | |
1913 | |
1914 ;; Encodes with base64 and adds MIME headers | |
1915 (defun gnus-uu-post-encode-mime (path file-name) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1916 (when (eq 0 (call-process shell-file-name nil t nil shell-command-switch |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1917 (format "%s %s -o %s" "mmencode" path file-name))) |
17493 | 1918 (gnus-uu-post-make-mime file-name "base64") |
1919 t)) | |
1920 | |
1921 ;; Adds MIME headers. | |
1922 (defun gnus-uu-post-make-mime (file-name encoding) | |
1923 (goto-char (point-min)) | |
1924 (insert (format "Content-Type: %s; name=\"%s\"\n" | |
1925 (gnus-uu-choose-action file-name gnus-uu-ext-to-mime-list) | |
1926 file-name)) | |
1927 (insert (format "Content-Transfer-Encoding: %s\n\n" encoding)) | |
1928 (save-restriction | |
1929 (set-buffer gnus-message-buffer) | |
1930 (goto-char (point-min)) | |
1931 (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$")) | |
1932 (forward-line -1) | |
44514
8bfbcb957964
(gnus-uu-binhex-article, gnus-uu-reginize-string, gnus-uu-expand-numbers)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44075
diff
changeset
|
1933 (narrow-to-region (point-min) (point)) |
17493 | 1934 (unless (mail-fetch-field "mime-version") |
1935 (widen) | |
1936 (insert "MIME-Version: 1.0\n")) | |
1937 (widen))) | |
1938 | |
1939 ;; Encodes a file PATH with COMMAND, leaving the result in the | |
1940 ;; current buffer. | |
1941 (defun gnus-uu-post-encode-file (command path file-name) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1942 (eq 0 (call-process shell-file-name nil t nil shell-command-switch |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1943 (format "%s %s %s" command path file-name)))) |
17493 | 1944 |
1945 (defun gnus-uu-post-news-inews () | |
1946 "Posts the composed news article and encoded file. | |
1947 If no file has been included, the user will be asked for a file." | |
1948 (interactive) | |
1949 | |
1950 (let (file-name) | |
1951 | |
1952 (if gnus-uu-post-inserted-file-name | |
1953 (setq file-name gnus-uu-post-inserted-file-name) | |
1954 (setq file-name (gnus-uu-post-insert-binary))) | |
1955 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
1956 (gnus-uu-post-encoded file-name gnus-uu-post-threaded)) |
17493 | 1957 (setq gnus-uu-post-inserted-file-name nil) |
1958 (when gnus-uu-winconf-post-news | |
1959 (set-window-configuration gnus-uu-winconf-post-news))) | |
1960 | |
1961 ;; Asks for a file to encode, encodes it and inserts the result in | |
1962 ;; the current buffer. Returns the file name the user gave. | |
1963 (defun gnus-uu-post-insert-binary () | |
1964 (let ((uuencode-buffer-name "*uuencode buffer*") | |
1965 file-path uubuf file-name) | |
1966 | |
1967 (setq file-path (read-file-name | |
1968 "What file do you want to encode? ")) | |
1969 (when (not (file-exists-p file-path)) | |
1970 (error "%s: No such file" file-path)) | |
1971 | |
1972 (goto-char (point-max)) | |
1973 (insert (format "\n%s\n" gnus-uu-post-binary-separator)) | |
1974 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1975 ;; #### Unix-specific? |
17493 | 1976 (when (string-match "^~/" file-path) |
1977 (setq file-path (concat "$HOME" (substring file-path 1)))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1978 ;; #### Unix-specific? |
17493 | 1979 (if (string-match "/[^/]*$" file-path) |
1980 (setq file-name (substring file-path (1+ (match-beginning 0)))) | |
1981 (setq file-name file-path)) | |
1982 | |
1983 (unwind-protect | |
1984 (if (save-excursion | |
1985 (set-buffer (setq uubuf | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1986 (gnus-get-buffer-create uuencode-buffer-name))) |
17493 | 1987 (erase-buffer) |
1988 (funcall gnus-uu-post-encode-method file-path file-name)) | |
1989 (insert-buffer-substring uubuf) | |
1990 (error "Encoding unsuccessful")) | |
1991 (kill-buffer uubuf)) | |
1992 file-name)) | |
1993 | |
1994 ;; Posts the article and all of the encoded file. | |
1995 (defun gnus-uu-post-encoded (file-name &optional threaded) | |
1996 (let ((send-buffer-name "*uuencode send buffer*") | |
1997 (encoded-buffer-name "*encoded buffer*") | |
1998 (top-string "[ cut here %s (%s %d/%d) %s gnus-uu ]") | |
1999 (separator (concat mail-header-separator "\n\n")) | |
2000 uubuf length parts header i end beg | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2001 beg-line minlen post-buf whole-len beg-binary end-binary) |
17493 | 2002 |
2003 (setq post-buf (current-buffer)) | |
2004 | |
2005 (goto-char (point-min)) | |
2006 (when (not (re-search-forward | |
2007 (if gnus-uu-post-separate-description | |
2008 (concat "^" (regexp-quote gnus-uu-post-binary-separator) | |
2009 "$") | |
2010 (concat "^" (regexp-quote mail-header-separator) "$")) | |
2011 nil t)) | |
2012 (error "Internal error: No binary/header separator")) | |
2013 (beginning-of-line) | |
2014 (forward-line 1) | |
2015 (setq beg-binary (point)) | |
2016 (setq end-binary (point-max)) | |
2017 | |
2018 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2019 (set-buffer (setq uubuf (gnus-get-buffer-create encoded-buffer-name))) |
17493 | 2020 (erase-buffer) |
2021 (insert-buffer-substring post-buf beg-binary end-binary) | |
2022 (goto-char (point-min)) | |
44514
8bfbcb957964
(gnus-uu-binhex-article, gnus-uu-reginize-string, gnus-uu-expand-numbers)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44075
diff
changeset
|
2023 (setq length (count-lines (point-min) (point-max))) |
17493 | 2024 (setq parts (/ length gnus-uu-post-length)) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2025 (unless (< (% length gnus-uu-post-length) 4) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2026 (incf parts))) |
17493 | 2027 |
2028 (when gnus-uu-post-separate-description | |
2029 (forward-line -1)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2030 (delete-region (point) (point-max)) |
17493 | 2031 |
2032 (goto-char (point-min)) | |
2033 (re-search-forward | |
2034 (concat "^" (regexp-quote mail-header-separator) "$") nil t) | |
2035 (beginning-of-line) | |
44514
8bfbcb957964
(gnus-uu-binhex-article, gnus-uu-reginize-string, gnus-uu-expand-numbers)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44075
diff
changeset
|
2036 (setq header (buffer-substring (point-min) (point))) |
17493 | 2037 |
2038 (goto-char (point-min)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2039 (when gnus-uu-post-separate-description |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2040 (when (re-search-forward "^Subject: " nil t) |
17493 | 2041 (end-of-line) |
2042 (insert (format " (0/%d)" parts))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2043 (save-excursion |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2044 (message-send)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2045 (setq gnus-uu-post-message-id (message-fetch-field "message-id"))) |
17493 | 2046 |
2047 (save-excursion | |
2048 (setq i 1) | |
2049 (setq beg 1) | |
2050 (while (not (> i parts)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2051 (set-buffer (gnus-get-buffer-create send-buffer-name)) |
17493 | 2052 (erase-buffer) |
2053 (insert header) | |
2054 (when (and threaded gnus-uu-post-message-id) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2055 (insert "References: " gnus-uu-post-message-id "\n")) |
17493 | 2056 (insert separator) |
2057 (setq whole-len | |
2058 (- 62 (length (format top-string "" file-name i parts "")))) | |
2059 (when (> 1 (setq minlen (/ whole-len 2))) | |
2060 (setq minlen 1)) | |
2061 (setq | |
2062 beg-line | |
2063 (format top-string | |
2064 (make-string minlen ?-) | |
2065 file-name i parts | |
2066 (make-string | |
2067 (if (= 0 (% whole-len 2)) (1- minlen) minlen) ?-))) | |
2068 | |
2069 (goto-char (point-min)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2070 (when (re-search-forward "^Subject: " nil t) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2071 (end-of-line) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2072 (insert (format " (%d/%d)" i parts))) |
17493 | 2073 |
2074 (goto-char (point-max)) | |
2075 (save-excursion | |
2076 (set-buffer uubuf) | |
2077 (goto-char beg) | |
2078 (if (= i parts) | |
2079 (goto-char (point-max)) | |
2080 (forward-line gnus-uu-post-length)) | |
2081 (when (and (= (1+ i) parts) (< (count-lines (point) (point-max)) 4)) | |
2082 (forward-line -4)) | |
2083 (setq end (point))) | |
2084 (insert-buffer-substring uubuf beg end) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2085 (insert beg-line "\n") |
17493 | 2086 (setq beg end) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2087 (incf i) |
17493 | 2088 (goto-char (point-min)) |
2089 (re-search-forward | |
2090 (concat "^" (regexp-quote mail-header-separator) "$") nil t) | |
2091 (beginning-of-line) | |
2092 (forward-line 2) | |
2093 (when (re-search-forward | |
2094 (concat "^" (regexp-quote gnus-uu-post-binary-separator) "$") | |
2095 nil t) | |
2096 (replace-match "") | |
2097 (forward-line 1)) | |
2098 (insert beg-line) | |
2099 (insert "\n") | |
2100 (let (message-sent-message-via) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2101 (save-excursion |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2102 (message-send)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2103 (setq gnus-uu-post-message-id |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2104 (concat (message-fetch-field "references") " " |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2105 (message-fetch-field "message-id")))))) |
17493 | 2106 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2107 (gnus-kill-buffer send-buffer-name) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
2108 (gnus-kill-buffer encoded-buffer-name) |
17493 | 2109 |
2110 (when (not gnus-uu-post-separate-description) | |
2111 (set-buffer-modified-p nil) | |
2112 (when (fboundp 'bury-buffer) | |
2113 (bury-buffer))))) | |
2114 | |
2115 (provide 'gnus-uu) | |
2116 | |
52401 | 2117 ;;; arch-tag: 05312384-0a83-4720-9a58-b3160b888853 |
38413
a26d9b55abb6
Some fixes to follow coding conventions in files from Gnus.
Pavel Janík <Pavel@Janik.cz>
parents:
36856
diff
changeset
|
2118 ;;; gnus-uu.el ends here |