1 ;;; mel-g.el: Gzip64 encoder/decoder for GNU Emacs
3 ;; Copyright (C) 1995,1996,1997 MORIOKA Tomohiko
4 ;; Copyright (C) 1996 Shuhei KOBAYASHI
6 ;; Author: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
7 ;; modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;; Maintainer: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
10 ;; Version: $Id: mel-g.el,v 6.1 1997/03/10 13:06:34 morioka Exp $
11 ;; Keywords: Gzip64, base64, gzip, MIME
13 ;; This file is not part of MEL (MIME Encoding Library) yet.
15 ;; This program is free software; you can redistribute it and/or
16 ;; modify it under the terms of the GNU General Public License as
17 ;; published by the Free Software Foundation; either version 2, or (at
18 ;; your option) any later version.
20 ;; This program is distributed in the hope that it will be useful, but
21 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 ;; General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 ;; Boston, MA 02111-1307, USA.
33 (require 'file-detect)
39 (defvar gzip64-external-encoder
40 (let ((file (exec-installed-p "mmencode")))
42 (` ("sh" "-c" (, (concat "gzip -c | " file))))
44 "*list of gzip64 encoder program name and its arguments.")
46 (defvar gzip64-external-decoder
47 (let ((file (exec-installed-p "mmencode")))
49 (` ("sh" "-c" (, (concat file " -u | gzip -dc"))))
51 "*list of gzip64 decoder program name and its arguments.")
54 ;;; @ encoder/decoder for region
57 (defun gzip64-external-encode-region (beg end)
60 (as-binary-process (apply (function call-process-region)
61 beg end (car gzip64-external-encoder)
62 t t nil (cdr gzip64-external-encoder))
65 ;; regularize line break code
66 (goto-char (point-min))
67 (while (re-search-forward "\r$" nil t)
72 (defun gzip64-external-decode-region (beg end)
75 (as-binary-process (apply (function call-process-region)
76 beg end (car gzip64-external-decoder)
77 t t nil (cdr gzip64-external-decoder))
81 (defalias 'gzip64-encode-region 'gzip64-external-encode-region)
82 (defalias 'gzip64-decode-region 'gzip64-external-decode-region)
85 ;;; @ encoder/decoder for file
88 (defun gzip64-insert-encoded-file (filename)
89 (interactive (list (read-file-name "Insert encoded file: ")))
90 (apply (function call-process) (car gzip64-external-encoder)
92 (cdr gzip64-external-encoder))
101 ;;; mel-g.el ends here.