1 ;;; gnus-uu.el --- extract (uu)encoded files in Gnus
2 ;; Copyright (C) 1985,86,87,93,94,95,96 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
31 (eval-when-compile (require 'cl))
33 ;; Default viewing action rules
35 (defvar gnus-uu-default-view-rules
36 '(("\\.te?xt$\\|\\.doc$\\|read.*me\\|\\.c?$\\|\\.h$\\|\\.bat$\\|\\.asm$\\|makefile" "cat %s | sed s/\r//g")
37 ("\\.pas$" "cat %s | sed s/\r//g")
38 ("\\.[1-9]$" "groff -mandoc -Tascii %s | sed s/\b.//g")
39 ("\\.\\(jpe?g\\|gif\\|tiff?\\|p[pgb]m\\|xwd\\|xbm\\|pcx\\)$" "xv")
40 ("\\.tga$" "tgatoppm %s | xv -")
41 ("\\.\\(wav\\|aiff\\|hcom\\|u[blw]\\|s[bfw]\\|voc\\|smp\\)$"
42 "sox -v .5 %s -t .au -u - > /dev/audio")
43 ("\\.au$" "cat %s > /dev/audio")
44 ("\\.midi?$" "playmidi -f")
46 ("\\.ps$" "ghostview")
48 ("\\.html$" "xmosaic")
49 ("\\.mpe?g$" "mpeg_play")
50 ("\\.\\(flc\\|fli\\|rle\\|iff\\|pfx\\|avi\\|sme\\|rpza\\|dl\\|qt\\|rsrc\\|mov\\)$" "xanim")
51 ("\\.\\(tar\\|arj\\|zip\\|zoo\\|arc\\|gz\\|Z\\|lzh\\|ar\\|lha\\)$"
53 "*Default actions to be taken when the user asks to view a file.
54 To change the behaviour, you can either edit this variable or set
55 `gnus-uu-user-view-rules' to something useful.
59 To make gnus-uu use 'xli' to display JPEG and GIF files, put the
60 following in your .emacs file:
62 (setq gnus-uu-user-view-rules '((\"jpg$\\\\|gif$\" \"xli\")))
64 Both these variables are lists of lists with two string elements. The
65 first string is a regular expression. If the file name matches this
66 regular expression, the command in the second string is executed with
67 the file as an argument.
69 If the command string contains \"%s\", the file name will be inserted
70 at that point in the command string. If there's no \"%s\" in the
71 command string, the file name will be appended to the command string
74 There are several user variables to tailor the behaviour of gnus-uu to
75 your needs. First we have `gnus-uu-user-view-rules', which is the
76 variable gnus-uu first consults when trying to decide how to view a
77 file. If this variable contains no matches, gnus-uu examines the
78 default rule variable provided in this package. If gnus-uu finds no
79 match here, it uses `gnus-uu-user-view-rules-end' to try to make a
82 (defvar gnus-uu-user-view-rules nil
83 "*Variable detailing what actions are to be taken to view a file.
84 See the documentation on the `gnus-uu-default-view-rules' variable for
87 (defvar gnus-uu-user-view-rules-end
89 "*Variable saying what actions are to be taken if no rule matched the file name.
90 See the documentation on the `gnus-uu-default-view-rules' variable for
93 ;; Default unpacking commands
95 (defvar gnus-uu-default-archive-rules
96 '(("\\.tar$" "tar xf")
97 ("\\.zip$" "unzip -o")
101 ("\\.\\(lzh\\|lha\\)$" "lha x")
102 ("\\.Z$" "uncompress")
104 ("\\.arc$" "arc -x")))
106 (defvar gnus-uu-destructive-archivers
107 (list "uncompress" "gunzip"))
109 (defvar gnus-uu-user-archive-rules nil
110 "*A list that can be set to override the default archive unpacking commands.
111 To use, for instance, 'untar' to unpack tar files and 'zip -x' to
112 unpack zip files, say the following:
113 (setq gnus-uu-user-archive-rules
114 '((\"\\\\.tar$\" \"untar\")
115 (\"\\\\.zip$\" \"zip -x\")))")
117 (defvar gnus-uu-ignore-files-by-name nil
118 "*A regular expression saying what files should not be viewed based on name.
119 If, for instance, you want gnus-uu to ignore all .au and .wav files,
120 you could say something like
122 (setq gnus-uu-ignore-files-by-name \"\\\\.au$\\\\|\\\\.wav$\")
124 Note that this variable can be used in conjunction with the
125 `gnus-uu-ignore-files-by-type' variable.")
127 (defvar gnus-uu-ignore-files-by-type nil
128 "*A regular expression saying what files that shouldn't be viewed, based on MIME file type.
129 If, for instance, you want gnus-uu to ignore all audio files and all mpegs,
130 you could say something like
132 (setq gnus-uu-ignore-files-by-type \"audio/\\\\|video/mpeg\")
134 Note that this variable can be used in conjunction with the
135 `gnus-uu-ignore-files-by-name' variable.")
137 ;; Pseudo-MIME support
139 (defconst gnus-uu-ext-to-mime-list
140 '(("\\.gif$" "image/gif")
141 ("\\.jpe?g$" "image/jpeg")
142 ("\\.tiff?$" "image/tiff")
143 ("\\.xwd$" "image/xwd")
144 ("\\.pbm$" "image/pbm")
145 ("\\.pgm$" "image/pgm")
146 ("\\.ppm$" "image/ppm")
147 ("\\.xbm$" "image/xbm")
148 ("\\.pcx$" "image/pcx")
149 ("\\.tga$" "image/tga")
150 ("\\.ps$" "image/postscript")
151 ("\\.fli$" "video/fli")
152 ("\\.wav$" "audio/wav")
153 ("\\.aiff$" "audio/aiff")
154 ("\\.hcom$" "audio/hcom")
155 ("\\.voc$" "audio/voc")
156 ("\\.smp$" "audio/smp")
157 ("\\.mod$" "audio/mod")
158 ("\\.dvi$" "image/dvi")
159 ("\\.mpe?g$" "video/mpeg")
160 ("\\.au$" "audio/basic")
161 ("\\.\\(te?xt\\|doc\\|c\\|h\\)$" "text/plain")
162 ("\\.\\(c\\|h\\)$" "text/source")
163 ("read.*me" "text/plain")
164 ("\\.html$" "text/html")
165 ("\\.bat$" "text/bat")
166 ("\\.[1-6]$" "text/man")
167 ("\\.flc$" "video/flc")
168 ("\\.rle$" "video/rle")
169 ("\\.pfx$" "video/pfx")
170 ("\\.avi$" "video/avi")
171 ("\\.sme$" "video/sme")
172 ("\\.rpza$" "video/prza")
173 ("\\.dl$" "video/dl")
174 ("\\.qt$" "video/qt")
175 ("\\.rsrc$" "video/rsrc")
176 ("\\..*$" "unknown/unknown")))
178 ;; Various variables users may set
180 (defvar gnus-uu-tmp-dir "/tmp/"
181 "*Variable saying where gnus-uu is to do its work.
182 Default is \"/tmp/\".")