X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mel-b-el.el;h=eac60b57e851afa4981ad5404df565121d2485b1;hb=689d672292b79fa00f490d1da3e24da18335f6b3;hp=29372380c9544b9875b4e58c9a426f12040cbbf3;hpb=c63de88ff94b0e52a4bab5d11e3266184eede5ff;p=elisp%2Fflim.git diff --git a/mel-b-el.el b/mel-b-el.el index 2937238..eac60b5 100644 --- a/mel-b-el.el +++ b/mel-b-el.el @@ -1,6 +1,6 @@ ;;; mel-b-el.el --- Base64 encoder/decoder. -;; Copyright (C) 1992,1995,1996,1997,1998,1999 Free Software Foundation, Inc. +;; Copyright (C) 1992,95,96,97,98,99,2001 Free Software Foundation, Inc. ;; Author: ENAMI Tsugutomo ;; MORIOKA Tomohiko @@ -27,6 +27,9 @@ ;;; Code: (require 'mime-def) +(eval-when-compile + ;; XXX: the macro `as-binary-process' should be provided when compiling. + (require 'pces)) ;;; @ variables @@ -47,7 +50,8 @@ :type '(cons (file :tag "Command")(repeat :tag "Arguments" string))) (defcustom base64-external-decoder-option-to-specify-file '("-o") - "*list of options of base64 decoder program to specify file." + "*list of options of base64 decoder program to specify file. +If the base64 decoder program does not have such option, set this as nil." :group 'base64 :type '(repeat :tag "Arguments" string)) @@ -365,13 +369,22 @@ START and END are buffer positions." (interactive "*r\nFWrite decoded region to file: ") (if (and base64-internal-decoding-limit (> (- end start) base64-internal-decoding-limit)) - (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)))) + (progn + (as-binary-process + (apply (function call-process-region) + start end (car base64-external-decoder) + (null base64-external-decoder-option-to-specify-file) + (unless base64-external-decoder-option-to-specify-file + (list (current-buffer) nil)) + nil + (delq nil + (append + (cdr base64-external-decoder) + base64-external-decoder-option-to-specify-file + (when base64-external-decoder-option-to-specify-file + (list filename)))))) + (unless base64-external-decoder-option-to-specify-file + (write-region-as-binary (point-min) (point-max) filename))) (let ((str (buffer-substring start end))) (with-temp-buffer (insert (base64-internal-decode-string str))