annotate lisp/gnus/gnus-uu.el @ 30:ec9a17fef872 r19-15b98

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