;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Created: 1994/08/21 renamed from mime.el
-;; Version: $Revision: 7.86 $
+;; Version: $Revision: 7.87 $
;; Keywords: mail, news, MIME, multimedia, multilingual
;; This file is part of tm (Tools for MIME).
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; 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.
;;; Commentary:
;;;
(defconst mime-editor/RCS-ID
- "$Id: tm-edit.el,v 7.86 1996/09/21 14:33:25 morioka Exp $")
+ "$Id: tm-edit.el,v 7.87 1996/09/23 19:53:58 morioka Exp $")
(defconst mime-editor/version (get-version-string mime-editor/RCS-ID))
(defvar mime-auto-hide-body t
"*Hide non-textual body encoded in base64 after insertion if non-nil.")
-(defvar mime-voice-recorder
- (function mime-voice-recorder-for-sun)
- "*Function to record a voice message and return a buffer that contains it.")
+(defvar mime-editor/voice-recorder
+ (function mime-editor/voice-recorder-for-sun)
+ "*Function to record a voice message and encode it. [tm-edit.el]")
(defvar mime/editor-mode-hook nil
"*Hook called when enter MIME mode.")
Hide a non-textual body message encoded in base64 after insertion
if non-nil.
- mime-voice-recorder
- Specifies a function to record a voice message and return a buffer
- that contains it. The function mime-voice-recorder-for-sun is for
- Sun SparcStations.
+ mime-editor/voice-recorder
+ Specifies a function to record a voice message and encode it.
+ The function `mime-editor/voice-recorder-for-sun' is for Sun
+ SparcStations.
mime/editor-mode-hook
Turning on MIME mode calls the value of mime/editor-mode-hook, if
")"
))
": ")
- mime-encoding-method-alist nil t nil))))
+ mime-file-encoding-method-alist nil t nil))))
(if (string-equal encoding "")
(setq encoding default))
(if (or (consp parameters) (stringp disposition-type))
(defun mime-editor/insert-voice ()
"Insert a voice message."
(interactive)
- (mime-editor/insert-tag "audio" "basic" nil)
- (let ((buffer (funcall mime-voice-recorder)))
- (unwind-protect
- (mime-editor/insert-binary-buffer buffer "base64")
- (kill-buffer buffer)
- )))
+ (let ((encoding
+ (completing-read
+ "What transfer encoding: "
+ mime-file-encoding-method-alist nil t nil)))
+ (mime-editor/insert-tag "audio" "basic" nil)
+ (mime-editor/define-encoding encoding)
+ (save-restriction
+ (narrow-to-region (1- (point))(point))
+ (unwind-protect
+ (funcall mime-editor/voice-recorder encoding)
+ (progn
+ (insert "\n")
+ (invisible-region (point-min)(point-max))
+ (goto-char (point-max))
+ )))))
(defun mime-editor/insert-signature (&optional arg)
"Insert a signature file."
)
))
-;; Insert the binary content after MIME tag.
-;; modified by MORITA Masahiro <hiro@isl.ntt.JP>
-;; for x-uue
(defun mime-editor/insert-binary-file (file &optional encoding)
"Insert binary FILE at point.
Optional argument ENCODING specifies an encoding method such as base64."
- (let ((tmpbuf (get-buffer-create " *MIME insert*")))
- (save-excursion
- (set-buffer tmpbuf)
- (erase-buffer)
- (as-binary-input-file (insert-file-contents file))
- )
- (prog1
- (if (and (stringp encoding)
- (string-equal (downcase encoding) "x-uue"))
- (progn
- (require 'mel-u)
- (let ((uuencode-external-encoder
- (cons (car uuencode-external-encoder)
- (list (file-name-nondirectory file))
- )))
- (mime-editor/insert-binary-buffer tmpbuf encoding)
- ))
- (mime-editor/insert-binary-buffer tmpbuf encoding))
- (kill-buffer tmpbuf))))
-
-;; Insert the binary content after MIME tag.
-;; modified by MORITA Masahiro <hiro@isl.ntt.JP>
-;; for x-uue
-(defun mime-editor/insert-binary-buffer (buffer &optional encoding)
- "Insert binary BUFFER at point.
-Optional argument ENCODING specifies an encoding method such as base64."
(let* ((tagend (1- (point))) ;End of the tag
(hide-p (and mime-auto-hide-body
(stringp encoding)
- (let ((en (downcase encoding)))
- (or (string-equal en "base64")
- (string-equal en "x-uue")
- ))))
+ (not
+ (let ((en (downcase encoding)))
+ (or (string-equal en "7bit")
+ (string-equal en "8bit")
+ (string-equal en "binary")
+ )))))
)
(save-restriction
- (narrow-to-region (1- (point)) (point))
- (let ((start (point))
- (emx-binary-mode t)) ;Stop LF to CRLF conversion in OS/2
- (insert-buffer-substring buffer)
- ;; Encode binary message if necessary.
- (if encoding
- (mime-encode-region start (point-max) encoding)
- ))
+ (narrow-to-region tagend (point))
+ (mime-insert-encoded-file file encoding)
(if hide-p
(progn
(invisible-region (point-min) (point-max))
(goto-char (point-max))
- )
- ))
+ ))
+ )
;; Define encoding even if it is 7bit.
(if (stringp encoding)
(save-excursion
- (goto-char tagend) ;Make sure which line the tag is on.
- (mime-editor/define-encoding encoding)))
+ (goto-char tagend) ; Make sure which line the tag is on.
+ (mime-editor/define-encoding encoding)
+ ))
))
\f
;; Sun implementations
-(defun mime-voice-recorder-for-sun ()
- "Record voice in a buffer using Sun audio device, and return the buffer.
-If the environment variable AUDIOHOST is defined, its value is used as
-a recording host instead of local host."
- (let ((buffer (get-buffer-create " *MIME audio*"))
- (host (getenv "AUDIOHOST")))
- (message "Start the recording on %s. Type C-g to finish the recording..."
- (or host (system-name)))
- (save-excursion
- (set-buffer buffer)
- (erase-buffer)
- (condition-case errorcode
- (let ((selective-display nil) ;Disable ^M to nl translation.
- (mc-flag nil) ;Mule
- (kanji-flag nil)) ;NEmacs
- ;; If AUDIOHOST is defined, use the value as recording host.
- (cond ((not (null host))
- ;; Disable automatic conversion of coding system if Mule.
- (if (featurep 'mule)
- (define-program-coding-system nil "rsh" *noconv*))
- (call-process "rsh"
- nil
- buffer
- nil
- host
- "cat"
- "/dev/audio"
- ))
- (t
- ;; Disable automatic conversion of coding system if Mule.
- (if (featurep 'mule)
- (define-program-coding-system nil "cat" *noconv*))
- (call-process "cat"
- "/dev/audio"
- buffer
- nil
- ))))
- (quit (message "Type C-g to finish recording... done.")
- buffer ;Return the buffer
- )))))
+(defun mime-editor/voice-recorder-for-sun (encoding)
+ "Record voice in a buffer using Sun audio device,
+and insert data encoded as ENCODING. [tm-edit.el]"
+ (mime-insert-encoded-file "/dev/audio" encoding)
+ )
\f
;;; @ Other useful commands.