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