annotate lisp/mel/mel-g.el @ 30:ec9a17fef872 r19-15b98

Import from CVS: tag r19-15b98
author cvs
date Mon, 13 Aug 2007 08:52:29 +0200
parents 441bb1e64a06
children e04119814345
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
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
2
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
3 ;; Copyright (C) 1995,1996,1997 MORIOKA Tomohiko
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
4 ;; Copyright (C) 1996 Shuhei KOBAYASHI
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
5
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
6 ;; Author: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
7 ;; modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
8 ;; Maintainer: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
9 ;; Created: 1995/10/25
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
10 ;; Version: $Id: mel-g.el,v 1.5 1997/03/09 02:37:18 steve Exp $
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
11 ;; Keywords: Gzip64, base64, gzip, MIME
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
12
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
13 ;; This file is not part of MEL (MIME Encoding Library) yet.
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
14
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
15 ;; This program is free software; you can redistribute it and/or
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
16 ;; modify it under the terms of the GNU General Public License as
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
17 ;; published by the Free Software Foundation; either version 2, or (at
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
18 ;; your option) any later version.
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
19
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
20 ;; This program is distributed in the hope that it will be useful, but
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
21 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
23 ;; General Public License for more details.
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
24
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
25 ;; You should have received a copy of the GNU General Public License
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
28 ;; Boston, MA 02111-1307, USA.
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
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)
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
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
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
39 (defvar gzip64-external-encoder
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
40 (let ((file (file-installed-p "mmencode" exec-path)))
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
41 (and file
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
42 (` ("sh" "-c" (, (concat "gzip -c | " file))))
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
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
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
46 (defvar gzip64-external-decoder
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
47 (let ((file (file-installed-p "mmencode" exec-path)))
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
48 (and file
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
49 (` ("sh" "-c" (, (concat file " -u | gzip -dc"))))
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
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.