annotate lisp/=gnus-uu.el @ 6728:cee7995fefe5

Initial revision
author Richard M. Stallman <rms@gnu.org>
date Thu, 07 Apr 1994 16:39:44 +0000
parents
children 77494db73d5b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6728
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; gnus-uu.el --- extract, view or save (uu)encoded files from gnus
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;; Author: Lars Ingebrigtsen <larsi@ifi.uio.no>
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 ;; Created: 2 Oct 1993
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Version: gnus-uu.el v 1.3.6 1994/04/07
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Keyword: gnus
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; For gnus 4.*.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; All gnus-uu commands start with `C-c C-v'.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; Typing `C-c C-v C-v' (gnus-uu-decode-and-view) in the summary
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; buffer will try to find all articles in the same series, uudecode
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; them and view the resulting file(s).
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; gnus-uu guesses what articles are in the series according to the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; following simple rule: The subjects must be identical, except for
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; the last two numbers of the line.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; For example: If you choose a subject called "cat.gif (2/3)" gnus-uu
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; will find all the articles that matches "^cat.gif
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; ([0-9]+/[0-9]+).*$". Subjects that are nonstandard, like "cat.gif
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; (2/3) Part 6 of a series", will not be properly recognized by 'C-c
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; C-v C-v', and you have to mark the articles manually with '#'.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;; Typing `C-c C-v v' (gnus-uu-decode-and-save) will do the same as
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; `C-c C-v C-v', except that it will not display the resulting file, but
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; save it instead.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; Typing `C-c C-v s' (gnus-uu-shar-and-save) does the same as `C-c
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; C-v v', and `C-c C-v C-s' (gnus-uu-shar-and-view) does the same as
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; `C-c C-v C-v', except that they unshar files instead, i. e. run
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; them through /bin/sh. Most shar files can be viewed and/or saved
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; with the normal uudecode commands, which is much safer, as no
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; foreign code is run.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; `#' (gnus-uu-mark-article) marks an article for later
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; decoding/unsharing/saving/viewing. The files will be decoded in the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; sequence they were marked. To decode the files after you've marked
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; the articles you are interested in, type the corresponding key
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; strokes as the normal decoding commands, but put a `M-' in the last
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; keystroke. For instance, to perform a standard uudecode and view,
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; you would type `C-c C-v C-v'. To perform a marked uudecode and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; view, say `C-v C-v M-C-v'. All the other view and save commands are
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; handled the same way; marked uudecode and save is then `C-c C-v
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; M-v'.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; `M-#' (gnus-uu-unmark-article) will remove the mark from a
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; previosly marked article.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; `C-c C-v C-u' (gnus-uu-unmark-all-articles) will remove the mark from
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; all marked articles.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;; `C-c C-v C-r' (gnus-uu-mark-by-regexp) will prompt for a regular
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; expression and mark (forward) all articles matching that regular
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; expression.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;; There's an additional way to reach the decoding functions to make
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; future expansions easier: `C-c C-v C-m'
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; (gnus-uu-multi-decode-and-view) and the corresponding save, marked
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; view and marked save keystrokes, `C-c C-v m', `C-c C-v M-C-m' and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;; `C-c C-v M-m' respectively. You will be prompted for decoding
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 ;; method, like uudecode, shar, binhex or plain save. Note that
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;; methods like binhex and save doesn't have view modes; even if you
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;; issue a view command (`C-c C-v C-m' and "binhex"), gnus-uu will
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; just save the resulting binhex file.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;; `C-c C-v C-b' (gnus-uu-decode-and-show-in-buffer) will decode the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 ;; current article and display the results in an emacs buffer. This
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;; might be useful if there's jsut some text in the current article
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;; that has been uuencoded by some perverse poster.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;; `C-c C-v a' (gnus-uu-decode-and-save-all-articles) looks at all the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;; articles in the current newsgroup and tries to uudecode everything
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;; it can find. The user will be prompted for a directory where the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;; resulting files (if any) will be stored. `C-c C-v M-a' only looks
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ;; at unread article. `C-c C-v w' does the same as `C-c C-v a', but
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ;; also marks as read all articles it has peeked through, even if they
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ;; weren't uuencoded articles. `C-c C-v M-w' is, as you might have
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ;; guessed, similar to `C-c C-v M-a'.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;; `C-c C-v C-l' (gnus-uu-edit-begin-line) lets you edit the begin
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 ;; line of the current buffer. Useful to change an incorrect suffix or
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;; an incorrect begin line.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 ;; When using the view commands, `C-c C-v C-v' for instance, gnus-uu
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 ;; will (normally, see below) try to view the file according to the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 ;; rules given in gnus-uu-default-view-rules and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;; gnus-uu-user-view-rules. If it recognises the file, it will display
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 ;; it immediately. If the file is some sort of archive, gnus-uu will
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 ;; attempt to unpack the archive and see if any of the files in the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 ;; archive can be viewed. For instance, if you have a gzipped tar file
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 ;; "pics.tar.gz" containing the files "pic1.jpg" and "pic2.gif",
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 ;; gnus-uu will uncompress and detar the main file, and then view the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 ;; two pictures. This unpacking process is recursive, so if the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ;; archive contains archives of archives, it'll all be unpacked.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 ;; If the view command doesn't recognise the file type, or can't view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 ;; it because you don't have the viewer, or can't view *any* of the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 ;; files in the archive, the user will be asked if she wishes to have
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 ;; the file saved somewhere. Note that if the decoded file is an
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;; archive, and gnus-uu manages to view some of the files in the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 ;; archive, it won't tell the user that there were some files that
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 ;; were unviewable. See "Interactive view" for a different approach.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 ;; Note that gnus-uu adds a function to `gnus-exit-group-hook' to
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ;; clear the list of marked articles and check for any generated files
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ;; that might have escaped deletion if the user typed `C-g'.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 ;; `C-c C-v C-a' (gnus-uu-toggle-asynchronous) toggles the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 ;; gnus-uu-asynchronous variable. See below for explanation.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 ;; `C-c C-v C-q' (gnus-uu-toggle-query) toggles the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 ;; gnus-uu-ask-before-view variable. See below for explanation.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 ;; `C-c C-v C-p' (gnus-uu-toggle-always-ask) toggles the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 ;; gnus-uu-view-and-save variable. See below for explanation.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 ;; `C-c C-v C-k' (gnus-uu-toggle-kill-carriage-return) toggles the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 ;; gnus-uu-kill-carriage-return variable. See below for explanation.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 ;; `C-c C-v C-i' (gnus-uu-toggle-interactive-view) toggles interactive
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 ;; mode. If it is turned on, gnus-uu won't view files immediately but
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 ;; give you a buffer with the default commands and files and lets you
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 ;; edit the commands and execute them at leisure.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 ;; `C-c C-v C-t' (gnus-uu-toggle-any-variable) is an interface to the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 ;; five toggle commands listed above.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 ;; gnus-uu-toggle-correct-stripped-articles toggles whether to check
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 ;; and correct uuencoded articles that may have had trailing spaces
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 ;; stripped by mailers.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 ;; Customization
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 ;; To load this file when starting gnus, put sumething like the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 ;; following in your .emacs file:
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 ;; (setq gnus-group-mode-hook
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 ;; '(lambda () (load "gnus-uu")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 ;; To make gnus-uu use, for instance, "xli" to view JPEGs and GIFs,
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 ;; put this in your .emacs file:
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 ;; (setq gnus-uu-user-view-rules
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 ;; (list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 ;; '("jpg$\\|gif$" "xli")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 ;; ))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 ;; This variable is a list where each list item is a list containing
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 ;; two strings. The first string is a regular expression. If the file
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 ;; name is matched by this expression, the command given in the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 ;; second string is executed on this file. If the command contains
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 ;; "%s", the file will be inserted there in the command string. Eg.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 ;; "giftoppm %s | xv -" will result in the file name being inserted at
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 ;; the "%s".
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 ;; If you don't want to display certain file types, like if you
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 ;; haven't got sound capabilities, you could put something like
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 ;; (setq gnus-uu-user-view-rules
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 ;; (list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 ;; '("au$\\|voc$\\|wav$" nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 ;; ))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 ;; in your .emacs file.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 ;; There's a similar variable called 'gnus-uu-user-archive-rules'
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 ;; which gives a list of unarcers to use when looking inside archives
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 ;; for files to display.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 ;; If you don't want gnus-uu to look inside archives for files to
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 ;; display, say
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 ;; (setq gnus-uu-do-not-unpack-archives t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 ;; If you want gnus-uu to ask you if you want to save a file after
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 ;; viewing, say
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 ;; (setq gnus-uu-view-and-save t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 ;; If you don't want to wait for the viewing command to finish before
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 ;; returning to emacs, say
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 ;; (setq gnus-uu-asynchronous t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 ;; This can be useful if you're viewing long .mod files, for instance,
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 ;; which often takes several minutes. Note, however, that since
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 ;; gnus-uu doesn't ask, and if you are viewing an archive with lots of
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 ;; viewable files, you'll get them all up more or less at once, which
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 ;; can be confusing, to say the least. To get gnus-uu to ask you
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 ;; before viewing a file, say
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 ;; (setq gnus-uu-ask-before-view t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 ;; You can set this variable even if you're not using asynchronous
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 ;; viewing, of course.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 ;; If the articles has been posted by some numbscull with a PC (isn't
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 ;; that a bit redundant, though?) and there's lots of carriage returns
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 ;; everywhere, say
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 ;; (setq gnus-uu-kill-carriage-return t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 ;; If you want gnus-uu to ignore the default file rules when viewing,
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 ;; for instance if there's several file types that you can't view, set
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 ;; `gnus-uu-ignore-default-view-rules' to `t'. There's a similar
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 ;; variable to disable the default unarchive rule list,
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 ;; `gnus-uu-ignore-default-archive-rules'.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 ;; If you want a more interactive approach to file viewing, say
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 ;; (setq gnus-uu-use-interactive-view t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 ;; If this variable is set, whenever you type `C-c C-v C-v' (or any of
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 ;; the other view commands), gnus-uu will present you with a buffer
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 ;; with the default actions and file names after decoding. You can
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 ;; edit the command lines and execute them in a convenient fashion.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 ;; The output from the commands will be displayed in a small window at
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 ;; the bottom of the emacs window. End interactive mode by typing `C-c
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 ;; C-c' in the view window.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 ;; If you want gnus-uu to unmark articles that you have asked to
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 ;; decode, but can't be decoded (if, for instance, the articles aren't
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 ;; uuencoded files or the posting is incomplete), say
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 ;; (setq gnus-uu-unmark-articles-not-decoded t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 ;; History
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 ;; v1.0: First version released Oct 2 1992.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 ;; v1.1: Changed `C-c C-r' to `C-c C-e' and `C-c C-p' to `C-c C-k'.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 ;; Changed (setq gnus-exit-group-hook) to (add-hook). Removed
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 ;; checking for "Re:" for finding parts.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 ;; v2.2: Fixed handling of currupted archives. Changed uudecoding to
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 ;; an asynchronous process to avoid loading tons of data into emacs
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 ;; buffers. No longer reads articles emacs already have aboard. Fixed
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 ;; a firmer support for shar files. Made regexp searches for files
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 ;; more convenient. Added `C-c C-l' for editing uucode begin
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 ;; lines. Added multi-system decoder entry point. Added interactive
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 ;; view mode. Added function for decoding and saving all uuencoded
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 ;; articles in the current newsgroup.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 ;; v2.3: After suggestions I have changed all the gnus-uu key bindings
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 ;; to avoid hogging all the user keys (C-c LETTER). Also added
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 ;; (provide) and fixed some saving stuff. First posted version to
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 ;; gnu.emacs.sources.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 ;; v2.4: Fixed some more in the save-all category. Automatic fixing of
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 ;; uucode "begin" lines: names on the form of "dir/file" are
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 ;; translated into "dir-file". Added a function for fixing stripped
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 ;; uucode articles. Added binhex save.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 ;; Keymap overview:
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 ;; All commands start with `C-c C-v'. The difference is in the third
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 ;; keystroke. All view commands are `C-LETTER'. All save commands are
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 ;; just `LETTER'. All marked commands are the same as the unmarked
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 ;; commands, except that they have `M-' before in the last keystroke.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 ;; `C-c C-v C-v' gnus-uu-decode-and-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 ;; `C-c C-v v' gnus-uu-decode-and-save
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 ;; `C-c C-v C-s' gnus-uu-shar-and-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 ;; `C-c C-v s' gnus-uu-shar-and-save
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 ;; `C-c C-v C-m' gnus-uu-multi-decode-and-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 ;; `C-c C-v m' gnus-uu-multi-decode-and-save
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 ;; `C-c C-v C-b' gnus-uu-decode-and-show-in-buffer
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 ;; `C-c C-v C-l' gnus-uu-edit-begin-line
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 ;; `C-c C-v M-a' gnus-uu-decode-and-save-all-unread-articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 ;; `C-c C-v a' gnus-uu-decode-and-save-all-articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 ;; `C-c C-v M-w' gnus-uu-decode-and-save-all-unread-articles-and-mark
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 ;; `C-c C-v w' gnus-uu-decode-and-save-all-articles-and-mark
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 ;; `#' gnus-uu-mark-article
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 ;; `M-#' gnus-uu-unmark-article
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 ;; `C-c C-v C-u' gnus-uu-unmark-all-articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 ;; `C-c C-v C-r' gnus-uu-mark-by-regexp
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 ;; `C-c C-v M-C-v' gnus-uu-marked-decode-and-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 ;; `C-c C-v M-v' gnus-uu-marked-decode-and-save
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 ;; `C-c C-v M-C-s' gnus-uu-marked-shar-and-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 ;; `C-c C-v M-s' gnus-uu-marked-shar-and-save
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 ;; `C-c C-v M-C-m' gnus-uu-marked-multi-decode-and-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 ;; `C-c C-v M-m' gnus-uu-marked-multi-decode-and-save
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 ;; `C-c C-v C-a' gnus-uu-toggle-asynchronous
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 ;; `C-c C-v C-q' gnus-uu-toggle-query
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 ;; `C-c C-v C-p' gnus-uu-toggle-always-ask
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 ;; `C-c C-v C-k' gnus-uu-toggle-kill-carriage-return
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 ;; `C-c C-v C-i' gnus-uu-toggle-interactive-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 ;; `C-c C-v C-t' gnus-uu-toggle-any-variable
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 (require 'gnus)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 ;; Binding of keys to the gnus-uu functions.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 (defvar gnus-uu-ctl-map nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 (define-prefix-command 'gnus-uu-ctl-map)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (define-key gnus-summary-mode-map "\C-c\C-v" gnus-uu-ctl-map)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (define-key gnus-uu-ctl-map "\C-v" 'gnus-uu-decode-and-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 (define-key gnus-uu-ctl-map "v" 'gnus-uu-decode-and-save)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (define-key gnus-uu-ctl-map "\C-s" 'gnus-uu-shar-and-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (define-key gnus-uu-ctl-map "s" 'gnus-uu-shar-and-save)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 (define-key gnus-uu-ctl-map "\C-m" 'gnus-uu-multi-decode-and-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (define-key gnus-uu-ctl-map "m" 'gnus-uu-multi-decode-and-save)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 (define-key gnus-uu-ctl-map "\C-b" 'gnus-uu-decode-and-show-in-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 (define-key gnus-summary-mode-map "#" 'gnus-uu-mark-article)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 (define-key gnus-summary-mode-map "\M-#" 'gnus-uu-unmark-article)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 (define-key gnus-uu-ctl-map "\C-u" 'gnus-uu-unmark-all-articles)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 (define-key gnus-uu-ctl-map "\C-r" 'gnus-uu-mark-by-regexp)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 (define-key gnus-uu-ctl-map "\M-\C-v" 'gnus-uu-marked-decode-and-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 (define-key gnus-uu-ctl-map "\M-v" 'gnus-uu-marked-decode-and-save)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 (define-key gnus-uu-ctl-map "\M-\C-s" 'gnus-uu-marked-shar-and-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 (define-key gnus-uu-ctl-map "\M-s" 'gnus-uu-marked-shar-and-save)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 (define-key gnus-uu-ctl-map "\M-\C-m" 'gnus-uu-marked-multi-decode-and-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 (define-key gnus-uu-ctl-map "\M-m" 'gnus-uu-marked-multi-decode-and-save)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 (define-key gnus-uu-ctl-map "\C-a" 'gnus-uu-toggle-asynchronous)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 (define-key gnus-uu-ctl-map "\C-q" 'gnus-uu-toggle-query)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 (define-key gnus-uu-ctl-map "\C-p" 'gnus-uu-toggle-always-ask)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 (define-key gnus-uu-ctl-map "\C-k" 'gnus-uu-toggle-kill-carriage-return)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 (define-key gnus-uu-ctl-map "\C-i" 'gnus-uu-toggle-interactive-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 (define-key gnus-uu-ctl-map "\C-t" 'gnus-uu-toggle-any-variable)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (define-key gnus-uu-ctl-map "\C-l" 'gnus-uu-edit-begin-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 (define-key gnus-uu-ctl-map "\M-a" 'gnus-uu-decode-and-save-all-unread-articles)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 (define-key gnus-uu-ctl-map "a" 'gnus-uu-decode-and-save-all-articles)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 (define-key gnus-uu-ctl-map "\M-w" 'gnus-uu-decode-and-save-all-unread-articles-and-mark)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 (define-key gnus-uu-ctl-map "w" 'gnus-uu-decode-and-save-all-articles-and-mark)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 ;(load "rnewspost")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 ;(define-key news-reply-mode-map "\C-c\C-v" 'gnus-uu-uuencode-and-post)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 ;; Default viewing action rules
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 (defconst gnus-uu-default-view-rules
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 (list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 '("\\.\\(jpe?g\\|gif\\|tiff?\\|p[pgb]m\\|xwd\\|xbm\\|pcx\\)$" "xv")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 '("\\.tga$" "tgatoppm %s | xv -")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 '("\\.te?xt$\\|\\.doc$\\|read.*me" "xterm -e less")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 '("\\.fli$" "xflick")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 '("\\.\\(wav\\|aiff\\|hcom\\|u[blw]\\|s[bfw]\\|voc\\|smp\\)$"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 "sox -v .5 %s -t .au -u - > /dev/audio")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 '("\\.au$" "cat %s > /dev/audio")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 '("\\.mod$" "str32")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 '("\\.ps$" "ghostview")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 '("\\.dvi$" "xdvi")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 '("\\.1$" "xterm -e man -l")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 '("\\.html$" "xmosaic")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 '("\\.mpe?g$" "mpeg_play")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 '("\\.\\(tar\\|arj\\|zip\\|zoo\\|arc\\|gz\\|Z\\|lzh\\|ar\\)$"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 "gnus-uu-archive"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 "This constant is a list that gives the default actions to be taken
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 when the user asks to view a file. To change the behaviour, you can
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 either edit this constant or set 'gnus-uu-user-view-rules' to
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 something useful. To add a default \"end\" rule, edit the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 'gnus-uu-user-view-rules-end' variable.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 For example:
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 To make gnus-uu use 'xli' to display JPEG and GIF files, put the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 following in your .emacs file
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (setq gnus-uu-user-view-rules (list '(\"jpg$\\\\|gif$\" \"xli\")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 Both these variables are lists of lists of strings, where the first
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 string is a regular expression. If the file name matches this regular
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 expression, the command in the second string is fed the file.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 If the command string contains \"%s\", the file name will be inserted
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 at that point in the command string. If there's no \"%s\" in the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 command string, the file name will be appended to the command before
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 executing. ")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 (defvar gnus-uu-user-view-rules nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 "User variable. See explanation of the 'gnus-uu-default-view-rules' for
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 details.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 (defvar gnus-uu-user-view-rules-end nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 "The user may use this variable to provide default viewing rules.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 (defvar gnus-uu-user-interactive-view-rules nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 "If this variable is set and interactive mode is to be used, this
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 variable will be used instead of gnus-uu-user-view-rules.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 (defvar gnus-uu-user-interactive-view-rules-end nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 "If this variable is set and interactive mode is to be used, this
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 variable will be used instead of gnus-uu-user-view-rules-end.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 (defconst gnus-uu-default-interactive-view-rules-begin
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 (list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 '("\\.te?xt$\\|\\.doc$\\|read.*me\\|\\.c?$\\|\\.h$\\|\\.bat$\\|\\.asm$\\|makefile" "cat %s | sed s/ //g")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 '("\\.pas$" "cat %s | sed s/ //g")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 ))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 ;; Default unpacking commands
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 (defconst gnus-uu-default-archive-rules
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 (list '("\\.tar$" "tar xf")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 '("\\.zip$" "unzip")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 '("\\.ar$" "ar x")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 '("\\.arj$" "unarj x")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 '("\\.zoo$" "zoo -e")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 '("\\.lzh$" "lha x")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 '("\\.Z$" "uncompress")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 '("\\.gz$" "gunzip")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 '("\\.arc$" "arc -x"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 "*")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 (defvar gnus-uu-user-archive-rules nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 ;; Various variables users may set
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 (defvar gnus-uu-tmp-dir "/tmp/"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 "Variable saying where gnus-uu is to do its work. Default is \"/tmp/\".")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 (defvar gnus-uu-do-not-unpack-archives nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 "Set this variable if you don't want gnus-uu to look inside
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 archives for files to display. Default is `nil'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 (defvar gnus-uu-do-not-unpack-archives nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 "Set this variable if you don't want gnus-uu to look inside
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 archives for files to display. Default is `nil'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 (defvar gnus-uu-view-and-save nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 "Set this variable if you want to be asked if you want to save the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 file after viewing. If this variable is nil, which is the default,
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 gnus-uu won't offer to save a file if viewing is successful. Default
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 is `nil'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 (defvar gnus-uu-asynchronous nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 "Set this variable to `t' if you don't want gnus-uu to wait until
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 the viewing command has ended before returning control to emacs.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 Default is `nil'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 (defvar gnus-uu-ask-before-view nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 "Set this variable to `t' if you want gnus-uu to ask you before
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 viewing every file. Useful when `gnus-uu-asynchronous' is set. Default
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 is `nil'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 (defvar gnus-uu-ignore-default-view-rules nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 "Set this variable if you want gnus-uu to ignore the default viewing
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 rules and just use the rules given in gnus-uu-user-view-rules. Default
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 is `nil'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (defvar gnus-uu-ignore-default-archive-rules nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 "Set this variable if you want gnus-uu to ignore the default archive
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 unpacking commands and just use the rules given in
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 gnus-uu-user-archive-rules. Default is `nil'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 (defvar gnus-uu-kill-carriage-return t
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 "Set this variable if you want to remove all carriage returns from
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 the mail articles. Default is `t'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (defvar gnus-uu-unmark-articles-not-decoded nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 "If this variable is set, artciles that are unsuccessfully decoded
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 are marked as unread. Default is `nil'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 (defvar gnus-uu-output-window-height 20
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 "This variable says how hight the output buffer window is to be when
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 using interactive view mode. Change it at your convenience. Default is 20.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 (defvar gnus-uu-correct-stripped-uucode nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 "If this variable is set, gnus-uu will try to correct uuencoded files that
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 have had trailing spaces stripped by nosy mail saoftware. Default is `nil'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 (defvar gnus-uu-use-interactive-view nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 "If this variable is set, gnus-uu will create a special buffer where
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 the user may choose interactively which files to view and how. Default
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 is `nil'.")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 ;; Internal variables
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 (defconst gnus-uu-begin-string "^begin[ \t]+[0-7][0-7][0-7][ \t]+\\(.*\\)$"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 "*")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 (defconst gnus-uu-end-string "^end[ \t]*$")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 (defconst gnus-uu-body-line
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 "^M.............................................................?$" "*")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 (defconst gnus-uu-shar-begin-string "^#! */bin/sh" "*")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 (defvar gnus-uu-shar-file-name nil "*")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 (defconst gnus-uu-shar-name-marker "begin [0-7][0-7][0-7][ \t]+\\(\\(\\w\\|\\.\\)*\\b\\)" "*")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 (defvar gnus-uu-shar-directory nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 (defvar gnus-uu-file-name nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 (defconst gnus-uu-uudecode-process nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 (defvar gnus-uu-interactive-file-list nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 (defvar gnus-uu-marked-article-list nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 (defvar gnus-uu-generated-file-list nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 (defconst gnus-uu-interactive-buffer-name "*gnus-uu interactive*")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 (defconst gnus-uu-output-buffer-name "*Gnus UU Output*")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 (defconst gnus-uu-result-buffer "*Gnus UU Result Buffer*")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 ;; Interactive functions
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 ;; UUdecode and view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 (defun gnus-uu-decode-and-view ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 "UUdecodes and 'views' (if possible) the resulting file.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 'Viewing' can be any action at all, as defined in the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 'gnus-uu-file-action-list' variable. Running 'xv' on gifs and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 'play' on au files are popular actions. If the file can't be viewed,
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526 the user is asked if she would like to save the file instead."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 (gnus-uu-decode-and-view-or-save t nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 (defun gnus-uu-decode-and-save ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 "uudecodes and saves the resulting file."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 (gnus-uu-decode-and-view-or-save nil nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535 (defun gnus-uu-marked-decode-and-view ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 "The marked equivalent to gnus-uu-decode-and-view."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 (gnus-uu-decode-and-view-or-save t t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 (defun gnus-uu-marked-decode-and-save ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 "The marked equivalent to gnus-uu-decode-and-save."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 (gnus-uu-decode-and-view-or-save nil t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 ;; Unshar and view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 (defun gnus-uu-shar-and-view ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 "Does the same as gnus-uu-decode-and-view for shar files."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 (gnus-uu-unshar-and-view-or-save t nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 (defun gnus-uu-shar-and-save ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 "Does the same as gnus-uu-decode-and-save for shar files."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 (gnus-uu-unshar-and-view-or-save nil nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 (defun gnus-uu-marked-shar-and-view ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 "The marked equivalent to gnus-uu-shar-and-view."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 (gnus-uu-unshar-and-view-or-save t t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 (defun gnus-uu-marked-shar-and-save ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 "The marked equivalent to gnus-uu-shar-and-save."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 (gnus-uu-unshar-and-view-or-save nil t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 ;; Decode and show in buffer
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 (defun gnus-uu-decode-and-show-in-buffer ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 "uudecodes the current article and displays the result in a buffer."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 (let ((uu-buffer (get-buffer-create gnus-uu-output-buffer-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 list-of-articles file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 (and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 (setq list-of-articles (list gnus-current-article))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 (gnus-uu-grab-articles list-of-articles 'gnus-uu-uustrip-article-as)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 (setq file-name (gnus-uu-decode gnus-uu-tmp-dir))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 (set-buffer uu-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 (erase-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 (insert-file-contents file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 (set-window-buffer (get-buffer-window gnus-article-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 uu-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 (message (format "Showing file %s in buffer" file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 (delete-file file-name))))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592 ;; Toggle commands
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594 (defun gnus-uu-toggle-asynchronous ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 "This function toggles asynchronous viewing."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 (if (setq gnus-uu-asynchronous (not gnus-uu-asynchronous))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 (message "gnus-uu will now view files asynchronously")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 (message "gnus-uu will now view files synchronously")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 (defun gnus-uu-toggle-query ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 "This function toggles whether to ask before viewing or not."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 (if (setq gnus-uu-ask-before-view (not gnus-uu-ask-before-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 (message "gnus-uu will now ask before viewing")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 (message "gnus-uu will now view without asking first")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608 (defun gnus-uu-toggle-always-ask ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 "This function toggles whether to ask saving a file even after successful
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 viewing."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 (if (setq gnus-uu-view-and-save (not gnus-uu-view-and-save))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 (message "gnus-uu will now ask to save the file after viewing")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 (message "gnus-uu will now not ask to save after successful viewing")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616 (defun gnus-uu-toggle-interactive-view ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 "This function toggles whether to use interactive view."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619 (if (setq gnus-uu-use-interactive-view (not gnus-uu-use-interactive-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 (message "gnus-uu will now use interactive view")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621 (message "gnus-uu will now use non-interactive view")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
623 (defun gnus-uu-toggle-unmark-undecoded ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
624 "This function toggles whether to unmark articles not decoded."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 (if (setq gnus-uu-unmark-articles-not-decoded
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 (not gnus-uu-unmark-articles-not-decoded))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628 (message "gnus-uu will now unmark articles not decoded")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 (message "gnus-uu will now not unmark articles not decoded")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631 (defun gnus-uu-toggle-kill-carriage-return ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 "This function toggles the stripping of carriage returns from the articles."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 (if (setq gnus-uu-kill-carriage-return (not gnus-uu-kill-carriage-return))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 (message "gnus-uu will now strip carriage returns")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 (message "gnus-uu won't strip carriage returns")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 (defun gnus-uu-toggle-correct-stripped-uucode ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 "This function toggles whether to correct stripped uucode."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 (if (setq gnus-uu-correct-stripped-uucode
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 (not gnus-uu-correct-stripped-uucode))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 (message "gnus-uu will now correct stripped uucode")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 (message "gnus-uu won't check and correct stripped uucode")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 (defun gnus-uu-toggle-any-variable ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 "This function ask what variable the user wants to toggle."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 (let (rep)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 (message "(a)sync, (q)uery, (p)ask, (k)ill CR, (i)nteractive, (u)nmark, (c)orrect")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 (setq rep (read-char))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 (if (= rep ?a)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 (gnus-uu-toggle-asynchronous))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 (if (= rep ?q)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 (gnus-uu-toggle-query))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 (if (= rep ?p)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 (gnus-uu-toggle-always-ask))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 (if (= rep ?k)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 (gnus-uu-toggle-kill-carriage-return))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 (if (= rep ?u)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661 (gnus-uu-toggle-unmark-undecoded))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 (if (= rep ?c)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 (gnus-uu-toggle-correct-stripped-uucode))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 (if (= rep ?i)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 (gnus-uu-toggle-interactive-view))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668 ;; Edit line
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 (defun gnus-uu-edit-begin-line ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 "Edit the begin line of the current article."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 (let ((buffer-read-only nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 begin b)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 (set-buffer gnus-article-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 (goto-line 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678 (if (not (re-search-forward "begin " nil t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 (progn (message "No begin line in the current article") (sit-for 2))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 (setq b (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683 (setq begin (buffer-substring b (point)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 (setq begin (read-string "" begin))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 (setq buffer-read-only nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 (delete-region b (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 (insert-string begin)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 ;; Multi functions
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 (defun gnus-uu-multi-decode-and-view ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 "This function lets the user decide what method to use for decoding.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 Other than that, it's equivalent to the other decode-and-view functions."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 (gnus-uu-multi-decode-and-view-or-save t nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 (defun gnus-uu-multi-decode-and-save ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 "This function lets the user decide what method to use for decoding.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 Other than that, it's equivalent to the other decode-and-save functions."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 (gnus-uu-multi-decode-and-view-or-save nil nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 (defun gnus-uu-marked-multi-decode-and-view ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 "This function lets the user decide what method to use for decoding.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 Other than that, it's equivalent to the other marked decode-and-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 functions."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 (gnus-uu-multi-decode-and-view-or-save t t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 (defun gnus-uu-marked-multi-decode-and-save ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 "This function lets the user decide what method to use for decoding.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 Other than that, it's equivalent to the other marked decode-and-save
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 functions."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715 (gnus-uu-multi-decode-and-view-or-save t t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 (defun gnus-uu-multi-decode-and-view-or-save (view marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 (let (decode-type)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719 (message "(u)udecode, (s)har, s(a)ve, (b)inhex: ")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 (setq decode-type (read-char))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 (if (= decode-type ? ) (setq decode-type ?u))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 (if (= decode-type ?u)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723 (gnus-uu-decode-and-view-or-save view marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 (if (= decode-type ?s)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725 (gnus-uu-unshar-and-view-or-save view marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726 (if (= decode-type ?b)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727 (gnus-uu-binhex-and-save view marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728 (if (= decode-type ?a)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
729 (gnus-uu-save-articles view marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730 (message (format "Unknown decode method '%c'." decode-type))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 (sit-for 2)))))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
733
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
734 ;; uuencode and post
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
735
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 (defun gnus-uu-news-inews ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 "Send a news message using inews."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
739 (let* (newsgroups subject
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740 (case-fold-search nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
742 (save-restriction
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743 (goto-char (point-min))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744 (search-forward (concat "\n" mail-header-separator "\n"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
745 (narrow-to-region (point-min) (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
746 (setq newsgroups (mail-fetch-field "newsgroups")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 subject (mail-fetch-field "subject")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
748 (widen)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749 (goto-char (point-min))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
750 ; (run-hooks 'news-inews-hook)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
751 (goto-char (point-min))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
752 (search-forward (concat "\n" mail-header-separator "\n"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
753 (replace-match "\n\n")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
754 (goto-char (point-max))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
755 ;; require a newline at the end for inews to append .signature to
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
756 (or (= (preceding-char) ?\n)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
757 (insert ?\n))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
758 (message "Posting to USENET...")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
759 (call-process-region (point-min) (point-max)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
760 news-inews-program nil 0 nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
761 "-h") ; take all header lines!
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
762 ;@@ setting of subject and newsgroups still needed?
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
763 ;"-t" subject
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
764 ;"-n" newsgroups
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
765 (message "Posting to USENET... done")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
766 (goto-char (point-min)) ;restore internal header separator
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
767 (search-forward "\n\n")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
768 (replace-match (concat "\n" mail-header-separator "\n")))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
769
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
770 (autoload 'news-inews "rnewspost")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
771
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
772 (defun gnus-uu-post-buffer (&optional first)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773 (append-to-file 1 (point-max) "/tmp/gnusuutull")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
774 ; (if first
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
775 ; (news-inews)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
776 ; (gnus-uu-news-inews))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
777 (message "posted"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
778
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
779 (defconst gnus-uu-uuencode-post-length 20)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
780
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
781 (defun gnus-uu-uuencode-and-post ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
782 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
783 (let (file uubuf sendbuf short-file length parts header i end beg
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
784 beg-line minlen)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
785 (setq file (read-file-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
786 "What file do you want to uuencode and post? " "~/Unrd.jpg"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
787 (if (not (file-exists-p file))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
788 (message "%s: No such file" file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
789 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
790 (setq uubuf (get-buffer-create "*uuencode buffer*"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
791 (setq sendbuf (get-buffer-create "*uuencode send buffer*"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
792 (set-buffer uubuf)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
793 (erase-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
794 (if (string-match "^~/" file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
795 (setq file (concat "$HOME" (substring file 1))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
796 (if (string-match "/[^/]*$" file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
797 (setq short-file (substring file (1+ (match-beginning 0))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
798 (setq short-file file))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
799 (call-process "sh" nil uubuf nil "-c"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
800 (format "uuencode %s %s" file short-file))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
801 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
802 (forward-line 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
803 (while (re-search-forward " " nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
804 (replace-match "`"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
805 (setq length (count-lines 1 (point-max)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
806 (setq parts (/ length gnus-uu-uuencode-post-length))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
807 (if (not (< (% length gnus-uu-uuencode-post-length) 4))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
808 (setq parts (1+ parts)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
809 (message "Det er %d parts" parts))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
810 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
811 (search-forward mail-header-separator nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
812 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
813 (forward-line 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
814 (setq header (buffer-substring 1 (point)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
815 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
816 (if (re-search-forward "^Subject: " nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
817 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
818 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
819 (insert (format " (0/%d)" parts))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
820 (gnus-uu-post-buffer t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
821 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
822 (set-buffer sendbuf)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
823 (setq i 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
824 (setq beg 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
825 (while (not (> i parts))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
826 (set-buffer sendbuf)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
827 (erase-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
828 (insert header)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
829 (insert "\n")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
830 (setq minlen (/ (- 62 (length (format " (%d/%d) " i parts))) 2))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
831 (setq beg-line (format "[ cut here %s (%d/%d) %s gnus-uu ]\n"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
832 (make-string (- minlen 11) ?-) i parts
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
833 (make-string (- minlen 10) ?-)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
834 (insert beg-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
835 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
836 (if (re-search-forward "^Subject: " nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
837 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
838 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
839 (insert (format " (%d/%d)" i parts))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
840 (goto-char (point-max))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
841 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
842 (set-buffer uubuf)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
843 (goto-char beg)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
844 (if (= i parts)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
845 (goto-char (point-max))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
846 (forward-line gnus-uu-uuencode-post-length))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
847 (setq end (point)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
848 (insert-buffer-substring uubuf beg end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
849 (insert beg-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
850 (setq beg end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
851 (setq i (1+ i))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
852 (gnus-uu-post-buffer)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
853 )))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
854
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
855
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
856
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
857 ;; Decode and all files
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
858
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859 (defconst gnus-uu-rest-of-articles nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
860 (defconst gnus-uu-do-sloppy-uudecode nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
861 (defvar gnus-uu-current-save-dir nil "*")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
862
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
863 (defun gnus-uu-decode-and-save-all-unread-articles ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
864 "This function reads all unread articles in the current group and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
865 sees whether it can uudecode the articles. The user will be prompted
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
866 for an directory to put the resulting (if any) files."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
867 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
868 (gnus-uu-decode-and-save-articles t t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
869
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
870 (defun gnus-uu-decode-and-save-all-articles ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
871 "Does the same as gnus-uu-decode-and-save-all-unread-articles, except
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
872 that it grabs all articles visible, unread or not."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
873 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
874 (gnus-uu-decode-and-save-articles nil t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
875
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
876 (defun gnus-uu-decode-and-save-all-unread-articles-and-mark ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
877 "Does the same as gnus-uu-decode-and-save-all-unread-articles, except that
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
878 it marks everything as read, even if it couldn't decode the articles."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
879 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
880 (gnus-uu-decode-and-save-articles t nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
881
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
882 (defun gnus-uu-decode-and-save-all-articles-and-mark ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
883 "Does the same as gnus-uu-decode-and-save-all-articles, except that
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
884 it marks everything as read, even if it couldn't decode the articles."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
885 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
886 (gnus-uu-decode-and-save-articles nil nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
887
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
888 (defun gnus-uu-decode-and-save-articles (&optional unread unmark)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
889 (let ((gnus-uu-unmark-articles-not-decoded unmark)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
890 (filest "")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
891 where dir did unmark saved-list)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
892 (setq gnus-uu-do-sloppy-uudecode t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
893 (setq dir (gnus-uu-read-directory "Where do you want the files? "))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
894 (message "Grabbing...")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
895 (setq gnus-uu-rest-of-articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
896 (gnus-uu-get-list-of-articles "^." nil unread))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
897 (setq gnus-uu-file-name nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
898 (while (and gnus-uu-rest-of-articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
899 (gnus-uu-grab-articles gnus-uu-rest-of-articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
900 'gnus-uu-uustrip-article-as))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
901 (if gnus-uu-file-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
902 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
903 (setq saved-list (cons gnus-uu-file-name saved-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
904 (rename-file (concat gnus-uu-tmp-dir gnus-uu-file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
905 (concat dir gnus-uu-file-name) t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
906 (setq did t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
907 (setq gnus-uu-file-name nil))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
908 (if (not did)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
909 ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
910 (while saved-list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
911 (setq filest (concat filest " " (car saved-list)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
912 (setq saved-list (cdr saved-list)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
913 (message "Saved%s" filest)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
914 (setq gnus-uu-do-sloppy-uudecode nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
915
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
916
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
917 ;; Work functions
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
918
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
919 (defun gnus-uu-decode-and-view-or-save (view marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
920 (gnus-uu-initialize)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
921 (let (file decoded)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
922 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
923 (if (gnus-uu-decode-and-strip nil marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
924 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
925 (setq decoded t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
926 (setq file (concat gnus-uu-tmp-dir gnus-uu-file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
927 (if view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
928 (gnus-uu-view-file file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
929 (gnus-uu-save-file file)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
930
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
931 (gnus-uu-summary-next-subject)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
932
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
933 (if (and gnus-uu-use-interactive-view view decoded)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
934 (gnus-uu-do-interactive))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
935
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
936 (if (or (not gnus-uu-use-interactive-view) (not decoded))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
937 (gnus-uu-clean-up))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
938
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
939
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
940 (defun gnus-uu-unshar-and-view-or-save (view marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
941 "Unshars and views/saves marked/unmarked articles."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
942 (gnus-uu-initialize)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
943 (let (tar-file files decoded)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
944 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
945 (setq gnus-uu-shar-directory
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
946 (make-temp-name (concat gnus-uu-tmp-dir "gnusuush")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
947 (make-directory gnus-uu-shar-directory)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
948 (gnus-uu-add-file gnus-uu-shar-directory)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
949 (if (gnus-uu-decode-and-strip t marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
950 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
951 (setq decoded t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
952 (setq files (directory-files gnus-uu-shar-directory t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
953 (setq gnus-uu-generated-file-list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
954 (append files gnus-uu-generated-file-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
955 (if (> (length files) 3)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
956 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
957 (setq tar-file
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
958 (concat
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
959 (make-temp-name (concat gnus-uu-tmp-dir "gnusuuar"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
960 ".tar"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
961 (gnus-uu-add-file tar-file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
962 (call-process "sh" nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
963 (get-buffer-create gnus-uu-output-buffer-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
964 nil "-c"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
965 (format "cd %s ; tar cf %s * ; cd .. ; rm -r %s"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
966 gnus-uu-shar-directory
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
967 tar-file
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
968 gnus-uu-shar-directory))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
969 (if view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
970 (gnus-uu-view-file tar-file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
971 (gnus-uu-save-file tar-file)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
972 (if view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
973 (gnus-uu-view-file (elt files 2))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
974 (gnus-uu-save-file (elt files 2)))))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
975
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
976 (gnus-uu-summary-next-subject)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
977
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
978 (if (and gnus-uu-use-interactive-view view decoded)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
979 (gnus-uu-do-interactive))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
980
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
981 (if (or (not gnus-uu-use-interactive-view) (not decoded))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
982 (gnus-uu-clean-up))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
983
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
984
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
985 (defconst gnus-uu-saved-article-name nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
986 (defun gnus-uu-save-articles (view marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
987 (let (list-of-articles)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
988 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
989 (if (not marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
990 (setq list-of-articles (gnus-uu-get-list-of-articles))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
991 (setq list-of-articles (reverse gnus-uu-marked-article-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
992 (setq gnus-uu-marked-article-list nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
993 (if (not list-of-articles)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
994 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
995 (message "No list of articles")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
996 (sit-for 2))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
997 (setq gnus-uu-saved-article-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
998 (concat gnus-uu-tmp-dir
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
999 (read-file-name "Enter file name: " gnus-newsgroup-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1000 gnus-newsgroup-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1001 (gnus-uu-add-file gnus-uu-saved-article-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1002 (if (gnus-uu-grab-articles list-of-articles 'gnus-uu-save-article)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1003 (gnus-uu-save-file gnus-uu-saved-article-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1004 ))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1005
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1006
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1007 (defun gnus-uu-save-article (buffer in-state)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1008 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1009 (set-buffer buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1010 (call-process-region
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1011 1 (point-max) "sh" nil (get-buffer-create gnus-uu-output-buffer-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1012 nil "-c" (concat "cat >> " gnus-uu-saved-article-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1013 'ok)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1014
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1015
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1016 ;; Binhex
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1017 (defconst gnus-uu-binhex-body-line
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1018 "^................................................................$")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1019 (defconst gnus-uu-binhex-begin-line
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1020 "^:...............................................................$")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1021 (defconst gnus-uu-binhex-end-line
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1022 ":$")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1023 (defvar gnus-uu-binhex-article-name nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1024
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1025
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1026 (defun gnus-uu-binhex-and-save (view marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1027 (let (list-of-articles)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1028 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1029 (if (not marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1030 (setq list-of-articles (gnus-uu-get-list-of-articles))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1031 (setq list-of-articles (reverse gnus-uu-marked-article-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1032 (setq gnus-uu-marked-article-list nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1033 ' (setq gn-dummy-l list-of-articles)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1034 (if (not list-of-articles)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1035 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1036 (message "No list of articles")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1037 (sit-for 2))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1038 (setq gnus-uu-binhex-article-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1039 (concat gnus-uu-tmp-dir
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1040 (read-file-name "Enter binhex file name: "
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1041 gnus-newsgroup-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1042 gnus-newsgroup-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1043 (gnus-uu-add-file gnus-uu-binhex-article-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1044 (if (gnus-uu-grab-articles list-of-articles 'gnus-uu-binhex-article)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1045 (gnus-uu-save-file gnus-uu-binhex-article-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1046 ))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1047
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1048
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1049 (defun gnus-uu-binhex-article (buffer in-state)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1050 (let ((state 'ok)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1051 start-char)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1052 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1053 (set-buffer buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1054 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1055 (if (not (re-search-forward (concat gnus-uu-binhex-begin-line "\\|"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1056 gnus-uu-binhex-body-line) nil t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1057 (setq state 'wrong-type)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1058 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1059 (setq start-char (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1060 (if (looking-at gnus-uu-binhex-begin-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1061 (setq state 'begin)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1062 (setq state 'middle))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1063 (goto-char (point-max))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1064 (re-search-backward (concat gnus-uu-binhex-body-line "\\|"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1065 gnus-uu-binhex-end-line) nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1066 (if (looking-at gnus-uu-binhex-end-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1067 (if (eq state 'begin)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1068 (setq state 'begin-and-end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1069 (setq state 'end)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1070 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1071 (forward-line 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1072 (append-to-file start-char (point) gnus-uu-binhex-article-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1073 state))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1074
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1075
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1076 ;; Internal view commands
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1077
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1078 (defun gnus-uu-view-file (file-name &optional dont-ask)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1079 "This function takes two parameters. The first is name of the file to be
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1080 viewed. gnus-uu-view-file will look for an action associated with the file
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1081 type of the file. If it finds an appropriate action, the file will be
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1082 attempted displayed.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1083
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1084 The second parameter specifies if the user is to be asked whether to
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1085 save the file if viewing is unsuccessful. `t' means 'do not ask.'
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1086
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1087 Note that the file given will be deleted by this function, one way or
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1088 another. If `gnus-uu-asynchronous' is set, it won't be deleted right
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1089 away, but sometime later. If the user is offered to save the file, it'll
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1090 be moved to wherever the user wants it.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1091
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1092 gnus-uu-view-file returns `t' if viewing is successful."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1093 (let (action did-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1094 (didnt-want t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1095 (do-view t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1096 (setq action
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1097 (gnus-uu-choose-action
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1098 file-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1099 (append
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1100 (if (and gnus-uu-use-interactive-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1101 gnus-uu-user-interactive-view-rules)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1102 gnus-uu-user-interactive-view-rules
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1103 gnus-uu-user-view-rules)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1104 (if (or gnus-uu-ignore-default-view-rules
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1105 (not gnus-uu-use-interactive-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1106 ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1107 gnus-uu-default-interactive-view-rules-begin)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1108 (if gnus-uu-ignore-default-view-rules
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1109 nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1110 gnus-uu-default-view-rules)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1111 (if (and gnus-uu-use-interactive-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1112 gnus-uu-user-interactive-view-rules-end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1113 gnus-uu-user-interactive-view-rules-end
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1114 gnus-uu-user-view-rules-end))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1115
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1116 (if (and gnus-uu-use-interactive-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1117 (not (string= (or action "") "gnus-uu-archive")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1118 (gnus-uu-enter-interactive-file (or action "") file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1119
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1120 (if action
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1121 (if (string= action "gnus-uu-archive")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1122 (setq did-view (gnus-uu-treat-archive file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1123
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1124 (if gnus-uu-ask-before-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1125 (setq didnt-want
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1126 (or (not
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1127 (setq do-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1128 (y-or-n-p
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1129 (format "Do you want to view %s? "
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1130 file-name))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1131 didnt-want)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1132
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1133 (if do-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1134 (setq did-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1135 (if gnus-uu-asynchronous
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1136 (gnus-uu-call-asynchronous file-name action)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1137 (gnus-uu-call-synchronous file-name action))))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1138
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1139 (if (and (not dont-ask) (not gnus-uu-use-interactive-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1140 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1141 (if (and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1142 didnt-want
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1143 (or (not action)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1144 (and (string= action "gnus-uu-archive") (not did-view))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1145 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1146 (message (format "Could find no rule for %s" file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1147 (sit-for 2)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1148 (and (or (not did-view) gnus-uu-view-and-save)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1149 (y-or-n-p
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1150 (format "Do you want to save the file %s? " file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1151 (gnus-uu-save-file file-name))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1152
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1153 (if (and (file-exists-p file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1154 (not gnus-uu-use-interactive-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1155 (or
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1156 (not (and gnus-uu-asynchronous did-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1157 (string= action "gnus-uu-archive")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1158 (delete-file file-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1159
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1160 did-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1161
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1162
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1163 (defun gnus-uu-call-synchronous (file-name action)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1164 "Takes two parameters: The name of the file to be displayed and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1165 the command to display it with. Returns `t' on success and `nil' if
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1166 the file couldn't be displayed."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1167 (let (did-view command)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1168 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1169 (set-buffer (get-buffer-create gnus-uu-output-buffer-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1170 (erase-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1171 (if (string-match "%s" action)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1172 (setq command (format action (concat "'" file-name "'")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1173 (setq command (concat action " " (concat "'" file-name "'"))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1174 (message (format "Viewing with '%s'" command))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1175 (if (not (= 0 (call-process "sh" nil t nil "-c" command)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1176 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1177 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1178 (while (re-search-forward "\n" nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1179 (replace-match " "))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1180 (message (concat "Error: " (buffer-substring 1 (point-max))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1181 (sit-for 2))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1182 (message "")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1183 (setq did-view t)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1184 did-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1185
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1186
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1187 (defun gnus-uu-call-asynchronous (file-name action)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1188 "Takes two parameters: The name of the file to be displayed and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1189 the command to display it with. Since the view command is executed
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1190 asynchronously, it's kinda hard to decide whether the command succeded
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1191 or not, so this function always returns `t'. It also adds \"; rm -f
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1192 file-name\" to the end of the execution string, so the file will be
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1193 removed after viewing has ended."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1194 (let (command file tmp-file start)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1195 (while (string-match "/" file-name start)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1196 (setq start (1+ (match-beginning 0))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1197 (setq file (substring file-name start))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1198 (setq tmp-file (concat gnus-uu-tmp-dir file))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1199 (if (string= tmp-file file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1200 ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1201 (rename-file file-name tmp-file t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1202 (setq file-name tmp-file))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1203
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1204 (if (string-match "%s" action)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1205 (setq command (format action file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1206 (setq command (concat action " " file-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1207 (setq command (format "%s ; rm -f %s" command file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1208 (message (format "Viewing with %s" command))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1209 (start-process "gnus-uu-view"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1210 nil "sh" "-c" command)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1211 t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1212
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1213
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1214 (defun gnus-uu-decode-and-strip (&optional shar use-marked)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1215 "This function does all the main work. It finds out what articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1216 to grab, grabs them, strips the result and decodes. If any of
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1217 these operations fail, it returns `nil', `t' otherwise.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1218 If shar is `t', it will pass this on to gnus-uu-grab-articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1219 who will (probably) unshar the articles. If use-marked
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1220 is non-nil, it won't try to find articles, but use the marked list."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1221 (let (list-of-articles)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1222 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1223
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1224 (if use-marked
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1225 (progn (if (eq gnus-uu-marked-article-list ())
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1226 (message "No articles marked")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1227 (setq list-of-articles (reverse gnus-uu-marked-article-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1228 (gnus-uu-unmark-all-articles)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1229 (setq list-of-articles (gnus-uu-get-list-of-articles)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1230
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1231 (and list-of-articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1232 (gnus-uu-grab-articles list-of-articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1233 (if shar
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1234 'gnus-uu-unshar-article
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1235 'gnus-uu-uustrip-article-as))))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1236
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1237
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1238 (defun gnus-uu-reginize-string (string)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1239 "Takes a string and puts a \\ in front of every special character;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1240 ignores any leading \"version numbers\"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1241 thingies that they use in the comp.binaries groups, and either replaces
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1242 anything that looks like \"2/3\" with \"[0-9]+/[0-9]+\" or, if it can't find
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1243 something like that, replaces the last two numbers with \"[0-9]+\". This,
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1244 in my experience, should get most postings of a series."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1245 (let ((count 2)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1246 (vernum "v[0-9][0-9][a-z][0-9]+:")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1247 reg beg)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1248 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1249 (set-buffer (get-buffer-create gnus-uu-output-buffer-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1250 (erase-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1251 (insert (regexp-quote string))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1252 (setq beg 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1253
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1254 (setq case-fold-search nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1255 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1256 (if (looking-at vernum)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1257 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1258 (replace-match vernum t t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1259 (setq beg (length vernum))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1260
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1261 (goto-char beg)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1262 (if (re-search-forward "[ \t]*[0-9]+/[0-9]+" nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1263 (replace-match " [0-9]+/[0-9]+")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1264
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1265 (goto-char beg)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1266 (if (re-search-forward "[0-9]+[ \t]*of[ \t]*[0-9]+" nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1267 (replace-match "[0-9]+ of [0-9]+")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1268
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1269 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1270 (while (and (re-search-backward "[0-9]" nil t) (> count 0))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1271 (while (and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1272 (looking-at "[0-9]")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1273 (< 1 (goto-char (1- (point))))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1274 (re-search-forward "[0-9]+" nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1275 (replace-match "[0-9]+")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1276 (backward-char 5)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1277 (setq count (1- count)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1278
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1279 (goto-char beg)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1280 (while (re-search-forward "[ \t]+" nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1281 (replace-match "[ \t]*" t t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1282
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1283 (buffer-substring 1 (point-max)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1284
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1285
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1286 (defun gnus-uu-get-list-of-articles (&optional subject mark-articles only-unread)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1287 "Finds all articles that matches the regular expression given.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1288 Returns the resulting list."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1289 (let (beg end reg-subject list-of-subjects list-of-numbers art-num)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1290 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1291
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1292 ; If the subject is not given, this function looks at the current subject
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1293 ; and takes that.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1294
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1295 (if subject
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1296 (setq reg-subject subject)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1297 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1298 (setq end (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1299 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1300 (if (not (re-search-forward "\\] " end t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1301 (progn (message "No valid subject chosen") (sit-for 2))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1302 (setq subject (buffer-substring (point) end))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1303 (setq reg-subject
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1304 (concat "\\[.*\\] " (gnus-uu-reginize-string subject)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1305
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1306 ; (message reg-subject)(sleep-for 2)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1307
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1308 (if reg-subject
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1309 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1310
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1311 ; Collect all subjects matching reg-subject.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1312
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1313 (let ((case-fold-search t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1314 (setq case-fold-search t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1315 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1316 (while (re-search-forward reg-subject nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1317 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1318 (setq beg (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1319 (if (or (not only-unread) (looking-at " \\|-"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1320 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1321 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1322 (setq list-of-subjects (cons
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1323 (buffer-substring beg (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1324 list-of-subjects)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1325 (end-of-line))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1326
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1327 ; Expand all numbers in all the subjects: (hi9 -> hi0009, etc).
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1328
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1329 (setq list-of-subjects (gnus-uu-expand-numbers list-of-subjects))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1330
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1331 ; Sort the subjects.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1332
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1333 (setq list-of-subjects (sort list-of-subjects 'gnus-uu-string<))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1334
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1335 ; Get the article numbers from the sorted list of subjects.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1336
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1337 (while list-of-subjects
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1338 (setq art-num (gnus-uu-article-number (car list-of-subjects)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1339 (if mark-articles (gnus-summary-mark-as-read art-num ?#))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1340 (setq list-of-numbers (cons art-num list-of-numbers))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1341 (setq list-of-subjects (cdr list-of-subjects)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1342
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1343 (setq list-of-numbers (nreverse list-of-numbers))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1344
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1345 (if (not list-of-numbers)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1346 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1347 (message (concat "No subjects matched " subject))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1348 (sit-for 2)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1349
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1350 list-of-numbers)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1351
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1352
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1353 (defun gnus-uu-expand-numbers (string-list)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1354 "Takes a list of strings and \"expands\" all numbers in all the strings.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1355 That is, this function makes all numbers equal length by prepending lots
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1356 of zeroes before each number. This is to ease later sorting to find out
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1357 what sequence the articles are supposed to be decoded in. Returns the list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1358 of expanded strings."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1359 (let (string out-list pos num)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1360 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1361 (set-buffer (get-buffer-create gnus-uu-output-buffer-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1362 (while string-list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1363 (erase-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1364 (setq string (car string-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1365 (setq string-list (cdr string-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1366 (insert string)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1367 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1368 (while (re-search-forward "[ \t]+" nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1369 (replace-match " "))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1370 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1371 (while (re-search-forward "[A-Za-z]" nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1372 (replace-match "a" t t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1373
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1374 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1375 (if (not (search-forward "] " nil t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1376 ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1377 (while (re-search-forward "[0-9]+" nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1378 (replace-match
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1379 (format "%06d"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1380 (string-to-int (buffer-substring
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1381 (match-beginning 0) (match-end 0))))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1382 (setq string (buffer-substring 1 (point-max)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1383 (setq out-list (cons string out-list)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1384 out-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1385
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1386
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1387 (defun gnus-uu-string< (string1 string2)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1388 "Used in a sort for finding out what string is bigger, but ignoring
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1389 everything before the subject part."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1390 (string< (substring string1 (string-match "\\] " string1))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1391 (substring string2 (string-match "\\] " string2))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1392
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1393
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1394 ;; gnus-uu-grab-article
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1395 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1396 ;; This is the general multi-article treatment function.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1397 ;; It takes a list of articles to be grabbed and a function
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1398 ;; to apply to each article. It puts the result in
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1399 ;; gnus-uu-result-buffer.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1400 ;;
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1401 ;; The function to be called should take two parameters.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1402 ;; The first is the buffer that has the article that should
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1403 ;; be treated. The function should leave the result in this
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1404 ;; buffer as well. This result is then appended on to the
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1405 ;; gnus-uu-result-buffer.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1406 ;; The second parameter is the state of the list of articles,
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1407 ;; and can have three values: 'start, 'middle and 'end.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1408 ;; The function can have several return values.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1409 ;; 'error if there was an error while treating.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1410 ;; 'end if the last article has been sighted.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1411 ;; 'begin-and-end if the article is both the beginning and
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1412 ;; the end. All these three return values results in
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1413 ;; gnus-uu-grab-articles stopping traversing of the list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1414 ;; of articles.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1415 ;; 'middle if the article is a "middle" article.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1416 ;; 'ok if everything is ok.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1417
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1418 (defvar gnus-uu-has-been-grabbed nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1419
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1420 (defun gnus-uu-unmark-list-of-grabbed (&optional dont-unmark-last-article)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1421 (let (art)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1422 (if (or (not gnus-uu-has-been-grabbed)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1423 (not gnus-uu-unmark-articles-not-decoded))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1424 ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1425 (if dont-unmark-last-article
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1426 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1427 (setq art (car gnus-uu-has-been-grabbed))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1428 (setq gnus-uu-has-been-grabbed (cdr gnus-uu-has-been-grabbed))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1429 (while gnus-uu-has-been-grabbed
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1430 (gnus-summary-mark-as-unread (car gnus-uu-has-been-grabbed) t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1431 (setq gnus-uu-has-been-grabbed (cdr gnus-uu-has-been-grabbed)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1432 (if dont-unmark-last-article
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1433 (setq gnus-uu-has-been-grabbed (list art)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1434 )))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1435
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1436
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1437 (defun gnus-uu-grab-articles (list-of-articles process-function)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1438 "This function takes a list of articles and a function to apply
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1439 to each article grabbed. The result of the function is appended
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1440 on to gnus-uu-result-buffer.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1441
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1442 This function returns `t' if the grabbing and the process-function
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1443 has been successful and `nil' otherwise."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1444 (let ((result-buffer (get-buffer-create gnus-uu-result-buffer))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1445 (state 'first)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1446 (process-state 'ok)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1447 (result t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1448 (wrong-type t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1449 (has-been-begin nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1450 (article nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1451
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1452 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1453 (set-buffer result-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1454 (erase-buffer))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1455 (setq gnus-uu-has-been-grabbed nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1456 (while (and list-of-articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1457 (not (eq process-state 'end))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1458 (not (eq process-state 'begin-and-end))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1459 (not (eq process-state 'error)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1460 (setq article (car list-of-articles))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1461 (setq list-of-articles (cdr list-of-articles))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1462 (setq gnus-uu-has-been-grabbed (cons article gnus-uu-has-been-grabbed))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1463
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1464 (if (eq list-of-articles ()) (setq state 'last))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1465
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1466 (message (format "Getting article %d" article))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1467 (if (not (= (or gnus-current-article 0) article))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1468 (gnus-summary-display-article article))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1469 (gnus-summary-mark-as-read article)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1470
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1471 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1472 (set-buffer gnus-article-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1473 (widen))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1474
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1475 (setq process-state (funcall process-function gnus-article-buffer state))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1476
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1477 (if (or (eq process-state 'begin) (eq process-state 'begin-and-end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1478 (eq process-state 'ok))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1479 (setq has-been-begin t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1480
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1481 (if (not (eq process-state 'wrong-type))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1482 (setq wrong-type nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1483 (if gnus-uu-unmark-articles-not-decoded
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1484 (gnus-summary-mark-as-unread article t)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1485
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1486 (if gnus-uu-do-sloppy-uudecode
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1487 (setq wrong-type nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1488
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1489 (if (and (not has-been-begin)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1490 (not gnus-uu-do-sloppy-uudecode)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1491 (or (eq process-state 'end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1492 (eq process-state 'middle)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1493 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1494 (setq process-state 'error)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1495 (message "No begin part at the beginning")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1496 (sit-for 2))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1497 (setq state 'middle)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1498
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1499 (if (and (not has-been-begin) (not gnus-uu-do-sloppy-uudecode))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1500 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1501 (setq result nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1502 (message "Wrong type file")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1503 (sit-for 2))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1504 (if (eq process-state 'error)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1505 (setq result nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1506 (if (not (or (eq process-state 'ok)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1507 (eq process-state 'end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1508 (eq process-state 'begin-and-end)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1509 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1510 (if (not gnus-uu-do-sloppy-uudecode)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1511 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1512 (message "End of articles reached before end of file")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1513 (sit-for 2)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1514 (gnus-uu-unmark-list-of-grabbed)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1515 (setq result nil)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1516 (setq gnus-uu-rest-of-articles list-of-articles)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1517 result))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1518
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1519
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1520 (defun gnus-uu-uudecode-sentinel (process event)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1521 ; (message "Process '%s' has received event '%s'" process event)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1522 ; (sit-for 2)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1523 (delete-process (get-process process)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1524
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1525
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1526 (defun gnus-uu-uustrip-article-as (process-buffer in-state)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1527 (let ((state 'ok)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1528 (process-connection-type nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1529 start-char pst name-beg name-end buf-state)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1530 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1531 (set-buffer process-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1532 (setq buf-state buffer-read-only)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1533 (setq buffer-read-only nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1534
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1535 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1536
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1537 (if gnus-uu-kill-carriage-return
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1538 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1539 (while (search-forward " " nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1540 (delete-backward-char 1))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1541 (goto-char 1)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1542
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1543 (if (not (re-search-forward
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1544 (concat gnus-uu-begin-string "\\|" gnus-uu-body-line) nil t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1545 (setq state 'wrong-type)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1546
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1547 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1548 (setq start-char (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1549
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1550 (if (looking-at gnus-uu-begin-string)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1551 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1552 (setq name-end (match-end 1))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1553 (goto-char (setq name-beg (match-beginning 1)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1554 (while (re-search-forward "/" name-end t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1555 (replace-match "-"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1556 (setq gnus-uu-file-name (buffer-substring name-beg name-end))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1557 (setq pst (process-status
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1558 (or gnus-uu-uudecode-process "nevair")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1559 (if (or (eq pst 'stop) (eq pst 'run))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1560 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1561 (delete-process gnus-uu-uudecode-process)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1562 (gnus-uu-unmark-list-of-grabbed t)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1563 (setq gnus-uu-uudecode-process
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1564 (start-process
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1565 "*uudecode*"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1566 (get-buffer-create gnus-uu-output-buffer-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1567 "sh" "-c"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1568 (format "cd %s ; uudecode" gnus-uu-tmp-dir)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1569 (set-process-sentinel
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1570 gnus-uu-uudecode-process 'gnus-uu-uudecode-sentinel)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1571 (setq state 'begin)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1572 (gnus-uu-add-file (concat gnus-uu-tmp-dir gnus-uu-file-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1573 (setq state 'middle))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1574
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1575 (goto-char (point-max))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1576 (re-search-backward
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1577 (concat gnus-uu-body-line "\\|" gnus-uu-end-string) nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1578 (if (looking-at gnus-uu-end-string)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1579 (if (eq state 'begin)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1580 (setq state 'begin-and-end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1581 (setq state 'end)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1582 (forward-line 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1583
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1584 (setq pst (process-status (or gnus-uu-uudecode-process "nevair")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1585 (if (or (eq pst 'run) (eq pst 'stop))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1586 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1587 (gnus-uu-check-correct-stripped-uucode start-char (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1588 (condition-case err
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1589 (process-send-region gnus-uu-uudecode-process start-char
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1590 (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1591 (error
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1592 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1593 (setq state 'wrong-type)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1594 (delete-process gnus-uu-uudecode-process)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1595 (setq state 'wrong-type)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1596 (setq buffer-read-only buf-state))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1597 state))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1598
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1599
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1600 (defun gnus-uu-unshar-article (process-buffer in-state)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1601 "This function is used by gnus-uu-grab-articles to treat
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1602 a shared article."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1603 (let ((state 'ok)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1604 start-char)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1605 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1606 (set-buffer process-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1607 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1608 (if (not (re-search-forward gnus-uu-shar-begin-string nil t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1609 (setq state 'wrong-type)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1610 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1611 (setq start-char (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1612 (call-process-region
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1613 start-char (point-max) "sh" nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1614 (get-buffer-create gnus-uu-output-buffer-name) nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1615 "-c" (concat "cd " gnus-uu-shar-directory " ; sh"))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1616 state))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1617
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1618
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1619 (defun gnus-uu-find-name-in-shar ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1620 "Returns the name of what the shar file is going to unpack."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1621 (let ((oldpoint (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1622 res)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1623 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1624 (if (re-search-forward gnus-uu-shar-name-marker nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1625 (setq res (buffer-substring (match-beginning 1) (match-end 1))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1626 (goto-char oldpoint)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1627 res))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1628
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1629
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1630 (defun gnus-uu-article-number (subject)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1631 "Returns the article number of the given subject."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1632 (let (end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1633 (string-match "[0-9]+[^0-9]" subject 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1634 (setq end (match-end 0))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1635 (string-to-int
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1636 (substring subject (string-match "[0-9]" subject 1) end))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1637
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1638
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1639 (defun gnus-uu-decode (directory)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1640 "UUdecodes everything in the buffer and returns the name of the resulting
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1641 file."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1642 (let ((command (concat "cd " directory " ; uudecode"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1643 file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1644 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1645 (message "Uudecoding...")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1646 (set-buffer (get-buffer-create gnus-uu-result-buffer))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1647 (setq file-name (concat gnus-uu-tmp-dir gnus-uu-file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1648 (gnus-uu-add-file file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1649 (call-process-region 1 (point-max) "sh" nil t nil "-c" command)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1650 file-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1651
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1652
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1653 (defun gnus-uu-choose-action (file-name file-action-list)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1654 "Chooses what action to perform given the name and gnus-uu-file-action-list.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1655 Returns either nil if no action is found, or the name of the command
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1656 to run if such a rule is found."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1657 (let ((action-list (copy-sequence file-action-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1658 rule action)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1659 (while (not (or (eq action-list ()) action))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1660 (setq rule (car action-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1661 (setq action-list (cdr action-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1662 (if (string-match (car rule) file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1663 (setq action (car (cdr rule)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1664 action))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1665
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1666
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1667 (defun gnus-uu-save-file (from-file-name &optional default-dir ignore-existing)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1668 "Moves the file from the tmp directory to where the user wants it."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1669 (let (dir file-name command)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1670 (string-match "/[^/]*$" from-file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1671 (setq file-name (substring from-file-name (1+ (match-beginning 0))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1672 (if default-dir
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1673 (setq dir default-dir)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1674 (setq dir (gnus-uu-read-directory "Where do you want the file? ")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1675 (if (and (not ignore-existing) (file-exists-p (concat dir file-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1676 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1677 (message (concat "There already is a file called " file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1678 (sit-for 2)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1679 (setq file-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1680 (read-file-name "Give a new name: " dir (concat dir file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1681 nil file-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1682 (setq file-name (concat dir file-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1683 (rename-file from-file-name file-name t)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1684
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1685
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1686 (defun gnus-uu-read-directory (prompt &optional default)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1687 (let (dir ok create)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1688 (while (not ok)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1689 (setq ok t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1690 (setq dir (if default default
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1691 (read-file-name prompt gnus-uu-current-save-dir
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1692 gnus-uu-current-save-dir)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1693 (while (string-match "/$" dir)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1694 (setq dir (substring dir 0 (match-beginning 0))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1695 (if (file-exists-p dir)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1696 (if (not (file-directory-p dir))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1697 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1698 (setq ok nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1699 (message "%s is a file" dir)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1700 (sit-for 2)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1701 (setq create ?o)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1702 (while (not (or (= create ?y) (= create ?n)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1703 (message "%s: No such directory. Do you want to create it? (y/n)"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1704 dir)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1705 (setq create (read-char)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1706 (if (= create ?y) (make-directory dir))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1707 (setq gnus-uu-current-save-dir (concat dir "/"))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1708
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1709
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1710 (defun gnus-uu-treat-archive (file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1711 "Unpacks an archive and views all the files in it. Returns `t' if
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1712 viewing one or more files is successful."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1713 (let ((arc-dir (make-temp-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1714 (concat gnus-uu-tmp-dir "gnusuu")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1715 action command files file did-view short-file-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1716 error-during-unarching)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1717 (setq action (gnus-uu-choose-action
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1718 file-name (append gnus-uu-user-archive-rules
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1719 (if gnus-uu-ignore-default-archive-rules
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1720 nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1721 gnus-uu-default-archive-rules))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1722 (if (not action)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1723 (progn (message (format "No unpackers for the file %s" file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1724 (sit-for 2))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1725 (string-match "/[^/]*$" file-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1726 (setq short-file-name (substring file-name (1+ (match-beginning 0))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1727 (setq command (format "%s %s %s ; cd %s ; %s %s "
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1728 (if (or (string= action "uncompress")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1729 (string= action "gunzip"))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1730 "cp"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1731 "mv")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1732 file-name arc-dir
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1733 arc-dir
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1734 action short-file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1735
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1736 (make-directory arc-dir)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1737 (gnus-uu-add-file arc-dir)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1738
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1739 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1740 (set-buffer (get-buffer-create gnus-uu-output-buffer-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1741 (erase-buffer))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1742
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1743 (message (format "Unpacking with %s..." action))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1744
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1745 (if (= 0 (call-process "sh" nil
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1746 (get-buffer-create gnus-uu-output-buffer-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1747 nil "-c" command))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1748 (message "")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1749 (message "Error during unpacking of archive")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1750 (sit-for 2)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1751 (sit-for 2)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1752 (setq error-during-unarching t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1753
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1754 (if (not (or (string= action "uncompress")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1755 (string= action "gunzip")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1756 (call-process "sh" nil (get-buffer gnus-uu-output-buffer-name)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1757 nil "-c" (format "mv %s/%s %s"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1758 arc-dir short-file-name
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1759 gnus-uu-tmp-dir)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1760 (gnus-uu-add-file (concat gnus-uu-tmp-dir short-file-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1761
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1762 (setq did-view
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1763 (or (gnus-uu-show-directory arc-dir gnus-uu-use-interactive-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1764 did-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1765
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1766 (if (and (not gnus-uu-use-interactive-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1767 (file-directory-p arc-dir))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1768 (delete-directory arc-dir)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1769
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1770 did-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1771
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1772
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1773 (defun gnus-uu-show-directory (dir &optional dont-delete-files)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1774 "Tries to view all the files in the given directory. Returns `t' if
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1775 viewing one or more files is successful."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1776 (let (files file did-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1777 (setq files (directory-files dir t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1778 (setq gnus-uu-generated-file-list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1779 (append files gnus-uu-generated-file-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1780 (while files
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1781 (setq file (car files))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1782 (setq files (cdr files))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1783 (if (and (not (string-match "/\\.$" file))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1784 (not (string-match "/\\.\\.$" file)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1785 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1786 (set-file-modes file 448)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1787 (if (file-directory-p file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1788 (setq did-view (or (gnus-uu-show-directory file
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1789 dont-delete-files)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1790 did-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1791 (setq did-view (or (gnus-uu-view-file file t) did-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1792 (if (and (not dont-delete-files) (file-exists-p file))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1793 (delete-file file))))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1794 (if (not dont-delete-files) (delete-directory dir))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1795 did-view))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1796
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1797
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1798 ;; Manual marking
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1799
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1800 (defun gnus-uu-enter-mark-in-list ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1801 (let (article beg)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1802 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1803 (setq beg (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1804 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1805 (setq article (gnus-uu-article-number
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1806 (buffer-substring beg (point))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1807 (message (format "Adding article %d to list" article))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1808 (setq gnus-uu-marked-article-list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1809 (cons article gnus-uu-marked-article-list))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1810
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1811 (defun gnus-uu-mark-article ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1812 "Marks the current article to be decoded later."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1813 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1814 (gnus-uu-enter-mark-in-list)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1815 (gnus-summary-mark-as-read nil ?#)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1816 (gnus-summary-next-subject 1 nil))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1817
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1818 (defun gnus-uu-unmark-article ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1819 "Unmarks the current article."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1820 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1821 (let ((in (copy-sequence gnus-uu-marked-article-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1822 out article beg found
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1823 (old-point (point)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1824 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1825 (setq beg (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1826 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1827 (setq article (gnus-uu-article-number (buffer-substring beg (point))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1828 (message (format "Removing article %d" article))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1829 (while in
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1830 (if (not (= (car in) article))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1831 (setq out (cons (car in) out))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1832 (setq found t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1833 (message (format "Removing article %d" article)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1834 (setq in (cdr in)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1835 (if (not found) (message "Not a marked article."))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1836 (setq gnus-uu-marked-article-list (reverse out))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1837 (gnus-summary-mark-as-unread nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1838 (gnus-summary-next-subject 1 nil)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1839
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1840
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1841 (defun gnus-uu-unmark-all-articles ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1842 "Removes the mark from all articles marked for decoding."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1843 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1844 (let ((articles (copy-sequence gnus-uu-marked-article-list)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1845 (while articles
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1846 (gnus-summary-goto-subject (car articles))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1847 (gnus-summary-mark-as-unread nil t)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1848 (setq articles (cdr articles)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1849 (setq gnus-uu-marked-article-list ())))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1850
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1851 (defun gnus-uu-mark-by-regexp ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1852 "Asks for a regular expression and marks all articles that match for later decoding."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1853 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1854 (let (exp)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1855 (setq exp (read-from-minibuffer "Enter regular expression: "))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1856 (setq gnus-uu-marked-article-list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1857 (reverse (gnus-uu-get-list-of-articles exp t)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1858 (message "")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1859
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1860
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1861 ;; Various
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1862
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1863 (defun gnus-uu-check-correct-stripped-uucode (start end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1864 (let (found beg length short)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1865 (if (not gnus-uu-correct-stripped-uucode)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1866 ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1867 (goto-char start)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1868 (while (< (point) end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1869 (if (looking-at (concat gnus-uu-begin-string "\\|" gnus-uu-end-string))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1870 ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1871 (if (not found)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1872 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1873 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1874 (setq beg (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1875 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1876 (setq length (- (point) beg))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1877 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1878 (setq beg (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1879 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1880 (if (not (= length (- (point) beg)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1881 (insert (make-string (- length (- (point) beg))) ? )))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1882 (forward-line 1)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1883
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1884 (defun gnus-uu-initialize ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1885 (if (not gnus-uu-use-interactive-view)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1886 ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1887 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1888 (setq gnus-uu-interactive-file-list nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1889 (set-buffer (get-buffer-create gnus-uu-interactive-buffer-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1890 (erase-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1891 (gnus-uu-mode)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1892 (insert
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1893 "# Press return to execute a command.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1894 # Press `C-c C-c' to exit interactive view.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1895
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1896 "))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1897
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1898
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1899 (defun gnus-uu-clean-up ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1900 "Kills the temporary uu buffers."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1901 (let (buf pst)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1902 (setq gnus-uu-do-sloppy-uudecode nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1903 (setq pst (process-status (or gnus-uu-uudecode-process "nevair")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1904 (if (or (eq pst 'stop) (eq pst 'run))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1905 (delete-process gnus-uu-uudecode-process))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1906 (and (not gnus-uu-asynchronous)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1907 (setq buf (get-buffer gnus-uu-output-buffer-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1908 (kill-buffer buf))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1909 (and (setq buf (get-buffer gnus-uu-result-buffer))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1910 (kill-buffer buf))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1911
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1912
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1913 (defun gnus-uu-check-for-generated-files ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1914 "Deletes any generated files that hasn't been deleted, if, for
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1915 instance, the user terminated decoding with `C-g'."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1916 (let (file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1917 (while gnus-uu-generated-file-list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1918 (setq file (car gnus-uu-generated-file-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1919 (setq gnus-uu-generated-file-list (cdr gnus-uu-generated-file-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1920 (if (not (string-match "/\\.[\\.]?$" file))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1921 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1922 (if (file-directory-p file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1923 (delete-directory file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1924 (if (file-exists-p file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1925 (delete-file file))))))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1926
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1927
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1928 (defun gnus-uu-add-file (file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1929 (setq gnus-uu-generated-file-list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1930 (cons file gnus-uu-generated-file-list)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1931
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1932 (defun gnus-uu-summary-next-subject ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1933 (if (not (gnus-summary-search-forward t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1934 (progn
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1935 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1936 (sit-for 0)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1937 (goto-char (point-max))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1938 (forward-line -1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1939 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1940 (search-forward ":" nil t)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1941 (sit-for 0)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1942 (gnus-summary-recenter))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1943
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1944
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1945 ;; Initializing
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1946
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1947 (add-hook 'gnus-exit-group-hook
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1948 '(lambda ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1949 (gnus-uu-clean-up)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1950 (setq gnus-uu-marked-article-list nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1951 (gnus-uu-check-for-generated-files)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1952
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1953
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1954 ;; Interactive exec mode
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1955
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1956 (defvar gnus-uu-output-window nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1957 (defvar gnus-uu-mode-hook nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1958 (defvar gnus-uu-mode-map nil)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1959
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1960 (defun gnus-uu-do-interactive ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1961 (let (int-buffer out-buf)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1962 (set-buffer
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1963 (setq int-buffer (get-buffer gnus-uu-interactive-buffer-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1964 (switch-to-buffer-other-window int-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1965 (pop-to-buffer int-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1966 (setq gnus-uu-output-window
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1967 (split-window nil (- (window-height) gnus-uu-output-window-height)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1968 (set-window-buffer gnus-uu-output-window
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1969 (setq out-buf
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1970 (get-buffer-create gnus-uu-output-buffer-name)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1971 (save-excursion (set-buffer out-buf) (erase-buffer))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1972 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1973 (forward-line 3)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1974 (run-hooks 'gnus-uu-mode-hook)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1975
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1976
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1977 (defun gnus-uu-enter-interactive-file (action file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1978 (let (command)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1979 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1980 (setq gnus-uu-interactive-file-list
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1981 (cons file gnus-uu-interactive-file-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1982 (set-buffer (get-buffer gnus-uu-interactive-buffer-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1983 (if (string-match "%s" action)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1984 (setq command (format action (concat "'" file "'")))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1985 (setq command (concat action " " (concat "'" file "'"))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1986
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1987 (insert (format "%s\n" command)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1988
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1989
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1990 (defun gnus-uu-interactive-execute ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1991 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1992 (let (beg out-buf command)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1993 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1994 (setq beg (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1995 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1996 (setq command (buffer-substring beg (point)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1997 (setq out-buf (get-buffer-create gnus-uu-output-buffer-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1998 (save-excursion
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1999 (set-buffer out-buf)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2000 (erase-buffer)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2001 (insert (format "$ %s \n\n" command)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2002 (message "Executing...")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2003 (if gnus-uu-asynchronous
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2004 (start-process "gnus-uu-view" out-buf "sh" "-c" command)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2005 (call-process "sh" nil out-buf nil "-c" command)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2006 (message ""))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2007 (forward-line 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2008 (beginning-of-line)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2009
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2010
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2011 (defun gnus-uu-interactive-end ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2012 "This function ends interactive view mode and returns to summary mode."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2013 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2014 (let (buf)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2015 (delete-window gnus-uu-output-window)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2016 (gnus-uu-clean-up)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2017 (if (not gnus-uu-asynchronous) (gnus-uu-check-for-generated-files))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2018 (setq buf (get-buffer gnus-uu-interactive-buffer-name))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2019 (if gnus-article-buffer (switch-to-buffer gnus-article-buffer))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2020 (if buf (kill-buffer buf))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2021 (pop-to-buffer gnus-summary-buffer)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2022
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2023
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2024 (if gnus-uu-mode-map
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2025 ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2026 (setq gnus-uu-mode-map (make-sparse-keymap))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2027 (define-key gnus-uu-mode-map "\C-c\C-x" 'gnus-uu-interactive-execute)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2028 (define-key gnus-uu-mode-map "\C-c\C-v" 'gnus-uu-interactive-execute)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2029 (define-key gnus-uu-mode-map "\C-m" 'gnus-uu-interactive-execute)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2030 (define-key gnus-uu-mode-map "\C-c\C-c" 'gnus-uu-interactive-end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2031 (define-key gnus-uu-mode-map "\C-cs"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2032 'gnus-uu-interactive-save-current-file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2033 (define-key gnus-uu-mode-map "\C-c\C-s"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2034 'gnus-uu-interactive-save-current-file-silent)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2035 (define-key gnus-uu-mode-map "\C-c\C-w" 'gnus-uu-interactive-save-all-files)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2036 (define-key gnus-uu-mode-map "\C-c\C-o" 'gnus-uu-interactive-save-original-file))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2037
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2038
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2039 (defun gnus-uu-interactive-save-original-file ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2040 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2041 (let (file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2042 (if (file-exists-p
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2043 (setq file (concat gnus-uu-tmp-dir
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2044 (or gnus-uu-file-name gnus-uu-shar-file-name))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2045 (gnus-uu-save-file file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2046 (message "Already saved."))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2047
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2048
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2049 (defun gnus-uu-interactive-save-current-file-silent ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2050 "hei"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2051 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2052 (gnus-uu-interactive-save-current-file t))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2053
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2054 (defun gnus-uu-interactive-save-current-file (&optional dont-ask silent)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2055 "Saves the file referred to on the current line."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2056 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2057 (let (files beg line file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2058 (setq files (copy-sequence gnus-uu-interactive-file-list))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2059 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2060 (setq beg (point))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2061 (end-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2062 (setq line (buffer-substring beg (point)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2063 (while (and files
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2064 (not (string-match
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2065 (concat "" (regexp-quote (setq file (car files))) "")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2066 line)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2067 (setq files (cdr files)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2068 (beginning-of-line)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2069 (forward-line 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2070 (if (not files)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2071 (if (not silent)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2072 (progn (message "Could not find file") (sit-for 2)))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2073 (gnus-uu-save-file file (if dont-ask gnus-uu-current-save-dir nil) silent)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2074 (delete-region beg (point)))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2075
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2076
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2077 (defun gnus-uu-interactive-save-all-files ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2078 "Saves all files referred to on the current line."
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2079 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2080 (let (dir)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2081 (goto-char 1)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2082 (setq dir (gnus-uu-read-directory "Where do you want the files? "))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2083 (while (not (eobp))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2084 (gnus-uu-interactive-save-current-file t t))))
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2085
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2086 (defun gnus-uu-mode ()
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2087 "Major mode for editing view commands in gnus-uu.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2088
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2089
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2090 Commands:
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2091 Return, C-c C-v, C-c C-x Execute the current command
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2092 C-c C-c End interactive mode
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2093 C-c s Save the current file
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2094 C-c C-s Save the current file without asking
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2095 where to put it
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2096 C-c C-a Save all files
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2097 C-c C-o Save the original file: If the files
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2098 originated in an archive, the archive
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2099 file is saved.
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2100 "
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2101 (interactive)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2102 (kill-all-local-variables)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2103 (use-local-map gnus-uu-mode-map)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2104 (setq mode-name "gnus-uu")
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2105 (setq major-mode 'gnus-uu-mode)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2106 )
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2107
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2108 (define-key gnus-uu-mode-map "\C-c\C-x" 'gnus-uu-interactive-execute)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2109 (define-key gnus-uu-mode-map "\C-c\C-v" 'gnus-uu-interactive-execute)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2110 (define-key gnus-uu-mode-map "\C-m" 'gnus-uu-interactive-execute)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2111 (define-key gnus-uu-mode-map "\C-c\C-c" 'gnus-uu-interactive-end)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2112 (define-key gnus-uu-mode-map "\C-cs"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2113 'gnus-uu-interactive-save-current-file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2114 (define-key gnus-uu-mode-map "\C-c\C-s"
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2115 'gnus-uu-interactive-save-current-file-silent)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2116 (define-key gnus-uu-mode-map "\C-c\C-a" 'gnus-uu-interactive-save-all-files)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2117 (define-key gnus-uu-mode-map "\C-c\C-o" 'gnus-uu-interactive-save-original-file)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2118
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2119 (provide 'gnus-uu)
cee7995fefe5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2120