(message-cite-articles-with-x-no-archive): New
[gnus] / lisp / gnus-uu.el
1 ;;; gnus-uu.el --- extract (uu)encoded files in Gnus
2 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
3 ;;        2001, 2002, 2003 Free Software Foundation, Inc.
4
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Created: 2 Oct 1993
7 ;; Keyword: news
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Commentary:
27
28 ;;; Code:
29
30 (eval-when-compile (require 'cl))
31
32 (require 'gnus)
33 (require 'gnus-art)
34 (require 'message)
35 (require 'gnus-msg)
36 (require 'mm-decode)
37
38 (defgroup gnus-extract nil
39   "Extracting encoded files."
40   :prefix "gnus-uu-"
41   :group 'gnus)
42
43 (defgroup gnus-extract-view nil
44   "Viewwing extracted files."
45   :group 'gnus-extract)
46
47 (defgroup gnus-extract-archive nil
48   "Extracting encoded archives."
49   :group 'gnus-extract)
50
51 (defgroup gnus-extract-post nil
52   "Extracting encoded archives."
53   :prefix "gnus-uu-post"
54   :group 'gnus-extract)
55
56 ;; Default viewing action rules
57
58 (defcustom gnus-uu-default-view-rules
59   '(("\\.te?xt$\\|\\.doc$\\|read.*me\\|\\.c?$\\|\\.h$\\|\\.bat$\\|\\.asm$\\|makefile" "cat %s | sed 's/\r$//'")
60     ("\\.pas$" "cat %s | sed 's/\r$//'")
61     ("\\.[1-9]$" "groff -mandoc -Tascii %s | sed s/\b.//g")
62     ("\\.\\(jpe?g\\|gif\\|tiff?\\|p[pgb]m\\|xwd\\|xbm\\|pcx\\)$" "display")
63     ("\\.tga$" "tgatoppm %s | ee -")
64     ("\\.\\(wav\\|aiff\\|hcom\\|u[blw]\\|s[bfw]\\|voc\\|smp\\)$"
65      "sox -v .5 %s -t .au -u - > /dev/audio")
66     ("\\.au$" "cat %s > /dev/audio")
67     ("\\.midi?$" "playmidi -f")
68     ("\\.mod$" "str32")
69     ("\\.ps$" "ghostview")
70     ("\\.dvi$" "xdvi")
71     ("\\.html$" "xmosaic")
72     ("\\.mpe?g$" "mpeg_play")
73     ("\\.\\(flc\\|fli\\|rle\\|iff\\|pfx\\|avi\\|sme\\|rpza\\|dl\\|qt\\|rsrc\\|mov\\)$" "xanim")
74     ("\\.\\(tar\\|arj\\|zip\\|zoo\\|arc\\|gz\\|Z\\|lzh\\|ar\\|lha\\)$"
75      "gnus-uu-archive"))
76   "*Default actions to be taken when the user asks to view a file.
77 To change the behaviour, you can either edit this variable or set
78 `gnus-uu-user-view-rules' to something useful.
79
80 For example:
81
82 To make gnus-uu use 'xli' to display JPEG and GIF files, put the
83 following in your .emacs file:
84
85   (setq gnus-uu-user-view-rules '((\"jpg$\\\\|gif$\" \"xli\")))
86
87 Both these variables are lists of lists with two string elements.  The
88 first string is a regular expression.  If the file name matches this
89 regular expression, the command in the second string is executed with
90 the file as an argument.
91
92 If the command string contains \"%s\", the file name will be inserted
93 at that point in the command string.  If there's no \"%s\" in the
94 command string, the file name will be appended to the command string
95 before executing.
96
97 There are several user variables to tailor the behaviour of gnus-uu to
98 your needs.  First we have `gnus-uu-user-view-rules', which is the
99 variable gnus-uu first consults when trying to decide how to view a
100 file.  If this variable contains no matches, gnus-uu examines the
101 default rule variable provided in this package.  If gnus-uu finds no
102 match here, it uses `gnus-uu-user-view-rules-end' to try to make a
103 match."
104   :group 'gnus-extract-view
105   :type '(repeat (group regexp (string :tag "Command"))))
106
107 (defcustom gnus-uu-user-view-rules nil
108   "What actions are to be taken to view a file.
109 See the documentation on the `gnus-uu-default-view-rules' variable for
110 details."
111   :group 'gnus-extract-view
112   :type '(repeat (group regexp (string :tag "Command"))))
113
114 (defcustom gnus-uu-user-view-rules-end
115   '(("" "file"))
116   "*What actions are to be taken if no rule matched the file name.
117 See the documentation on the `gnus-uu-default-view-rules' variable for
118 details."
119   :group 'gnus-extract-view
120   :type '(repeat (group regexp (string :tag "Command"))))
121
122 ;; Default unpacking commands
123
124 (defcustom gnus-uu-default-archive-rules
125   '(("\\.tar$" "tar xf")
126     ("\\.zip$" "unzip -o")
127     ("\\.ar$" "ar x")
128     ("\\.arj$" "unarj x")
129     ("\\.zoo$" "zoo -e")
130     ("\\.\\(lzh\\|lha\\)$" "lha x")
131     ("\\.Z$" "uncompress")
132     ("\\.gz$" "gunzip")
133     ("\\.arc$" "arc -x"))
134   "*See `gnus-uu-user-archive-rules'."
135   :group 'gnus-extract-archive
136   :type '(repeat (group regexp (string :tag "Command"))))
137
138 (defvar gnus-uu-destructive-archivers
139   (list "uncompress" "gunzip"))
140
141 (defcustom gnus-uu-user-archive-rules nil
142   "A list that can be set to override the default archive unpacking commands.
143 To use, for instance, 'untar' to unpack tar files and 'zip -x' to
144 unpack zip files, say the following:
145   (setq gnus-uu-user-archive-rules
146     '((\"\\\\.tar$\" \"untar\")
147       (\"\\\\.zip$\" \"zip -x\")))"
148   :group 'gnus-extract-archive
149   :type '(repeat (group regexp (string :tag "Command"))))
150
151 (defcustom gnus-uu-ignore-files-by-name nil
152   "*A regular expression saying what files should not be viewed based on name.
153 If, for instance, you want gnus-uu to ignore all .au and .wav files,
154 you could say something like
155
156   (setq gnus-uu-ignore-files-by-name \"\\\\.au$\\\\|\\\\.wav$\")
157
158 Note that this variable can be used in conjunction with the
159 `gnus-uu-ignore-files-by-type' variable."
160   :group 'gnus-extract
161   :type '(choice (const :tag "off" nil)
162                  (regexp :format "%v")))
163
164 (defcustom gnus-uu-ignore-files-by-type nil
165   "*A regular expression saying what files that shouldn't be viewed, based on MIME file type.
166 If, for instance, you want gnus-uu to ignore all audio files and all mpegs,
167 you could say something like
168
169   (setq gnus-uu-ignore-files-by-type \"audio/\\\\|video/mpeg\")
170
171 Note that this variable can be used in conjunction with the
172 `gnus-uu-ignore-files-by-name' variable."
173   :group 'gnus-extract
174   :type '(choice (const :tag "off" nil)
175                  (regexp :format "%v")))
176
177 ;; Pseudo-MIME support
178
179 (defconst gnus-uu-ext-to-mime-list
180   '(("\\.gif$" "image/gif")
181     ("\\.jpe?g$" "image/jpeg")
182     ("\\.tiff?$" "image/tiff")
183     ("\\.xwd$" "image/xwd")
184     ("\\.pbm$" "image/pbm")
185     ("\\.pgm$" "image/pgm")
186     ("\\.ppm$" "image/ppm")
187     ("\\.xbm$" "image/xbm")
188     ("\\.pcx$" "image/pcx")
189     ("\\.tga$" "image/tga")
190     ("\\.ps$" "image/postscript")
191     ("\\.fli$" "video/fli")
192     ("\\.wav$" "audio/wav")
193     ("\\.aiff$" "audio/aiff")
194     ("\\.hcom$" "audio/hcom")
195     ("\\.voc$" "audio/voc")
196     ("\\.smp$" "audio/smp")
197     ("\\.mod$" "audio/mod")
198     ("\\.dvi$" "image/dvi")
199     ("\\.mpe?g$" "video/mpeg")
200     ("\\.au$" "audio/basic")
201     ("\\.\\(te?xt\\|doc\\|c\\|h\\)$" "text/plain")
202     ("\\.\\(c\\|h\\)$" "text/source")
203     ("read.*me" "text/plain")
204     ("\\.html$" "text/html")
205     ("\\.bat$" "text/bat")
206     ("\\.[1-6]$" "text/man")
207     ("\\.flc$" "video/flc")
208     ("\\.rle$" "video/rle")
209     ("\\.pfx$" "video/pfx")
210     ("\\.avi$" "video/avi")
211     ("\\.sme$" "video/sme")
212     ("\\.rpza$" "video/prza")
213     ("\\.dl$" "video/dl")
214     ("\\.qt$" "video/qt")
215     ("\\.rsrc$" "video/rsrc")
216     ("\\..*$" "unknown/unknown")))
217
218 ;; Various variables users may set
219
220 (defcustom gnus-uu-tmp-dir
221   (cond ((fboundp 'temp-directory) (temp-directory))
222         ((boundp 'temporary-file-directory) temporary-file-directory)
223         ("/tmp/"))
224   "*Variable saying where gnus-uu is to do its work.
225 Default is \"/tmp/\"."
226   :group 'gnus-extract
227   :type 'directory)
228
229 (defcustom gnus-uu-do-not-unpack-archives nil
230   "*Non-nil means that gnus-uu won't peek inside archives looking for files to display.
231 Default is nil."
232   :group 'gnus-extract-archive
233   :type 'boolean)
234
235 (defcustom gnus-uu-ignore-default-view-rules nil
236   "*Non-nil means that gnus-uu will ignore the default viewing rules.
237 Only the user viewing rules will be consulted.  Default is nil."
238   :group 'gnus-extract-view
239   :type 'boolean)
240
241 (defcustom gnus-uu-grabbed-file-functions nil
242   "Functions run on each file after successful decoding.
243 They will be called with the name of the file as the argument.
244 Likely functions you can use in this list are `gnus-uu-grab-view'
245 and `gnus-uu-grab-move'."
246   :group 'gnus-extract
247   :options '(gnus-uu-grab-view gnus-uu-grab-move)
248   :type 'hook)
249
250 (defcustom gnus-uu-ignore-default-archive-rules nil
251   "*Non-nil means that gnus-uu will ignore the default archive unpacking commands.
252 Only the user unpacking commands will be consulted.  Default is nil."
253   :group 'gnus-extract-archive
254   :type 'boolean)
255
256 (defcustom gnus-uu-kill-carriage-return t
257   "*Non-nil means that gnus-uu will strip all carriage returns from articles.
258 Default is t."
259   :group 'gnus-extract
260   :type 'boolean)
261
262 (defcustom gnus-uu-view-with-metamail nil
263   "*Non-nil means that files will be viewed with metamail.
264 The gnus-uu viewing functions will be ignored and gnus-uu will try
265 to guess at a content-type based on file name suffixes.  Default
266 it nil."
267   :group 'gnus-extract
268   :type 'boolean)
269
270 (defcustom gnus-uu-unmark-articles-not-decoded nil
271   "*Non-nil means that gnus-uu will mark articles that were unsuccessfully decoded as unread.
272 Default is nil."
273   :group 'gnus-extract
274   :type 'boolean)
275
276 (defcustom gnus-uu-correct-stripped-uucode nil
277   "*Non-nil means that gnus-uu will *try* to fix uuencoded files that have had trailing spaces deleted.
278 Default is nil."
279   :group 'gnus-extract
280   :type 'boolean)
281
282 (defcustom gnus-uu-save-in-digest nil
283   "*Non-nil means that gnus-uu, when asked to save without decoding, will save in digests.
284 If this variable is nil, gnus-uu will just save everything in a
285 file without any embellishments.  The digesting almost conforms to RFC1153 -
286 no easy way to specify any meaningful volume and issue numbers were found,
287 so I simply dropped them."
288   :group 'gnus-extract
289   :type 'boolean)
290
291 (defcustom gnus-uu-pre-uudecode-hook nil
292   "Hook run before sending a message to uudecode."
293   :group 'gnus-extract
294   :type 'hook)
295
296 (defcustom gnus-uu-digest-headers
297   '("^Date:" "^From:" "^To:" "^Cc:" "^Subject:" "^Message-ID:" "^Keywords:"
298     "^Summary:" "^References:" "^Content-Type:" "^Content-Transfer-Encoding:"
299     "^MIME-Version:" "^Content-Disposition:" "^Content-Description:"
300     "^Content-ID:")
301   "*List of regexps to match headers included in digested messages.
302 The headers will be included in the sequence they are matched.  If nil
303 include all headers."
304   :group 'gnus-extract
305   :type '(repeat regexp))
306
307 (defcustom gnus-uu-save-separate-articles nil
308   "*Non-nil means that gnus-uu will save articles in separate files."
309   :group 'gnus-extract
310   :type 'boolean)
311
312 (defcustom gnus-uu-be-dangerous 'ask
313   "*Specifies what to do if unusual situations arise during decoding.
314 If nil, be as conservative as possible.  If t, ignore things that
315 didn't work, and overwrite existing files.  Otherwise, ask each time."
316   :group 'gnus-extract
317   :type '(choice (const :tag "conservative" nil)
318                  (const :tag "ask" ask)
319                  (const :tag "liberal" t)))
320
321 ;; Internal variables
322
323 (defvar gnus-uu-saved-article-name nil)
324
325 (defvar gnus-uu-begin-string "^begin[ \t]+0?[0-7][0-7][0-7][ \t]+\\(.*\\)$")
326 (defvar gnus-uu-end-string "^end[ \t]*$")
327
328 (defvar gnus-uu-body-line "^M")
329 (let ((i 61))
330   (while (> (setq i (1- i)) 0)
331     (setq gnus-uu-body-line (concat gnus-uu-body-line "[^a-z]")))
332   (setq gnus-uu-body-line (concat gnus-uu-body-line ".?$")))
333
334 ;"^M.............................................................?$"
335
336 (defvar gnus-uu-shar-begin-string "^#! */bin/sh")
337
338 (defvar gnus-uu-shar-file-name nil)
339 (defvar gnus-uu-shar-name-marker
340   "begin 0?[0-7][0-7][0-7][ \t]+\\(\\(\\w\\|[.\\:]\\)*\\b\\)")
341
342 (defvar gnus-uu-postscript-begin-string "^%!PS-")
343 (defvar gnus-uu-postscript-end-string "^%%EOF$")
344
345 (defvar gnus-uu-file-name nil)
346 (defvar gnus-uu-uudecode-process nil)
347 (defvar gnus-uu-binhex-article-name nil)
348
349 (defvar gnus-uu-work-dir nil)
350
351 (defvar gnus-uu-output-buffer-name " *Gnus UU Output*")
352
353 (defvar gnus-uu-default-dir gnus-article-save-directory)
354 (defvar gnus-uu-digest-from-subject nil)
355 (defvar gnus-uu-digest-buffer nil)
356
357 ;; Commands.
358
359 (defun gnus-uu-decode-uu (&optional n)
360   "Uudecodes the current article."
361   (interactive "P")
362   (gnus-uu-decode-with-method 'gnus-uu-uustrip-article n))
363
364 (defun gnus-uu-decode-uu-and-save (n dir)
365   "Decodes and saves the resulting file."
366   (interactive
367    (list current-prefix-arg
368          (file-name-as-directory
369           (read-file-name "Uudecode and save in dir: "
370                           gnus-uu-default-dir
371                           gnus-uu-default-dir t))))
372   (gnus-uu-decode-with-method 'gnus-uu-uustrip-article n dir nil nil t))
373
374 (defun gnus-uu-decode-unshar (&optional n)
375   "Unshars the current article."
376   (interactive "P")
377   (gnus-uu-decode-with-method 'gnus-uu-unshar-article n nil nil 'scan t))
378
379 (defun gnus-uu-decode-unshar-and-save (n dir)
380   "Unshars and saves the current article."
381   (interactive
382    (list current-prefix-arg
383          (file-name-as-directory
384           (read-file-name "Unshar and save in dir: "
385                           gnus-uu-default-dir
386                           gnus-uu-default-dir t))))
387   (gnus-uu-decode-with-method 'gnus-uu-unshar-article n dir nil 'scan t))
388
389 (defun gnus-uu-decode-save (n file)
390   "Saves the current article."
391   (interactive
392    (list current-prefix-arg
393          (read-file-name
394           (if gnus-uu-save-separate-articles
395               "Save articles is dir: "
396             "Save articles in file: ")
397           gnus-uu-default-dir
398           gnus-uu-default-dir)))
399   (setq gnus-uu-saved-article-name file)
400   (gnus-uu-decode-with-method 'gnus-uu-save-article n nil t))
401
402 (defun gnus-uu-decode-binhex (n dir)
403   "Unbinhexes the current article."
404   (interactive
405    (list current-prefix-arg
406          (file-name-as-directory
407           (read-file-name "Unbinhex and save in dir: "
408                           gnus-uu-default-dir
409                           gnus-uu-default-dir))))
410   (setq gnus-uu-binhex-article-name
411         (mm-make-temp-file (expand-file-name "binhex" gnus-uu-work-dir)))
412   (gnus-uu-decode-with-method 'gnus-uu-binhex-article n dir))
413
414 (defun gnus-uu-decode-uu-view (&optional n)
415   "Uudecodes and views the current article."
416   (interactive "P")
417   (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
418     (gnus-uu-decode-uu n)))
419
420 (defun gnus-uu-decode-uu-and-save-view (n dir)
421   "Decodes, views and saves the resulting file."
422   (interactive
423    (list current-prefix-arg
424          (read-file-name "Uudecode, view and save in dir: "
425                          gnus-uu-default-dir
426                          gnus-uu-default-dir t)))
427   (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
428     (gnus-uu-decode-uu-and-save n dir)))
429
430 (defun gnus-uu-decode-unshar-view (&optional n)
431   "Unshars and views the current article."
432   (interactive "P")
433   (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
434     (gnus-uu-decode-unshar n)))
435
436 (defun gnus-uu-decode-unshar-and-save-view (n dir)
437   "Unshars and saves the current article."
438   (interactive
439    (list current-prefix-arg
440          (read-file-name "Unshar, view and save in dir: "
441                          gnus-uu-default-dir
442                          gnus-uu-default-dir t)))
443   (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
444     (gnus-uu-decode-unshar-and-save n dir)))
445
446 (defun gnus-uu-decode-save-view (n file)
447   "Saves and views the current article."
448   (interactive
449    (list current-prefix-arg
450          (read-file-name  (if gnus-uu-save-separate-articles
451                               "Save articles is dir: "
452                             "Save articles in file: ")
453                           gnus-uu-default-dir gnus-uu-default-dir)))
454   (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
455     (gnus-uu-decode-save n file)))
456
457 (defun gnus-uu-decode-binhex-view (n file)
458   "Unbinhexes and views the current article."
459   (interactive
460    (list current-prefix-arg
461          (read-file-name "Unbinhex, view and save in dir: "
462                          gnus-uu-default-dir gnus-uu-default-dir)))
463   (setq gnus-uu-binhex-article-name
464         (mm-make-temp-file (expand-file-name "binhex" gnus-uu-work-dir)))
465   (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
466     (gnus-uu-decode-binhex n file)))
467
468
469 ;; Digest and forward articles
470
471 (defun gnus-uu-digest-mail-forward (&optional n post)
472   "Digests and forwards all articles in this series."
473   (interactive "P")
474   (let ((gnus-uu-save-in-digest t)
475         (file (mm-make-temp-file (nnheader-concat gnus-uu-tmp-dir "forward")))
476         (message-forward-as-mime message-forward-as-mime)
477         (mail-parse-charset gnus-newsgroup-charset)
478         (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
479         gnus-uu-digest-buffer subject from)
480     (if (and n (not (numberp n)))
481         (setq message-forward-as-mime (not message-forward-as-mime)
482               n nil))
483     (let ((gnus-article-reply (gnus-summary-work-articles n)))
484       (gnus-setup-message 'forward
485         (setq gnus-uu-digest-from-subject nil)
486         (setq gnus-uu-digest-buffer
487               (gnus-get-buffer-create " *gnus-uu-forward*"))
488         (gnus-uu-decode-save n file)
489         (switch-to-buffer gnus-uu-digest-buffer)
490         (let ((fs gnus-uu-digest-from-subject))
491           (when fs
492             (setq from (caar fs)
493                   subject (gnus-simplify-subject-fuzzy (cdar fs))
494                   fs (cdr fs))
495             (while (and fs (or from subject))
496               (when from
497                 (unless (string= from (caar fs))
498                   (setq from nil)))
499               (when subject
500                 (unless (string= (gnus-simplify-subject-fuzzy (cdar fs))
501                                  subject)
502                   (setq subject nil)))
503               (setq fs (cdr fs))))
504           (unless subject
505             (setq subject "Digested Articles"))
506           (unless from
507             (setq from
508                   (if (gnus-news-group-p gnus-newsgroup-name)
509                       gnus-newsgroup-name
510                     "Various"))))
511         (goto-char (point-min))
512         (when (re-search-forward "^Subject: ")
513           (delete-region (point) (point-at-eol))
514           (insert subject))
515         (goto-char (point-min))
516         (when (re-search-forward "^From:")
517           (delete-region (point) (point-at-eol))
518           (insert " " from))
519         (let ((message-forward-decoded-p t))
520           (message-forward post t))))
521     (setq gnus-uu-digest-from-subject nil)))
522
523 (defun gnus-uu-digest-post-forward (&optional n)
524   "Digest and forward to a newsgroup."
525   (interactive "P")
526   (gnus-uu-digest-mail-forward n t))
527
528 ;; Process marking.
529
530 (defun gnus-message-process-mark (unmarkp new-marked)
531   (let ((old (- (length gnus-newsgroup-processable) (length new-marked))))
532     (message "%d mark%s %s%s"
533              (length new-marked)
534              (if (= (length new-marked) 1) "" "s")
535              (if unmarkp "removed" "added")
536              (cond
537               ((and (zerop old)
538                     (not unmarkp))
539                "")
540               (unmarkp
541                (format ", %d remain marked"
542                        (length gnus-newsgroup-processable)))
543               (t
544                (format ", %d already marked" old))))))
545
546 (defun gnus-new-processable (unmarkp articles)
547   (if unmarkp
548       (gnus-intersection gnus-newsgroup-processable articles)
549     (gnus-set-difference articles gnus-newsgroup-processable)))
550
551 (defun gnus-uu-mark-by-regexp (regexp &optional unmark)
552   "Set the process mark on articles whose subjects match REGEXP.
553 When called interactively, prompt for REGEXP.
554 Optional UNMARK non-nil means unmark instead of mark."
555   (interactive "sMark (regexp): \nP")
556   (save-excursion
557     (let* ((articles (gnus-uu-find-articles-matching regexp))
558            (new-marked (gnus-new-processable unmark articles)))
559       (while articles
560         (if unmark
561             (gnus-summary-remove-process-mark (pop articles))
562           (gnus-summary-set-process-mark (pop articles))))
563       (gnus-message-process-mark unmark new-marked)))
564   (gnus-summary-position-point))
565
566 (defun gnus-uu-unmark-by-regexp (regexp)
567   "Remove the process mark from articles whose subjects match REGEXP.
568 When called interactively, prompt for REGEXP."
569   (interactive "sUnmark (regexp): ")
570   (gnus-uu-mark-by-regexp regexp t))
571
572 (defun gnus-uu-mark-series ()
573   "Mark the current series with the process mark."
574   (interactive)
575   (let* ((articles (gnus-uu-find-articles-matching))
576          (l (length articles)))
577     (while articles
578       (gnus-summary-set-process-mark (car articles))
579       (setq articles (cdr articles)))
580     (message "Marked %d articles" l))
581   (gnus-summary-position-point))
582
583 (defun gnus-uu-mark-region (beg end &optional unmark)
584   "Set the process mark on all articles between point and mark."
585   (interactive "r")
586   (save-excursion
587     (goto-char beg)
588     (while (< (point) end)
589       (if unmark
590           (gnus-summary-remove-process-mark (gnus-summary-article-number))
591         (gnus-summary-set-process-mark (gnus-summary-article-number)))
592       (forward-line 1)))
593   (gnus-summary-position-point))
594
595 (defun gnus-uu-unmark-region (beg end)
596   "Remove the process mark from all articles between point and mark."
597   (interactive "r")
598   (gnus-uu-mark-region beg end t))
599
600 (defun gnus-uu-mark-buffer ()
601   "Set the process mark on all articles in the buffer."
602   (interactive)
603   (gnus-uu-mark-region (point-min) (point-max)))
604
605 (defun gnus-uu-unmark-buffer ()
606   "Remove the process mark on all articles in the buffer."
607   (interactive)
608   (gnus-uu-mark-region (point-min) (point-max) t))
609
610 (defun gnus-uu-mark-thread ()
611   "Marks all articles downwards in this thread."
612   (interactive)
613   (gnus-save-hidden-threads