diff lisp/mel/mel-u.el @ 110:fe104dbd9147 r20-1b7

Import from CVS: tag r20-1b7
author cvs
date Mon, 13 Aug 2007 09:19:45 +0200
parents c0c698873ce1
children 8eaf7971accc
line wrap: on
line diff
--- a/lisp/mel/mel-u.el	Mon Aug 13 09:18:41 2007 +0200
+++ b/lisp/mel/mel-u.el	Mon Aug 13 09:19:45 2007 +0200
@@ -1,58 +1,57 @@
-;;;
 ;;; mel-u.el: uuencode encoder/decoder for GNU Emacs
-;;;
-;;; Copyright (C) 1995 Free Software Foundation, Inc.
-;;; Copyright (C) 1995,1996 MORIOKA Tomohiko
-;;;
-;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;;; Created: 1995/10/25
-;;; Version:
-;;;	$Id: mel-u.el,v 1.2 1996/12/28 21:02:57 steve Exp $
-;;; Keywords: uuencode
-;;;
-;;; This file is part of MEL (MIME Encoding Library).
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License as
-;;; published by the Free Software Foundation; either version 2, or
-;;; (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with This program.  If not, write to the Free Software
-;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;
+
+;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Created: 1995/10/25
+;; Version: $Id: mel-u.el,v 1.3 1997/03/16 03:05:15 steve Exp $
+;; Keywords: uuencode
+
+;; This file is part of MEL (MIME Encoding Library).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
 ;;; Code:
 
 (require 'emu)
+(require 'mel)
 
 
 ;;; @ variables
 ;;;
 
-(defvar mime/tmp-dir (or (getenv "TM_TMP_DIR") "/tmp/"))
-
 (defvar uuencode-external-encoder '("uuencode" "-")
   "*list of uuencode encoder program name and its arguments.")
 
 (defvar uuencode-external-decoder
-  (list "sh" "-c" (format "(cd %s; uudecode)" mime/tmp-dir))
+  (list "sh" "-c" (format "(cd %s; uudecode)" mime-temp-directory))
   "*list of uuencode decoder program name and its arguments.")
 
 
 ;;; @ uuencode encoder/decoder for region
 ;;;
 
-(defun uuencode-external-encode-region (beg end)
+(defun uuencode-external-encode-region (start end)
+  "Encode current region by unofficial uuencode format.
+This function uses external uuencode encoder which is specified by
+variable `uuencode-external-encoder'."
   (interactive "*r")
   (save-excursion
     (as-binary-process (apply (function call-process-region)
-			      beg end (car uuencode-external-encoder)
+			      start end (car uuencode-external-encoder)
 			      t t nil (cdr uuencode-external-encoder))
 		       )
     ;; for OS/2
@@ -63,13 +62,16 @@
       )
     ))
 
-(defun uuencode-external-decode-region (beg end)
+(defun uuencode-external-decode-region (start end)
+  "Decode current region by unofficial uuencode format.
+This function uses external uuencode decoder which is specified by
+variable `uuencode-external-decoder'."
   (interactive "*r")
   (save-excursion
     (let ((filename (save-excursion
 		      (save-restriction
-			(narrow-to-region beg end)
-			(goto-char beg)
+			(narrow-to-region start end)
+			(goto-char start)
 			(if (re-search-forward "^begin [0-9]+ " nil t)
 			    (if (looking-at ".+$")
 				(buffer-substring (match-beginning 0)
@@ -78,17 +80,10 @@
       (if filename
 	  (as-binary-process
 	   (apply (function call-process-region)
-		  beg end (car uuencode-external-decoder)
+		  start end (car uuencode-external-decoder)
 		  t nil nil (cdr uuencode-external-decoder))
-	   (setq filename (expand-file-name filename mime/tmp-dir))
-	   (let ((file-coding-system-for-read *noconv*) ; for Mule
-		 kanji-fileio-code		        ; for NEmacs
-		 (emx-binary-mode t)                    ; for OS/2
-		 jka-compr-compression-info-list        ; for jka-compr
-		 jam-zcat-filename-list                 ; for jam-zcat
-		 require-final-newline)
-	     (insert-file-contents filename)
-	     )
+	   (setq filename (expand-file-name filename mime-temp-directory))
+	   (as-binary-input-file (insert-file-contents filename))
 	   (delete-file filename)
 	   ))
       )))
@@ -101,6 +96,9 @@
 ;;;
 
 (defun uuencode-insert-encoded-file (filename)
+  "Insert file encoded by unofficial uuencode format.
+This function uses external uuencode encoder which is specified by
+variable `uuencode-external-encoder'."
   (interactive (list (read-file-name "Insert encoded file: ")))
   (call-process (car uuencode-external-encoder) filename t nil
 		(file-name-nondirectory filename))