From 7b87c37a9bac82426077273f91f28f77ccf75494 Mon Sep 17 00:00:00 2001 From: tomo Date: Thu, 28 Dec 2000 09:25:03 +0000 Subject: [PATCH] Sync with SEMI 1.14.3 (Ushinoya). --- mime/mime-play.el | 17 +++--- mime/mime-view.el | 162 +++++++++++++++++++++++++++++++---------------------- mime/pgg-def.el | 6 +- mime/pgg-pgp.el | 6 +- mime/pgg-pgp5.el | 6 +- mime/semi-def.el | 2 +- 6 files changed, 108 insertions(+), 91 deletions(-) diff --git a/mime/mime-play.el b/mime/mime-play.el index 82f3f69..dad7904 100644 --- a/mime/mime-play.el +++ b/mime/mime-play.el @@ -46,6 +46,9 @@ If t, it means current directory." (defvar mime-play-find-every-situations t "*Find every available situations if non-nil.") +(defvar mime-play-messages-coding-system nil + "Coding system to be used for external MIME playback method.") + ;;; @ content decoder ;;; @@ -142,8 +145,7 @@ specified, play as it. Default MODE is \"play\"." (if (and name (not (string= name ""))) (expand-file-name name temporary-file-directory) (make-temp-name - (expand-file-name "EMI" temporary-file-directory)) - )) + (expand-file-name "EMI" temporary-file-directory)))) (mime-write-entity-content entity name) (message "External method is starting...") (let ((process @@ -151,13 +153,12 @@ specified, play as it. Default MODE is \"play\"." (mime-format-mailcap-command method (cons (cons 'filename name) situation)))) - (start-process command mime-echo-buffer-name - shell-file-name shell-command-switch command) - ))) + (binary-to-text-funcall + mime-play-messages-coding-system + #'start-process command mime-echo-buffer-name + shell-file-name shell-command-switch command)))) (set-alist 'mime-mailcap-method-filename-alist process name) - (set-process-sentinel process 'mime-mailcap-method-sentinel) - ) - )) + (set-process-sentinel process 'mime-mailcap-method-sentinel)))) (defun mime-mailcap-method-sentinel (process event) (let ((file (cdr (assq process mime-mailcap-method-filename-alist)))) diff --git a/mime/mime-view.el b/mime/mime-view.el index 888f4d7..15032e0 100644 --- a/mime/mime-view.el +++ b/mime/mime-view.el @@ -66,6 +66,15 @@ buttom. Nil means don't scroll at all." (const :tag "On" t) (sexp :tag "Situation" 1))) +(defcustom mime-view-mailcap-files + (let ((files '("/etc/mailcap" "/usr/etc/mailcap" "~/.mailcap"))) + (or (member mime-mailcap-file files) + (setq files (cons mime-mailcap-file files))) + files) + "List of mailcap files." + :group 'mime-view + :type '(repeat file)) + ;;; @ in raw-buffer (representation space) ;;; @@ -360,6 +369,53 @@ mother-buffer." (defvar mime-acting-situation-example-list-max-size 16) (defvar mime-situation-examples-file-coding-system nil) +(defun mime-view-read-situation-examples-file (&optional file) + (or file + (setq file mime-situation-examples-file)) + (if (and file + (file-readable-p file)) + (with-temp-buffer + (insert-file-contents file) + (setq mime-situation-examples-file-coding-system + (and (boundp 'buffer-file-coding-system) + buffer-file-coding-system) + ;; (static-cond + ;; ((boundp 'buffer-file-coding-system) + ;; (symbol-value 'buffer-file-coding-system)) + ;; ((boundp 'file-coding-system) + ;; (symbol-value 'file-coding-system)) + ;; (t nil)) + ) + (condition-case error + (eval-buffer) + (error (message "%s is broken: %s" file (cdr error)))) + ;; format check + (condition-case nil + (let ((i 0)) + (while (and (> (length mime-preview-situation-example-list) + mime-preview-situation-example-list-max-size) + (< i 16)) + (setq mime-preview-situation-example-list + (mime-reduce-situation-examples + mime-preview-situation-example-list)) + (setq i (1+ i)))) + (error (setq mime-preview-situation-example-list nil))) + ;; (let ((rest mime-preview-situation-example-list)) + ;; (while rest + ;; (ctree-set-calist-strictly 'mime-preview-condition + ;; (caar rest)) + ;; (setq rest (cdr rest)))) + (condition-case nil + (let ((i 0)) + (while (and (> (length mime-acting-situation-example-list) + mime-acting-situation-example-list-max-size) + (< i 16)) + (setq mime-acting-situation-example-list + (mime-reduce-situation-examples + mime-acting-situation-example-list)) + (setq i (1+ i)))) + (error (setq mime-acting-situation-example-list nil)))))) + (defun mime-save-situation-examples () (if (or mime-preview-situation-example-list mime-acting-situation-example-list) @@ -871,34 +927,39 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t. t means default." (defvar mime-acting-condition nil "Condition-tree about how to process entity.") -(if (file-readable-p mime-mailcap-file) - (let ((entries (mime-parse-mailcap-file))) - (while entries - (let ((entry (car entries)) - view print shared) - (while entry - (let* ((field (car entry)) - (field-type (car field))) - (cond ((eq field-type 'view) (setq view field)) - ((eq field-type 'print) (setq print field)) - ((memq field-type '(compose composetyped edit))) - (t (setq shared (cons field shared)))) - ) - (setq entry (cdr entry)) +(defun mime-view-read-mailcap-files (&optional files) + (or files + (setq files mime-view-mailcap-files)) + (let (entries file) + (while files + (setq file (car files)) + (if (file-readable-p file) + (setq entries (append entries (mime-parse-mailcap-file file)))) + (setq files (cdr files))) + (while entries + (let ((entry (car entries)) + view print shared) + (while entry + (let* ((field (car entry)) + (field-type (car field))) + (cond ((eq field-type 'view) (setq view field)) + ((eq field-type 'print) (setq print field)) + ((memq field-type '(compose composetyped edit))) + (t (setq shared (cons field shared)))) ) - (setq shared (nreverse shared)) - (ctree-set-calist-with-default - 'mime-acting-condition - (append shared (list '(mode . "play")(cons 'method (cdr view))))) - (if print - (ctree-set-calist-with-default - 'mime-acting-condition - (append shared - (list '(mode . "print")(cons 'method (cdr view)))) - )) - ) - (setq entries (cdr entries)) - ))) + (setq entry (cdr entry))) + (setq shared (nreverse shared)) + (ctree-set-calist-with-default + 'mime-acting-condition + (append shared (list '(mode . "play")(cons 'method (cdr view))))) + (if print + (ctree-set-calist-with-default + 'mime-acting-condition + (append shared + (list '(mode . "print")(cons 'method (cdr view))))))) + (setq entries (cdr entries))))) + +(mime-view-read-mailcap-files) (ctree-set-calist-strictly 'mime-acting-condition @@ -1796,46 +1857,11 @@ It calls function registered in variable (provide 'mime-view) -(let ((file mime-situation-examples-file)) - (if (file-readable-p file) - (with-temp-buffer - (insert-file-contents file) - (setq mime-situation-examples-file-coding-system - (and (boundp 'buffer-file-coding-system) - buffer-file-coding-system) - ;; (static-cond - ;; ((boundp 'buffer-file-coding-system) - ;; (symbol-value 'buffer-file-coding-system)) - ;; ((boundp 'file-coding-system) - ;; (symbol-value 'file-coding-system)) - ;; (t nil)) - ) - (eval-buffer) - ;; format check - (condition-case nil - (let ((i 0)) - (while (and (> (length mime-preview-situation-example-list) - mime-preview-situation-example-list-max-size) - (< i 16)) - (setq mime-preview-situation-example-list - (mime-reduce-situation-examples - mime-preview-situation-example-list)) - (setq i (1+ i)))) - (error (setq mime-preview-situation-example-list nil))) - ;; (let ((rest mime-preview-situation-example-list)) - ;; (while rest - ;; (ctree-set-calist-strictly 'mime-preview-condition - ;; (caar rest)) - ;; (setq rest (cdr rest)))) - (condition-case nil - (let ((i 0)) - (while (and (> (length mime-acting-situation-example-list) - mime-acting-situation-example-list-max-size) - (< i 16)) - (setq mime-acting-situation-example-list - (mime-reduce-situation-examples - mime-acting-situation-example-list)) - (setq i (1+ i)))) - (error (setq mime-acting-situation-example-list nil)))))) +(eval-when-compile + (setq mime-situation-examples-file nil) + ;; to avoid to read situation-examples-file at compile time. + ) + +(mime-view-read-situation-examples-file) ;;; mime-view.el ends here diff --git a/mime/pgg-def.el b/mime/pgg-def.el index d5f01b8..7630f95 100644 --- a/mime/pgg-def.el +++ b/mime/pgg-def.el @@ -58,10 +58,8 @@ :group 'pgg :type 'boolean) -(defcustom pgg-messages-coding-system 'undecided - "Coding system used when reading from a PGP external process." - :group 'pgg - :type 'coding-system) +(defvar pgg-messages-coding-system nil + "Coding system used when reading from a PGP external process.") (defvar pgg-status-buffer " *PGG status*") (defvar pgg-errors-buffer " *PGG errors*") diff --git a/mime/pgg-pgp.el b/mime/pgg-pgp.el index c005a22..91f6134 100644 --- a/mime/pgg-pgp.el +++ b/mime/pgg-pgp.el @@ -59,9 +59,6 @@ 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 @@ -93,8 +90,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (unwind-protect (progn (setq process - (apply #'binary-to-text-funcall - pgg-pgp-messages-coding-system + (apply #'binary-funcall #'start-process-shell-command "*PGP*" output-buffer program args)) (set-process-sentinel process #'ignore) diff --git a/mime/pgg-pgp5.el b/mime/pgg-pgp5.el index 9a0ccf9..58c3309 100644 --- a/mime/pgg-pgp5.el +++ b/mime/pgg-pgp5.el @@ -74,9 +74,6 @@ 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 @@ -108,8 +105,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (unwind-protect (progn (setq process - (apply #'binary-to-text-funcall - pgg-pgp5-messages-coding-system + (apply #'binary-funcall #'start-process-shell-command "*PGP*" output-buffer program args)) (set-process-sentinel process #'ignore) diff --git a/mime/semi-def.el b/mime/semi-def.el index 5c4ee39..5e6fa0f 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 2) "Daishòji"] +(defconst mime-user-interface-product ["SEMI" (1 14 3) "Ushinoya"] "Product name, version number and code name of MIME-kernel package.") (autoload 'mule-caesar-region "mule-caesar" -- 1.7.10.4