annotate lisp/=gnus-uu.el @ 6729:77494db73d5b

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