Advise byte-optimize-form-code-walker to optimize the rest of the and/or forms.
[gnus] / lisp / mm-uu.el
1 ;;; mm-uu.el --- Return uu stuff as mm handles
2 ;; Copyright (c) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3
4 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
5 ;; Keywords: postscript uudecode binhex shar forward gnatsweb pgp
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13 ;;
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 ;;; Commentary:
25
26 ;;; Code:
27
28 (eval-when-compile (require 'cl))
29 (require 'mail-parse)
30 (require 'nnheader)
31 (require 'mm-decode)
32 (require 'mailcap)
33 (require 'mml2015)
34
35 (autoload 'uudecode-decode-region "uudecode")
36 (autoload 'uudecode-decode-region-external "uudecode")
37 (autoload 'uudecode-decode-region-internal "uudecode")
38
39 (autoload 'binhex-decode-region "binhex")
40 (autoload 'binhex-decode-region-external "binhex")
41 (autoload 'binhex-decode-region-internal "binhex")
42
43 (autoload 'yenc-decode-region "yenc")
44 (autoload 'yenc-extract-filename "yenc")
45
46 (defcustom mm-uu-decode-function 'uudecode-decode-region
47   "*Function to uudecode.
48 Internal function is done in Lisp by default, therefore decoding may
49 appear to be horribly slow.  You can make Gnus use an external
50 decoder, such as uudecode."
51   :type '(choice
52           (function-item :tag "Auto detect" uudecode-decode-region)
53           (function-item :tag "Internal" uudecode-decode-region-internal)
54           (function-item :tag "External" uudecode-decode-region-external))
55   :group 'gnus-article-mime)
56
57 (defcustom mm-uu-binhex-decode-function 'binhex-decode-region
58   "*Function to binhex decode.
59 Internal function is done in elisp by default, therefore decoding may
60 appear to be horribly slow . You can make Gnus use the external Unix
61 decoder, such as hexbin."
62   :type '(choice (function-item :tag "Auto detect" binhex-decode-region)
63                  (function-item :tag "Internal" binhex-decode-region-internal)
64                  (function-item :tag "External" binhex-decode-region-external))
65   :group 'gnus-article-mime)
66
67 (defvar mm-uu-yenc-decode-function 'yenc-decode-region)
68
69 (defvar mm-uu-pgp-beginning-signature
70      "^-----BEGIN PGP SIGNATURE-----")
71
72 (defvar mm-uu-beginning-regexp nil)
73
74 (defvar mm-dissect-disposition "inline"
75   "The default disposition of uu parts.
76 This can be either \"inline\" or \"attachment\".")
77
78 (defvar mm-uu-emacs-sources-regexp "gnu\\.emacs\\.sources"
79   "The regexp of Emacs sources groups.")
80
81 (defcustom mm-uu-diff-groups-regexp "gnus\\.commits"
82   "*Regexp matching diff groups."
83   :type 'regexp
84   :group 'gnus-article-mime)
85
86 (defvar mm-uu-type-alist
87   '((postscript
88      "^%!PS-"
89      "^%%EOF$"
90      mm-uu-postscript-extract
91      nil)
92     (uu
93      "^begin[ \t]+0?[0-7][0-7][0-7][ \t]+"
94      "^end[ \t]*$"
95      mm-uu-uu-extract
96      mm-uu-uu-filename)
97     (binhex
98      "^:...............................................................$"
99      ":$"
100      mm-uu-binhex-extract
101      nil
102      mm-uu-binhex-filename)
103     (yenc
104      "^=ybegin.*size=[0-9]+.*name=.*$"
105      "^=yend.*size=[0-9]+"
106      mm-uu-yenc-extract
107      mm-uu-yenc-filename)
108     (shar
109      "^#! */bin/sh"
110      "^exit 0$"
111      mm-uu-shar-extract)
112     (forward
113 ;;; Thanks to Edward J. Sabol <sabol@alderaan.gsfc.nasa.gov> and
114 ;;; Peter von der Ah\'e <pahe@daimi.au.dk>
115      "^-+ \\(Start of \\)?Forwarded message"
116      "^-+ End \\(of \\)?forwarded message"
117      mm-uu-forward-extract
118      nil
119      mm-uu-forward-test)
120     (gnatsweb
121      "^----gnatsweb-attachment----"
122      nil
123      mm-uu-gnatsweb-extract)
124     (pgp-signed
125      "^-----BEGIN PGP SIGNED MESSAGE-----"
126      "^-----END PGP SIGNATURE-----"
127      mm-uu-pgp-signed-extract
128      nil
129      nil)
130     (pgp-encrypted
131      "^-----BEGIN PGP MESSAGE-----"
132      "^-----END PGP MESSAGE-----"
133      mm-uu-pgp-encrypted-extract
134      nil
135      nil)
136     (pgp-key
137      "^-----BEGIN PGP PUBLIC KEY BLOCK-----"
138      "^-----END PGP PUBLIC KEY BLOCK-----"
139      mm-uu-pgp-key-extract
140      mm-uu-gpg-key-skip-to-last
141      nil)
142     (emacs-sources
143      "^;;;?[ \t]*[^ \t]+\\.el[ \t]*--"
144      "^;;;?[ \t]*\\([^ \t]+\\.el\\)[ \t]+ends here"
145      mm-uu-emacs-sources-extract
146      nil
147      mm-uu-emacs-sources-test)
148     (diff
149      "^Index: "
150      nil
151      mm-uu-diff-extract
152      nil
153      mm-uu-diff-test)))
154
155 (defcustom mm-uu-configure-list '((shar . disabled))
156   "A list of mm-uu configuration.
157 To disable dissecting shar codes, for instance, add
158 `(shar . disabled)' to this list."