From 73f2b03e6e43b659c077d550303f0b140a9bc900 Mon Sep 17 00:00:00 2001 From: morioka Date: Wed, 11 Mar 1998 15:38:51 +0000 Subject: [PATCH] (base64-external-decoder): New variable. (base64-external-decoder-option-to-specify-file): New variable. (base64-write-decoded-region): New function. --- mel-dl.el | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/mel-dl.el b/mel-dl.el index e42635b..67b498c 100644 --- a/mel-dl.el +++ b/mel-dl.el @@ -3,7 +3,7 @@ ;; Copyright (C) 1998 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko -;; Version: $Id: mel-dl.el,v 1.1 1998-01-11 16:21:43 morioka Exp $ +;; Version: $Id: mel-dl.el,v 1.2 1998-03-11 15:38:51 morioka Exp $ ;; Keywords: MIME, Base64 ;; This file is part of MEL (MIME Encoding Library). @@ -93,6 +93,12 @@ START and END are buffer positions." (defvar base64-external-encoder '("mmencode") "*list of base64 encoder program name and its arguments.") +(defvar base64-external-decoder '("mmencode" "-u") + "*list of base64 decoder program name and its arguments.") + +(defvar base64-external-decoder-option-to-specify-file '("-o") + "*list of option of base64 decoder program to specify file.") + (defun base64-insert-encoded-file (filename) "Encode contents of file FILENAME to base64, and insert the result. It calls external base64 encoder specified by @@ -103,6 +109,21 @@ mmencode included in metamail or XEmacs package)." filename t nil (cdr base64-external-encoder)) ) +(defun base64-write-decoded-region (start end filename) + "Decode and write current region encoded by base64 into FILENAME. +START and END are buffer positions." + (interactive + (list (region-beginning) (region-end) + (read-file-name "Write decoded region to file: "))) + (as-binary-process + (apply (function call-process-region) + start end (car base64-external-decoder) + nil nil nil + (append (cdr base64-external-decoder) + base64-external-decoder-option-to-specify-file + (list filename)) + ))) + ;;; @ etc ;;; -- 1.7.10.4