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