annotate lisp/mel/mel-g.el @ 203:850242ba4a81 r20-3b28

Import from CVS: tag r20-3b28
author cvs
date Mon, 13 Aug 2007 10:02:21 +0200
parents fe104dbd9147
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; mel-g.el: Gzip64 encoder/decoder for GNU Emacs
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3 ;; Copyright (C) 1995,1996,1997 MORIOKA Tomohiko
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
4 ;; Copyright (C) 1996 Shuhei KOBAYASHI
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
5
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
6 ;; Author: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
7 ;; modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
8 ;; Maintainer: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
9 ;; Created: 1995/10/25
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
10 ;; Version: $Id: mel-g.el,v 1.5 1997/03/16 03:05:14 steve Exp $
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
11 ;; Keywords: Gzip64, base64, gzip, MIME
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
12
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
13 ;; This file is not part of MEL (MIME Encoding Library) yet.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
14
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
15 ;; This program is free software; you can redistribute it and/or
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
16 ;; modify it under the terms of the GNU General Public License as
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
17 ;; published by the Free Software Foundation; either version 2, or (at
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
18 ;; your option) any later version.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
19
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
20 ;; This program is distributed in the hope that it will be useful, but
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
21 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
23 ;; General Public License for more details.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
24
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
25 ;; You should have received a copy of the GNU General Public License
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
28 ;; Boston, MA 02111-1307, USA.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
29
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 (require 'emu)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
33 (require 'file-detect)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 ;;; @ variables
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
39 (defvar gzip64-external-encoder
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
40 (let ((file (exec-installed-p "mmencode")))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
41 (and file
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
42 (` ("sh" "-c" (, (concat "gzip -c | " file))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
43 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 "*list of gzip64 encoder program name and its arguments.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
46 (defvar gzip64-external-decoder
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
47 (let ((file (exec-installed-p "mmencode")))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
48 (and file
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
49 (` ("sh" "-c" (, (concat file " -u | gzip -dc"))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
50 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 "*list of gzip64 decoder program name and its arguments.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 ;;; @ encoder/decoder for region
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 (defun gzip64-external-encode-region (beg end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 (interactive "*r")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 (as-binary-process (apply (function call-process-region)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 beg end (car gzip64-external-encoder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 t t nil (cdr gzip64-external-encoder))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 ;; for OS/2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 ;; regularize line break code
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 (while (re-search-forward "\r$" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 (replace-match "")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 (defun gzip64-external-decode-region (beg end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 (interactive "*r")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 (as-binary-process (apply (function call-process-region)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 beg end (car gzip64-external-decoder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 t t nil (cdr gzip64-external-decoder))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 (defalias 'gzip64-encode-region 'gzip64-external-encode-region)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 (defalias 'gzip64-decode-region 'gzip64-external-decode-region)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 ;;; @ encoder/decoder for file
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88 (defun gzip64-insert-encoded-file (filename)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89 (interactive (list (read-file-name "Insert encoded file: ")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 (apply (function call-process) (car gzip64-external-encoder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 filename t nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 (cdr gzip64-external-encoder))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 (provide 'mel-g)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 ;;; mel-g.el ends here.