annotate lisp/gnus-uu.el @ 21629:2da609ac7ab1

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