From 1f68a4f18c1c76e5370d445660a2c9ce10611b39 Mon Sep 17 00:00:00 2001 From: tomo Date: Mon, 25 Dec 2000 11:23:27 +0000 Subject: [PATCH] Sync with FLIM 1.14.2, SEMI 1.14.2 and EMH 1.14.1. --- mail/qmtp.el | 9 ++--- mail/smtp.el | 10 +++--- mail/smtpmail.el | 4 +-- mime/emh.el | 13 +++----- mime/mail-mime-setup.el | 8 ++--- mime/mel.el | 83 +++++++++++++++++++++++++++++++++++++++-------- mime/mime-def.el | 2 +- mime/mime-play.el | 21 +++++------- mime/mime-view.el | 40 ++++++++++++++--------- mime/mmbuffer.el | 7 ++-- mime/mmexternal.el | 4 +-- mime/pgg-gpg.el | 8 ++--- mime/pgg-pgp.el | 11 +++++-- mime/pgg-pgp5.el | 11 +++++-- mime/semi-def.el | 2 +- mime/smime.el | 14 ++++---- 16 files changed, 159 insertions(+), 88 deletions(-) diff --git a/mail/qmtp.el b/mail/qmtp.el index 1010857..e74f798 100644 --- a/mail/qmtp.el +++ b/mail/qmtp.el @@ -34,6 +34,7 @@ ;;; Code: (require 'custom) +(require 'mel) ; binary-funcall (defgroup qmtp nil "QMTP protocol for sending mail." @@ -60,9 +61,8 @@ called from `qmtp-via-qmtp' with arguments SENDER and RECIPIENTS.") :type 'integer :group 'qmtp) -(autoload 'binary-open-network-stream "raw-io") ;;;###autoload -(defvar qmtp-open-connection-function (function binary-open-network-stream)) +(defvar qmtp-open-connection-function (function open-network-stream)) (defvar qmtp-error-response-alist '((?Z "Temporary failure") @@ -128,8 +128,9 @@ called from `qmtp-via-qmtp' with arguments SENDER and RECIPIENTS.") (unwind-protect (progn (setq process - (funcall qmtp-open-connection-function - "QMTP" (current-buffer) qmtp-server qmtp-service)) + (binary-funcall qmtp-open-connection-function + "QMTP" (current-buffer) + qmtp-server qmtp-service)) (qmtp-send-package process sender recipients buffer)) (when (and process (memq (process-status process) '(open run))) diff --git a/mail/smtp.el b/mail/smtp.el index 75cbae0..4265bbd 100644 --- a/mail/smtp.el +++ b/mail/smtp.el @@ -1,6 +1,6 @@ ;;; smtp.el --- basic functions to send mail with SMTP server -;; Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc. +;; Copyright (C) 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Tomoji Kagatani ;; Simon Leinen (ESMTP support) @@ -35,6 +35,7 @@ (require 'mail-utils) ; mail-strip-quoted-names (require 'sasl) (require 'luna) +(require 'mel) ; binary-funcall (defgroup smtp nil "SMTP protocol for sending mail." @@ -112,9 +113,8 @@ don't define this value." (defvar sasl-mechanisms) -(autoload 'binary-open-network-stream "raw-io") ;;;###autoload -(defvar smtp-open-connection-function #'binary-open-network-stream) +(defvar smtp-open-connection-function #'open-network-stream) (defvar smtp-read-point nil) @@ -236,8 +236,8 @@ Return a newly allocated connection-object. BUFFER is the buffer to associate with the connection. SERVER is name of the host to connect to. SERVICE is name of the service desired." (let ((process - (funcall smtp-open-connection-function - "SMTP" buffer server service)) + (binary-funcall smtp-open-connection-function + "SMTP" buffer server service)) connection) (when process (setq connection (smtp-make-connection process server service)) diff --git a/mail/smtpmail.el b/mail/smtpmail.el index 4a7ba79..c1a314e 100644 --- a/mail/smtpmail.el +++ b/mail/smtpmail.el @@ -46,7 +46,7 @@ (require 'smtp) (require 'sendmail) (require 'time-stamp) -(require 'raw-io) +(require 'mel) ; binary-write-decoded-region, binary-find-file-noselect (eval-when-compile (require 'static)) @@ -245,7 +245,7 @@ This is relative to `smtpmail-queue-dir'.") (insert-buffer tembuf) (or (file-directory-p smtpmail-queue-dir) (make-directory smtpmail-queue-dir t)) - (binary-write-region (point-min) (point-max) file-data) + (binary-write-decoded-region (point-min) (point-max) file-data) (set-buffer buffer-elisp) (erase-buffer) (insert (concat diff --git a/mime/emh.el b/mime/emh.el index efa3f27..2da4435 100644 --- a/mime/emh.el +++ b/mime/emh.el @@ -37,7 +37,7 @@ ;;; @ version ;;; -(defconst emh-version "1.14.0") +(defconst emh-version "1.14.1") ;;; @ variable @@ -98,21 +98,18 @@ nil, `emh-automatic-mime-preview' is used as default value." (progn (set-buffer abuf) (setq buffer-read-only nil) - (erase-buffer) - ) + (erase-buffer)) (setq abuf (get-buffer-create aname)) (set-buffer abuf) - (set-buffer-multibyte nil) - ) - (raw-text-insert-file-contents msg-filename) + (set-buffer-multibyte nil)) + (8bit-insert-encoded-file msg-filename) (set-buffer-modified-p nil) (setq buffer-read-only t) (setq buffer-file-name msg-filename) (mh-show-mode) (mime-display-message (mime-open-entity 'buffer aname) (concat "show-" folder)) - (goto-char (point-min)) - ) + (goto-char (point-min))) (let ((clean-message-header mh-clean-message-header) (invisible-headers mh-invisible-headers) (visible-headers mh-visible-headers)) diff --git a/mime/mail-mime-setup.el b/mime/mail-mime-setup.el index 710d15b..7b375b7 100644 --- a/mime/mail-mime-setup.el +++ b/mime/mail-mime-setup.el @@ -1,6 +1,6 @@ ;;; mail-mime-setup.el --- setup file for mail-mode. -;; Copyright (C) 1994,1995,1996,1997,1998 Free Software Foundation, Inc. +;; Copyright (C) 1994,1995,1996,1997,1998,2000 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko ;; Keywords: mail-mode, MIME, multimedia, multilingual, encoded-word @@ -31,14 +31,14 @@ (autoload 'turn-on-mime-edit "mime-edit" "Unconditionally turn on MIME-Edit minor mode." t) -(autoload 'eword-decode-header "eword-decode" - "Decode MIME encoded-words in header fields." t) +;; (autoload 'eword-decode-header "eword-decode" +;; "Decode MIME encoded-words in header fields." t) ;;; @ for mail-mode, RMAIL and VM ;;; -(add-hook 'mail-setup-hook 'eword-decode-header) +;; (add-hook 'mail-setup-hook 'eword-decode-header) (add-hook 'mail-setup-hook 'turn-on-mime-edit 'append) (add-hook 'mail-send-hook 'mime-edit-maybe-translate) (set-alist 'mime-edit-split-message-sender-alist diff --git a/mime/mel.el b/mime/mel.el index 8c84ac5..6d7de59 100644 --- a/mime/mel.el +++ b/mime/mel.el @@ -1,6 +1,6 @@ ;;; mel.el --- A MIME encoding/decoding library. -;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc. +;; Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko ;; Created: 1995/6/25 @@ -26,7 +26,6 @@ ;;; Code: (require 'mime-def) -(require 'raw-io) (require 'alist) (defcustom mime-encoding-list @@ -78,22 +77,78 @@ Content-Transfer-Encoding for it." ;;; @ setting for modules ;;; -(mel-define-backend "7bit") -(mel-define-method-function (mime-encode-string string (nil "7bit")) +(defun 8bit-insert-encoded-file (filename) + "Insert file FILENAME encoded by \"7bit\" format." + (let ((coding-system-for-read 'raw-text) + format-alist) + ;; Returns list of absolute file name and length of data inserted. + (insert-file-contents filename))) + +(defun 8bit-write-decoded-region (start end filename) + "Decode and write current region encoded by \"8bit\" into FILENAME." + (let ((coding-system-for-write 'raw-text) + format-alist) + (write-region start end filename))) + +(mel-define-backend "8bit") +(mel-define-method-function (mime-encode-string string (nil "8bit")) 'identity) -(mel-define-method-function (mime-decode-string string (nil "7bit")) +(mel-define-method-function (mime-decode-string string (nil "8bit")) 'identity) -(mel-define-method mime-encode-region (start end (nil "7bit"))) -(mel-define-method mime-decode-region (start end (nil "7bit"))) -(mel-define-method-function (mime-insert-encoded-file filename (nil "7bit")) - 'binary-insert-file-contents) +(mel-define-method mime-encode-region (start end (nil "8bit"))) +(mel-define-method mime-decode-region (start end (nil "8bit"))) +(mel-define-method-function (mime-insert-encoded-file filename (nil "8bit")) + '8bit-insert-encoded-file) (mel-define-method-function (mime-write-decoded-region - start end filename (nil "7bit")) - 'binary-write-region) + start end filename (nil "8bit")) + '8bit-write-decoded-region) -(mel-define-backend "8bit" ("7bit")) -(mel-define-backend "binary" ("8bit")) +(defalias '7bit-insert-encoded-file '8bit-insert-encoded-file) +(defalias '7bit-write-decoded-region '8bit-write-decoded-region) + +(mel-define-backend "7bit" ("8bit")) + + +(defun binary-write-decoded-region (start end filename) + "Decode and write current region encoded by \"binary\" into FILENAME." + (let ((coding-system-for-write 'binary) + jka-compr-compression-info-list jam-zcat-filename-list) + (write-region start end filename))) + +(defalias 'binary-insert-encoded-file 'insert-file-contents-literally) + +(defun binary-find-file-noselect (filename &optional nowarn rawfile) + "Like `find-file-noselect', q.v., but don't code and format conversion." + (let ((coding-system-for-read 'binary) + format-alist) + (find-file-noselect filename nowarn rawfile))) + +(defun binary-funcall (name &rest args) + "Like `funcall', q.v., but read and write as binary." + (let ((coding-system-for-read 'binary) + (coding-system-for-write 'binary)) + (apply name args))) + +(defun binary-to-text-funcall (coding-system name &rest args) + "Like `funcall', q.v., but write as binary and read as text. +Read text is decoded as CODING-SYSTEM." + (let ((coding-system-for-read coding-system) + (coding-system-for-write 'binary)) + (apply name args))) + +(mel-define-backend "binary") +(mel-define-method-function (mime-encode-string string (nil "binary")) + 'identity) +(mel-define-method-function (mime-decode-string string (nil "binary")) + 'identity) +(mel-define-method mime-encode-region (start end (nil "binary"))) +(mel-define-method mime-decode-region (start end (nil "binary"))) +(mel-define-method-function (mime-insert-encoded-file filename (nil "binary")) + 'binary-insert-encoded-file) +(mel-define-method-function (mime-write-decoded-region + start end filename (nil "binary")) + 'binary-write-decoded-region) (defvar mel-b-builtin (and (fboundp 'base64-encode-string) @@ -118,7 +173,7 @@ mmencode included in metamail or XEmacs package)." (insert (base64-encode-string (with-temp-buffer (set-buffer-multibyte nil) - (binary-insert-file-contents filename) + (binary-insert-encoded-file filename) (buffer-string)))) (or (bolp) (insert ?\n))) diff --git a/mime/mime-def.el b/mime/mime-def.el index f4ced4d..5ff449e 100644 --- a/mime/mime-def.el +++ b/mime/mime-def.el @@ -34,7 +34,7 @@ ) (eval-and-compile - (defconst mime-library-product ["FLIM" (1 14 1) "Yagi"] + (defconst mime-library-product ["FLIM" (1 14 2) "Yagi-Nishiguchi"] "Product name, version number and code name of MIME-library package.")) (defmacro mime-product-name (product) diff --git a/mime/mime-play.el b/mime/mime-play.el index edd46d5..82f3f69 100644 --- a/mime/mime-play.el +++ b/mime/mime-play.el @@ -369,7 +369,7 @@ It is registered to variable `mime-preview-quitting-method-alist'." (save-window-excursion (set-buffer full-buf) (erase-buffer) - (binary-insert-file-contents file) + (binary-insert-encoded-file file) (setq major-mode 'mime-show-message-mode) (mime-view-buffer (current-buffer) nil mother) (setq pbuf (current-buffer)) @@ -420,24 +420,21 @@ It is registered to variable `mime-preview-quitting-method-alist'." (or (file-exists-p file) (throw 'tag nil) ) - (binary-insert-file-contents file) + (binary-insert-encoded-file file) (goto-char (point-max)) - (setq i (1+ i)) - )) - (binary-write-region (point-min)(point-max) - (expand-file-name "FULL" root-dir)) + (setq i (1+ i)))) + (binary-write-decoded-region + (point-min)(point-max) + (expand-file-name "FULL" root-dir)) (let ((i 1)) (while (<= i total) (let ((file (format "%s/%d" root-dir i))) (and (file-exists-p file) - (delete-file file) - )) - (setq i (1+ i)) - )) + (delete-file file))) + (setq i (1+ i)))) (let ((file (expand-file-name "CT" root-dir))) (and (file-exists-p file) - (delete-file file) - )) + (delete-file file))) (let ((buf (current-buffer)) (pwin (or (get-buffer-window mother) (get-largest-window))) diff --git a/mime/mime-view.el b/mime/mime-view.el index d723679..888f4d7 100644 --- a/mime/mime-view.el +++ b/mime/mime-view.el @@ -1118,8 +1118,7 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t. t means default." (defun mime-view-define-keymap (&optional default) (let ((mime-view-mode-map (if (keymapp default) (copy-keymap default) - (make-sparse-keymap) - ))) + (make-sparse-keymap)))) (define-key mime-view-mode-map "u" (function mime-preview-move-to-upper)) (define-key mime-view-mode-map @@ -1212,15 +1211,15 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t. t means default." (lambda (item) (define-key mime-view-mode-map (vector 'menu-bar 'mime-view (car item)) - (cons (nth 1 item)(nth 2 item)) - ) + (cons (nth 1 item)(nth 2 item))) )) - (reverse mime-view-menu-list) - ) + (reverse mime-view-menu-list)) )) - (use-local-map mime-view-mode-map) - (run-hooks 'mime-view-define-keymap-hook) - )) + ;; (run-hooks 'mime-view-define-keymap-hook) + mime-view-mode-map)) + +(defvar mime-view-mode-default-map (mime-view-define-keymap)) + (defsubst mime-maybe-hide-echo-buffer () "Clear mime-echo buffer and delete window for it." @@ -1241,7 +1240,7 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t. t means default." ;;;###autoload (defun mime-display-message (message &optional preview-buffer mother default-keymap-or-function - original-major-mode) + original-major-mode keymap) "View MESSAGE in MIME-View mode. Optional argument PREVIEW-BUFFER specifies the buffer of the @@ -1252,7 +1251,14 @@ Optional argument MOTHER specifies mother-buffer of the preview-buffer. Optional argument DEFAULT-KEYMAP-OR-FUNCTION is nil, keymap or function. If it is a keymap, keymap of MIME-View mode will be added to it. If it is a function, it will be bound as default binding of -keymap of MIME-View mode." +keymap of MIME-View mode. + +Optional argument ORIGINAL-MAJOR-MODE is major-mode of representation +buffer of MESSAGE. If it is nil, current `major-mode' is used. + +Optional argument KEYMAP is keymap of MIME-View mode. If it is +non-nil, DEFAULT-KEYMAP-OR-FUNCTION is ignored. If it is nil, +`mime-view-mode-default-map' is used." (mime-maybe-hide-echo-buffer) (let ((win-conf (current-window-configuration))) (or preview-buffer @@ -1265,8 +1271,7 @@ keymap of MIME-View mode." (widen) (erase-buffer) (if mother - (setq mime-mother-buffer mother) - ) + (setq mime-mother-buffer mother)) (setq mime-preview-original-window-configuration win-conf) (setq major-mode 'mime-view-mode) (setq mode-name "MIME-View") @@ -1275,14 +1280,17 @@ keymap of MIME-View mode." (header . visible) (major-mode . ,original-major-mode)) preview-buffer) - (mime-view-define-keymap default-keymap-or-function) + (use-local-map + (or keymap + (if default-keymap-or-function + (mime-view-define-keymap default-keymap-or-function) + mime-view-mode-default-map))) (let ((point (next-single-property-change (point-min) 'mime-view-entity))) (if point (goto-char point) (goto-char (point-min)) - (search-forward "\n\n" nil t) - )) + (search-forward "\n\n" nil t))) (run-hooks 'mime-view-mode-hook) (set-buffer-modified-p nil) (setq buffer-read-only t) diff --git a/mime/mmbuffer.el b/mime/mmbuffer.el index b99d80b..1447d17 100644 --- a/mime/mmbuffer.el +++ b/mime/mmbuffer.el @@ -125,9 +125,10 @@ filename) (save-excursion (set-buffer (mime-buffer-entity-buffer-internal entity)) - (binary-write-region (mime-buffer-entity-body-start-internal entity) - (mime-buffer-entity-body-end-internal entity) - filename))) + (binary-write-decoded-region + (mime-buffer-entity-body-start-internal entity) + (mime-buffer-entity-body-end-internal entity) + filename))) ;;; @ entity content diff --git a/mime/mmexternal.el b/mime/mmexternal.el index dde1406..aafddcc 100644 --- a/mime/mmexternal.el +++ b/mime/mmexternal.el @@ -78,7 +78,7 @@ (concat " *Body of " (mime-entity-name entity) "*")) - (binary-insert-file-contents + (binary-insert-encoded-file (mime-external-entity-body-file-internal entity)) (current-buffer)))) (error (message "Can't get external-body."))))) @@ -120,7 +120,7 @@ filename) (mmexternal-require-buffer entity) (with-current-buffer (mime-external-entity-body-buffer-internal entity) - (binary-write-region (point-min) (point-max) filename))) + (binary-write-decoded-region (point-min) (point-max) filename))) ;;; @ entity content diff --git a/mime/pgg-gpg.el b/mime/pgg-gpg.el index 5b29a76..dc6c5ae 100644 --- a/mime/pgg-gpg.el +++ b/mime/pgg-gpg.el @@ -25,6 +25,7 @@ ;;; Code: +(require 'mel) ; binary-to-text-funcall (eval-when-compile (require 'pgg)) (defgroup pgg-gpg () @@ -78,11 +79,10 @@ (progn (set-default-file-modes 448) (setq process - (apply #'binary-start-process "*GnuPG*" errors-buffer + (apply #'binary-to-text-funcall + pgg-gpg-messages-coding-system + #'start-process "*GnuPG*" errors-buffer program args)) - (if (fboundp 'set-process-coding-system) - (set-process-coding-system process - pgg-gpg-messages-coding-system)) (set-process-sentinel process #'ignore) (when passphrase (process-send-string process (concat passphrase "\n"))) diff --git a/mime/pgg-pgp.el b/mime/pgg-pgp.el index dadd5fe..c005a22 100644 --- a/mime/pgg-pgp.el +++ b/mime/pgg-pgp.el @@ -25,6 +25,7 @@ ;;; Code: +(require 'mel) ; binary-to-text-funcall, binary-write-decoded-region (eval-when-compile (require 'pgg)) (defgroup pgg-pgp () @@ -58,6 +59,9 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (defvar pgg-pgp-user-id nil "PGP ID of your default identity.") +(defvar pgg-pgp-messages-coding-system pgg-messages-coding-system + "Coding system used when reading from a PGP external process.") + (defvar pgg-scheme-pgp-instance nil) ;;;###autoload @@ -89,8 +93,9 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (unwind-protect (progn (setq process - (apply #'binary-start-process-shell-command "*PGP*" - output-buffer + (apply #'binary-to-text-funcall + pgg-pgp-messages-coding-system + #'start-process-shell-command "*PGP*" output-buffer program args)) (set-process-sentinel process #'ignore) (when passphrase @@ -198,7 +203,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (unwind-protect (progn (set-default-file-modes 448) - (binary-write-region start end orig-file)) + (binary-write-decoded-region start end orig-file)) (set-default-file-modes orig-mode)) (when (stringp signature) (copy-file signature (setq signature (concat orig-file ".asc"))) diff --git a/mime/pgg-pgp5.el b/mime/pgg-pgp5.el index fa1b0ee..9a0ccf9 100644 --- a/mime/pgg-pgp5.el +++ b/mime/pgg-pgp5.el @@ -25,6 +25,7 @@ ;;; Code: +(require 'mel) ; binary-to-text-funcall, binary-write-decoded-region (eval-when-compile (require 'pgg)) (defgroup pgg-pgp5 () @@ -73,6 +74,9 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (defvar pgg-pgp5-user-id nil "PGP 5.* ID of your default identity.") +(defvar pgg-pgp5-messages-coding-system pgg-messages-coding-system + "Coding system used when reading from a PGP5 external process.") + (defvar pgg-scheme-pgp5-instance nil) ;;;###autoload @@ -104,8 +108,9 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (unwind-protect (progn (setq process - (apply #'binary-start-process-shell-command "*PGP*" - output-buffer + (apply #'binary-to-text-funcall + pgg-pgp5-messages-coding-system + #'start-process-shell-command "*PGP*" output-buffer program args)) (set-process-sentinel process #'ignore) (when passphrase @@ -210,7 +215,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (unwind-protect (progn (set-default-file-modes 448) - (binary-write-region start end orig-file)) + (binary-write-decoded-region start end orig-file)) (set-default-file-modes orig-mode)) (when (stringp signature) (copy-file signature (setq signature (concat orig-file ".asc"))) diff --git a/mime/semi-def.el b/mime/semi-def.el index 564ee66..5c4ee39 100644 --- a/mime/semi-def.el +++ b/mime/semi-def.el @@ -28,7 +28,7 @@ (require 'custom) -(defconst mime-user-interface-product ["SEMI" (1 14 1) "Kaga-Onsen"] +(defconst mime-user-interface-product ["SEMI" (1 14 2) "Daishòji"] "Product name, version number and code name of MIME-kernel package.") (autoload 'mule-caesar-region "mule-caesar" diff --git a/mime/smime.el b/mime/smime.el index a45d399..839c715 100644 --- a/mime/smime.el +++ b/mime/smime.el @@ -39,7 +39,8 @@ ;;; Code: (require 'path-util) -(require 'raw-io) +(require 'mel) +;; binary-funcall, binary-write-decoded-region, binary-insert-encoded-file (eval-when-compile (require 'static)) (defgroup smime () @@ -204,8 +205,9 @@ (buffer-disable-undo) (erase-buffer)) (setq process - (apply #'binary-start-process-shell-command "*S/MIME*" - smime-output-buffer program args)) + (apply #'binary-funcall #'start-process-shell-command + "*S/MIME*" smime-output-buffer + program args)) (set-process-sentinel process 'ignore) (process-send-region process start end) (process-send-eof process) @@ -301,12 +303,12 @@ the detached signature of the current region." (unwind-protect (progn (set-default-file-modes 448) - (binary-write-region start end orig-file)) + (binary-write-decoded-region start end orig-file)) (set-default-file-modes orig-mode)) (with-temp-buffer - (binary-insert-file-contents signature) + (binary-insert-encoded-file signature) (goto-char (point-max)) - (binary-insert-file-contents + (binary-insert-encoded-file (or (smime-find-certificate (smime-query-signer (point-min)(point-max))) (expand-file-name -- 1.7.10.4