+1998-06-12 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * REMI: Version 1.6.0 (Amaharashi) released.
+
+ * mime-w3.el (mime-save-background-color): New macro.
+ (mime-preview-text/html): Use `mime-save-background-color'.
+
+1998-06-11 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-edit.el: Abolish variable `mime-edit-signing-type' and
+ `mime-edit-encrypting-type'.
+ (mime-edit-process-multipart-1): Separate "signed" to "pgp-signed"
+ and "kazu-signed"; separate "encrypted" to "pgp-encrypted" and
+ "kazu-encrypted".
+ (mime-edit-enclose-signed-region): Renamed from
+ `mime-edit-enclose-pgp-signed-region'.
+ (mime-edit-enclose-pgp-encrypted-region): Renamed from
+ `mime-edit-enclose-encrypted-region'.
+ (mime-edit-enclose-kazu-signed-region): New function.
+ (mime-edit-enclose-kazu-encrypted-region): New function.
+ (mime-edit-set-sign): Don't refer `mime-edit-signing-type'.
+ (mime-edit-set-encrypt): Don't refer `mime-edit-encrypting-type'.
+
+1998-06-11 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-edit.el (mime-edit-sign-pgp-kazu): Abolish unused local
+ variable.
+ (mime-edit-encrypt-pgp-kazu): Abolish unused local variables.
+
+1998-06-11 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-pgp.el (mime-method-for-application/pgp): Change interface.
+ (mime-method-to-verify-multipart/signed): Change interface.
+ (mime-method-to-verify-application/pgp-signature): Change
+ interface.
+ (mime-method-to-decrypt-application/pgp-encrypted): Change
+ interface.
+ (mime-method-to-add-application/pgp-keys): Change interface.
+
+ * mime-partial.el (mime-method-to-combine-message/partial-pieces):
+ Change interface.
+
+ * mime-play.el (mime-raw-play-entity): Change interface of
+ internal-method.
+ (mime-method-to-save): Change interface.
+ (mime-method-to-display-message/rfc822): Change interface.
+ (mime-method-to-store-message/partial): Change interface.
+ (mime-method-to-display-message/external-ftp): Change interface.
+ (mime-method-to-display-caesar): Change interface.
+
+1998-06-11 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-edit.el (mime-edit-normalize-body): Use
+ `mime-charset-type-list' directly; abolish local variable
+ `mime-edit-charset-default-encoding-alist' and function
+ `mime-make-charset-default-encoding-alist'.
+ (mime-edit-toggle-transfer-level): Don't set up
+ `mime-edit-charset-default-encoding-alist'.
+
+1998-06-11 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-view.el (mime-view-display-message): Set up
+ `mime-raw-message-info'.
+ (mime-view-buffer): New function.
+ (mime-view-mode): Don't set up `mime-raw-message-info'.
+
+1998-06-11 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-edit.el (mime-charset-type-list): Use base64 for cn-gb2312
+ and gb2312.
+ (mime-edit-normalize-body): If encoding is not specified for
+ charset, use quoted-printable or 8bit for mime-transfer-level is 7
+ or 8.
+
+ * mime-edit.el (mime-charset-type-list): Add `shift_jis'.
+
+1998-06-10 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-view.el (mime-view-display-message): Use
+ `mime-maybe-hide-echo-buffer'.
+ (mime-view-mode): Don't use `mime-maybe-hide-echo-buffer'.
+
+ * mime-view.el (mime-view-display-message): Move point to top of
+ body; run `mime-view-mode-hook'.
+ (mime-view-mode): Don't move point; don't run
+ `mime-view-mode-hook'.
+
+ * mime-view.el (mime-view-display-message): Add new optional
+ argument `default-keymap-or-function'.
+ (mime-view-mode): Modify for `mime-view-display-message'.
+
+ * mime-view.el (mime-view-display-message): Add new optional
+ argument `mother'; set to `mime-mother-buffer'.
+ (mime-view-mode): Modify for `mime-view-display-message'.
+
+1998-06-10 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-mc.el: Use `eval-and-compile' to load "mc-pgp".
+
+ * mime-view.el (mime-preview-multipart/mixed): Modify for
+ `mime-view-display-entity'; don't refer `mime-raw-buffer'.
+ (mime-preview-multipart/alternative): Modify for
+ `mime-view-display-entity'; don't refer `mime-raw-buffer'.
+ (mime-view-display-entity): Change interface to abolish argument
+ for raw-buffer; don't refer `mime-raw-buffer'.
+ (mime-view-display-message): Abolish variable
+ `mime-preview-original-major-mode'; modify for
+ `mime-view-display-entity'.
+ (mime-preview-original-major-mode): New implementation; add
+ optional argument `recursive'.
+ (mime-preview-follow-current-entity): Modify for
+ `mime-preview-original-major-mode'.
+ (mime-preview-move-to-next): Use function
+ `mime-preview-original-major-mode'.
+ (mime-preview-scroll-up-entity): Use function
+ `mime-preview-original-major-mode'.
+ (mime-preview-scroll-down-entity): Use function
+ `mime-preview-original-major-mode'.
+ (mime-preview-quit): Use function
+ `mime-preview-original-major-mode'.
+ (mime-preview-show-summary): Use function
+ `mime-preview-original-major-mode'.
+
+ * mime-view.el (mime-view-display-message): New function; abolish
+ function `mime-view-setup-buffers'.
+ (mime-view-mode): Use `mime-view-display-message'.
+
+1998-06-10 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-play.el (mime-raw-play-entity): Use
+ `mime-entity-situation'.
+
+ * mime-view.el (mime-entity-situation): New function.
+ (mime-preview-multipart/alternative): Use `mime-entity-situation'.
+ (mime-view-display-entity): Use `mime-entity-situation'.
+
1998-06-10 MORIOKA Tomohiko <morioka@jaist.ac.jp>
* mime-edit.el (mime-edit-enclose-region-internal): Abolish unused
# Makefile for SEMI kernel.
#
-VERSION = 1.5.4
PACKAGE = semi
+VERSION = 1.6.0
SHELL = /bin/sh
MAKE = make
(iso-2022-jp 7 "base64")
(iso-2022-kr 7 "base64")
(euc-kr 8 "base64")
- (cn-gb2312 8 "quoted-printable")
+ (cn-gb2312 8 "base64")
+ (gb2312 8 "base64")
(cn-big5 8 "base64")
- (gb2312 8 "quoted-printable")
(big5 8 "base64")
+ (shift_jis 8 "base64")
(iso-2022-jp-2 7 "base64")
(iso-2022-int-1 7 "base64")
))
"A string formatted version of mime-transfer-level")
(make-variable-buffer-local 'mime-transfer-level-string)
-(defun mime-make-charset-default-encoding-alist (transfer-level)
- (mapcar (function
- (lambda (charset-type)
- (let ((charset (car charset-type))
- (type (nth 1 charset-type))
- (encoding (nth 2 charset-type))
- )
- (if (<= type transfer-level)
- (cons charset (mime-encoding-name type))
- (cons charset encoding)
- ))))
- mime-charset-type-list))
-
-(defvar mime-edit-charset-default-encoding-alist
- (mime-make-charset-default-encoding-alist mime-transfer-level))
-(make-variable-buffer-local 'mime-edit-charset-default-encoding-alist)
-
;;; @@ about message inserting
;;;
(defvar mime-edit-news-reply-mode-server-running nil)
-;;; @@ about PGP
-;;;
-
-(defvar mime-edit-signing-type 'pgp-mime
- "*PGP signing type (pgp-mime, pgp-kazu or nil).")
-
-(defvar mime-edit-encrypting-type 'pgp-mime
- "*PGP encrypting type (pgp-mime, pgp-kazu or nil).")
-
-
;;; @@ about tag
;;;
(define-key mime-edit-mode-enclosure-map
"\C-d" 'mime-edit-enclose-digest-region)
(define-key mime-edit-mode-enclosure-map
- "\C-s" 'mime-edit-enclose-signed-region)
+ "\C-s" 'mime-edit-enclose-pgp-signed-region)
(define-key mime-edit-mode-enclosure-map
- "\C-e" 'mime-edit-enclose-encrypted-region)
+ "\C-e" 'mime-edit-enclose-pgp-encrypted-region)
(define-key mime-edit-mode-enclosure-map
"\C-q" 'mime-edit-enclose-quote-region)
(parallel "Enclose as parallel" mime-edit-enclose-parallel-region)
(mixed "Enclose as serial" mime-edit-enclose-mixed-region)
(digest "Enclose as digest" mime-edit-enclose-digest-region)
- (signed "Enclose as signed" mime-edit-enclose-signed-region)
- (encrypted "Enclose as encrypted" mime-edit-enclose-encrypted-region)
+ (signed "Enclose as signed" mime-edit-enclose-pgp-signed-region)
+ (encrypted "Enclose as encrypted" mime-edit-enclose-pgp-encrypted-region)
(quote "Verbatim region" mime-edit-enclose-quote-region)
(key "Insert Public Key" mime-edit-insert-key)
(split "About split" mime-edit-set-split)
\\[mime-edit-insert-tag] insert a new MIME tag.
\[make enclosure (maybe multipart)\]
-\\[mime-edit-enclose-alternative-region] enclose as multipart/alternative.
-\\[mime-edit-enclose-parallel-region] enclose as multipart/parallel.
-\\[mime-edit-enclose-mixed-region] enclose as multipart/mixed.
-\\[mime-edit-enclose-digest-region] enclose as multipart/digest.
-\\[mime-edit-enclose-signed-region] enclose as PGP signed.
-\\[mime-edit-enclose-encrypted-region] enclose as PGP encrypted.
-\\[mime-edit-enclose-quote-region] enclose as verbose mode (to avoid to expand tags)
+\\[mime-edit-enclose-alternative-region] enclose as multipart/alternative.
+\\[mime-edit-enclose-parallel-region] enclose as multipart/parallel.
+\\[mime-edit-enclose-mixed-region] enclose as multipart/mixed.
+\\[mime-edit-enclose-digest-region] enclose as multipart/digest.
+\\[mime-edit-enclose-pgp-signed-region] enclose as PGP signed.
+\\[mime-edit-enclose-pgp-encrypted-region] enclose as PGP encrypted.
+\\[mime-edit-enclose-quote-region] enclose as verbose mode
+ (to avoid to expand tags)
\[other commands\]
\\[mime-edit-set-transfer-level-7bit] set transfer-level as 7.
\\[mime-edit-set-transfer-level-8bit] set transfer-level as 8.
-\\[mime-edit-set-split] set message splitting mode.
-\\[mime-edit-set-sign] set PGP-sign mode.
-\\[mime-edit-set-encrypt] set PGP-encryption mode.
-\\[mime-edit-preview-message] preview editing MIME message.
-\\[mime-edit-exit] exit and translate into a MIME compliant message.
-\\[mime-edit-help] show this help.
-\\[mime-edit-maybe-translate] exit and translate if in MIME mode, then split.
+\\[mime-edit-set-split] set message splitting mode.
+\\[mime-edit-set-sign] set PGP-sign mode.
+\\[mime-edit-set-encrypt] set PGP-encryption mode.
+\\[mime-edit-preview-message] preview editing MIME message.
+\\[mime-edit-exit] exit and translate into a MIME
+ compliant message.
+\\[mime-edit-help] show this help.
+\\[mime-edit-maybe-translate] exit and translate if in MIME mode,
+ then split.
Additional commands are available in some major modes:
C-c C-c exit, translate and run the original command.
(cond ((string-equal type "quote")
(mime-edit-enquote-region bb eb)
)
- ((string-equal type "signed")
- (cond ((eq mime-edit-signing-type 'pgp-mime)
- (mime-edit-sign-pgp-mime bb eb boundary)
- )
- ((eq mime-edit-signing-type 'pgp-kazu)
- (mime-edit-sign-pgp-kazu bb eb boundary)
- ))
+ ((string-equal type "pgp-signed")
+ (mime-edit-sign-pgp-mime bb eb boundary)
+ )
+ ((string-equal type "pgp-encrypted")
+ (mime-edit-encrypt-pgp-mime bb eb boundary)
+ )
+ ((string-equal type "kazu-signed")
+ (mime-edit-sign-pgp-kazu bb eb boundary)
+ )
+ ((string-equal type "kazu-encrypted")
+ (mime-edit-encrypt-pgp-kazu bb eb boundary)
)
- ((string-equal type "encrypted")
- (cond ((eq mime-edit-encrypting-type 'pgp-mime)
- (mime-edit-encrypt-pgp-mime bb eb boundary)
- )
- ((eq mime-edit-encrypting-type 'pgp-kazu)
- (mime-edit-encrypt-pgp-kazu bb eb boundary)
- )))
(t
(setq boundary
(nth 2 (mime-edit-translate-region bb eb
(let* ((ret
(mime-edit-translate-region beg end boundary))
(ctype (car ret))
- (encoding (nth 1 ret))
- (parts (nth 3 ret))
- )
+ (encoding (nth 1 ret)))
(goto-char beg)
(insert (format "Content-Type: %s\n" ctype))
(if encoding
(defun mime-edit-encrypt-pgp-kazu (beg end boundary)
(save-excursion
- (let (from recipients header)
+ (let (recipients header)
(let ((ret (mime-edit-make-encrypt-recipient-header)))
- (setq from (aref ret 0)
- recipients (aref ret 1)
+ (setq recipients (aref ret 1)
header (aref ret 2))
)
(save-restriction
(let* ((ret
(mime-edit-translate-region beg end boundary))
(ctype (car ret))
- (encoding (nth 1 ret))
- (parts (nth 3 ret))
- )
+ (encoding (nth 1 ret)))
(goto-char beg)
(insert header)
(insert (format "Content-Type: %s\n" ctype))
;; Define encoding and encode text if necessary.
(or encoding ;Encoding is not specified.
(let* ((encoding
- (cdr
- (assq charset
- mime-edit-charset-default-encoding-alist)
- ))
- (beg (mime-edit-content-beginning))
- )
+ (let (bits conv)
+ (let ((ret (cdr (assq charset mime-charset-type-list))))
+ (if ret
+ (setq bits (car ret)
+ conv (nth 1 ret))
+ (setq bits 8
+ conv "quoted-printable")))
+ (if (<= bits mime-transfer-level)
+ (mime-encoding-name bits)
+ conv)))
+ (beg (mime-edit-content-beginning)))
(encode-mime-charset-region beg (mime-edit-content-end)
charset)
;; Protect "From " in beginning of line
(mime-edit-enclose-region-internal 'alternative beg end)
)
-(defun mime-edit-enclose-signed-region (beg end)
+(defun mime-edit-enclose-pgp-signed-region (beg end)
(interactive "*r")
- (if mime-edit-signing-type
- (mime-edit-enclose-region-internal 'signed beg end)
- (message "Please specify signing type.")
- ))
+ (mime-edit-enclose-region-internal 'pgp-signed beg end)
+ )
-(defun mime-edit-enclose-encrypted-region (beg end)
+(defun mime-edit-enclose-pgp-encrypted-region (beg end)
(interactive "*r")
- (if mime-edit-signing-type
- (mime-edit-enclose-region-internal 'encrypted beg end)
- (message "Please specify encrypting type.")
- ))
+ (mime-edit-enclose-region-internal 'pgp-encrypted beg end)
+ )
+
+(defun mime-edit-enclose-kazu-signed-region (beg end)
+ (interactive "*r")
+ (mime-edit-enclose-region-internal 'kazu-signed beg end)
+ )
+
+(defun mime-edit-enclose-kazu-encrypted-region (beg end)
+ (interactive "*r")
+ (mime-edit-enclose-region-internal 'kazu-encrypted beg end)
+ )
(defun mime-edit-insert-key (&optional arg)
"Insert a pgp public key."
(setq mime-transfer-level 8)
(setq mime-transfer-level 7)
))
- (setq mime-edit-charset-default-encoding-alist
- (mime-make-charset-default-encoding-alist mime-transfer-level))
(message (format "Current transfer-level is %d bit"
mime-transfer-level))
(setq mime-transfer-level-string
;;; @ pgp
;;;
+(defvar mime-edit-pgp-processing nil)
+(make-variable-buffer-local 'mime-edit-pgp-processing)
+
(defun mime-edit-set-sign (arg)
(interactive
(list
(y-or-n-p "Do you want to sign? ")
))
(if arg
- (if mime-edit-signing-type
- (progn
- (setq mime-edit-pgp-processing 'sign)
- (message "This message will be signed.")
- )
- (message "Please specify signing type.")
+ (progn
+ (setq mime-edit-pgp-processing 'sign)
+ (message "This message will be signed.")
)
(if (eq mime-edit-pgp-processing 'sign)
(setq mime-edit-pgp-processing nil)
(y-or-n-p "Do you want to encrypt? ")
))
(if arg
- (if mime-edit-encrypting-type
- (progn
- (setq mime-edit-pgp-processing 'encrypt)
- (message "This message will be encrypt.")
- )
- (message "Please specify encrypting type.")
+ (progn
+ (setq mime-edit-pgp-processing 'encrypt)
+ (message "This message will be encrypt.")
)
(if (eq mime-edit-pgp-processing 'encrypt)
(setq mime-edit-pgp-processing nil)
(message "This message will not be encrypt.")
))
-(defvar mime-edit-pgp-processing nil)
-(make-variable-buffer-local 'mime-edit-pgp-processing)
-
(defun mime-edit-pgp-enclose-buffer ()
(let ((beg (save-excursion
(goto-char (point-min))
)
(if beg
(cond ((eq mime-edit-pgp-processing 'sign)
- (mime-edit-enclose-signed-region beg end)
+ (mime-edit-enclose-pgp-signed-region beg end)
)
((eq mime-edit-pgp-processing 'encrypt)
- (mime-edit-enclose-encrypted-region beg end)
+ (mime-edit-enclose-pgp-encrypted-region beg end)
))
)))
;;; Code:
(require 'mailcrypt)
-(load "mc-pgp")
+(eval-and-compile (load "mc-pgp"))
(defun mime-mc-pgp-generic-parser (result)
(let ((ret (mc-pgp-generic-parser result)))
(error "Fatal. Unsupported mode")
))))
-(defun mime-method-to-combine-message/partial-pieces (beg end cal)
+(defun mime-method-to-combine-message/partial-pieces (entity cal)
"Internal method for mime-view to combine message/partial messages
automatically. This function refers variable
`mime-view-partial-message-method-alist' to select function to display
(if (or (file-exists-p full-file)
(not (y-or-n-p "Merge partials?"))
)
- (mime-method-to-store-message/partial beg end cal)
+ (mime-method-to-store-message/partial entity cal)
(let (the-id parameters)
(setq subject-id (std11-field-body "Subject"))
(if (string-match "[0-9\n]+" subject-id)
(if (string= the-id id)
(progn
(mime-method-to-store-message/partial
- (mime-entity-point-min mime-raw-message-info)
- (mime-entity-point-max mime-raw-message-info)
- parameters)
+ mime-raw-message-info parameters)
(if (file-exists-p full-file)
(throw 'tag nil)
)
;;;
;;; It is based on draft-kazu-pgp-mime-00.txt (PGP-kazu).
-(defun mime-method-for-application/pgp (start end cal)
- (let* ((entity-number (mime-raw-point-to-entity-number start))
+(defun mime-method-for-application/pgp (entity cal)
+ (let* ((start (mime-entity-point-min entity))
+ (end (mime-entity-point-max entity))
+ (entity-number (mime-raw-point-to-entity-number start))
(p-win (or (get-buffer-window mime-preview-buffer)
(get-largest-window)))
(new-name (format "%s-%s" (buffer-name) entity-number))
;;;
;;; It is based on RFC 1847 (security-multipart).
-(defun mime-method-to-verify-multipart/signed (start end cal)
+(defun mime-method-to-verify-multipart/signed (entity cal)
"Internal method to verify multipart/signed."
(mime-raw-play-entity
- ;; entity-info of signature
- (mime-raw-find-entity-from-node-id
- ;; entity-node-id of signature
- (cons 1 (mime-raw-point-to-entity-node-id start)))
+ (nth 1 (mime-entity-children entity)) ; entity-info of signature
(cdr (assq 'mode cal)) ; play-mode
))
(t "Bad signature")))
))))
-(defun mime-method-to-verify-application/pgp-signature (start end cal)
+(defun mime-method-to-verify-application/pgp-signature (entity cal)
"Internal method to check PGP/MIME signature."
- (let* ((encoding (cdr (assq 'encoding cal)))
+ (let* ((start (mime-entity-point-min entity))
+ (end (mime-entity-point-max entity))
+ (encoding (cdr (assq 'encoding cal)))
(entity-node-id (mime-raw-point-to-entity-node-id start))
(mother-node-id (cdr entity-node-id))
(knum (car entity-node-id))
;;;
;;; It is based on RFC 2015 (PGP/MIME).
-(defun mime-method-to-decrypt-application/pgp-encrypted (start end cal)
- (let* ((entity-node-id (mime-raw-point-to-entity-node-id start))
+(defun mime-method-to-decrypt-application/pgp-encrypted (entity cal)
+ (let* ((entity-node-id (mime-entity-node-id entity))
(mother-node-id (cdr entity-node-id))
(knum (car entity-node-id))
(onum (if (> knum 0)
(1- knum)
(1+ knum)))
(oinfo (mime-raw-find-entity-from-node-id
- (cons onum mother-node-id) mime-raw-message-info))
- (obeg (mime-entity-point-min oinfo))
- (oend (mime-entity-point-max oinfo))
- )
- (mime-method-for-application/pgp obeg oend cal)
+ (cons onum mother-node-id) mime-raw-message-info)))
+ (mime-method-for-application/pgp oinfo cal)
))
;;;
;;; It is based on RFC 2015 (PGP/MIME).
-(defun mime-method-to-add-application/pgp-keys (start end cal)
- (let* ((entity-number (mime-raw-point-to-entity-number start))
+(defun mime-method-to-add-application/pgp-keys (entity cal)
+ (let* ((start (mime-entity-point-min entity))
+ (end (mime-entity-point-max entity))
+ (entity-number (mime-raw-point-to-entity-number start))
(new-name (format "%s-%s" (buffer-name) entity-number))
(encoding (cdr (assq 'encoding cal)))
str)
(interactive)
(or mode
(setq mode "play"))
- (let ((entity-info (get-text-property (point) 'mime-view-entity)))
- (if entity-info
+ (let ((entity (get-text-property (point) 'mime-view-entity)))
+ (if entity
(let ((the-buf (current-buffer))
(raw-buffer (get-text-property (point) 'mime-view-raw-buffer)))
(setq mime-preview-after-decoded-position (point))
(set-buffer raw-buffer)
- (mime-raw-play-entity entity-info mode)
+ (mime-raw-play-entity entity mode)
(when (eq (current-buffer) raw-buffer)
(set-buffer the-buf)
(goto-char mime-preview-after-decoded-position)
(setq situations (cdr situations)))
dest))
-(defun mime-raw-play-entity (entity-info &optional mode)
- "Play entity specified by ENTITY-INFO.
+(defun mime-raw-play-entity (entity &optional mode)
+ "Play entity specified by ENTITY.
It decodes the entity to call internal or external method. The method
is selected from variable `mime-acting-condition'. If MODE is
specified, play as it. Default MODE is \"play\"."
- (let ((beg (mime-entity-point-min entity-info))
- (end (mime-entity-point-max entity-info))
- (content-type (mime-entity-content-type entity-info))
- (encoding (mime-entity-encoding entity-info)))
- (or content-type
- (setq content-type (make-mime-content-type 'text 'plain)))
+ (let ((beg (mime-entity-point-min entity))
+ (end (mime-entity-point-max entity)))
(let (method cal ret)
- (setq cal (list* (cons 'major-mode major-mode)
- (cons 'encoding encoding)
- content-type))
+ (setq cal (mime-entity-situation entity))
(if mode
(setq cal (cons (cons 'mode mode) cal))
)
(setq method (cdr (assq 'method ret)))
(cond ((and (symbolp method)
(fboundp method))
- (funcall method beg end ret)
+ (funcall method entity ret)
)
((stringp method)
(mime-activate-mailcap-method beg end ret)
(mime-activate-external-method beg end ret)
)
(t
- (mime-show-echo-buffer
- "No method are specified for %s\n"
- (mime-type/subtype-string
- (mime-content-type-primary-type content-type)
- (mime-content-type-subtype content-type))
- )))
+ (mime-show-echo-buffer "No method are specified for %s\n"
+ (mime-entity-type/subtype entity))
+ ))
)))
;;; @ file extraction
;;;
-(defun mime-method-to-save (beg end cal)
- (goto-char beg)
- (let* ((name
- (save-restriction
- (narrow-to-region beg end)
- (mime-raw-get-filename cal)
- ))
- (encoding (or (cdr (assq 'encoding cal)) "7bit"))
- (filename
- (if (and name (not (string-equal name "")))
- (expand-file-name name
- (save-window-excursion
- (call-interactively
- (function
- (lambda (dir)
- (interactive "DDirectory: ")
- dir)))))
- (save-window-excursion
- (call-interactively
- (function
- (lambda (file)
- (interactive "FFilename: ")
- (expand-file-name file)))))))
- )
- (if (file-exists-p filename)
- (or (yes-or-no-p (format "File %s exists. Save anyway? " filename))
- (error "")))
- (re-search-forward "\n\n")
- (mime-write-decoded-region (match-end 0) end filename encoding)
- ))
+(defun mime-method-to-save (entity cal)
+ (let ((beg (mime-entity-point-min entity))
+ (end (mime-entity-point-max entity)))
+ (goto-char beg)
+ (let* ((name (save-restriction
+ (narrow-to-region beg end)
+ (mime-raw-get-filename cal)
+ ))
+ (encoding (or (cdr (assq 'encoding cal)) "7bit"))
+ (filename (if (and name (not (string-equal name "")))
+ (expand-file-name name
+ (save-window-excursion
+ (call-interactively
+ (function
+ (lambda (dir)
+ (interactive "DDirectory: ")
+ dir)))))
+ (save-window-excursion
+ (call-interactively
+ (function
+ (lambda (file)
+ (interactive "FFilename: ")
+ (expand-file-name file)))))))
+ )
+ (if (file-exists-p filename)
+ (or (yes-or-no-p (format "File %s exists. Save anyway? " filename))
+ (error "")))
+ (re-search-forward "\n\n")
+ (mime-write-decoded-region (match-end 0) end filename encoding)
+ )))
;;; @ mail/news message
(pop-to-buffer mother)
))
-(defun mime-method-to-display-message/rfc822 (beg end cal)
- (let* ((cnum (mime-raw-point-to-entity-number beg))
+(defun mime-method-to-display-message/rfc822 (entity cal)
+ (let* ((beg (mime-entity-point-min entity))
+ (end (mime-entity-point-max entity))
+ (cnum (mime-raw-point-to-entity-number beg))
(new-name (format "%s-%s" (buffer-name) cnum))
(mother mime-preview-buffer)
(representation-type
(write-region start end filename)
)))
-(defun mime-method-to-store-message/partial (beg end cal)
- (goto-char beg)
+(defun mime-method-to-store-message/partial (entity cal)
+ (goto-char (mime-entity-point-min entity))
(let* ((root-dir
(expand-file-name
(concat "m-prts-" (user-login-name)) mime-temp-directory))
(total (cdr (assoc "total" cal)))
file
(mother mime-preview-buffer)
- )
+ )
(or (file-exists-p root-dir)
(make-directory root-dir)
)
(re-search-forward "^$")
(goto-char (1+ (match-end 0)))
(setq file (concat root-dir "/" number))
- (mime-raw-write-region (point) end file)
+ (mime-raw-write-region (point) (mime-entity-point-max entity) file)
(let ((total-file (concat root-dir "/CT")))
(setq total
(if total
(setq i (1+ i))
))
(as-binary-output-file
- (write-region (point-min)(point-max)
- (expand-file-name "FULL" root-dir)))
+ (write-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)))
(dired dir)
))
-(defun mime-method-to-display-message/external-ftp (beg end cal)
+(defun mime-method-to-display-message/external-ftp (entity cal)
(let* ((site (cdr (assoc "site" cal)))
(directory (cdr (assoc "directory" cal)))
(name (cdr (assoc "name" cal)))
- ;;(mode (cdr (assoc "mode" cal)))
- (pathname (concat "/anonymous@" site ":" directory))
- )
+ (pathname (concat "/anonymous@" site ":" directory)))
(message (concat "Accessing " (expand-file-name name pathname) "..."))
(funcall mime-raw-dired-function pathname)
(goto-char (point-min))
;;; @ rot13-47
;;;
-(defun mime-method-to-display-caesar (start end cal)
+(defun mime-method-to-display-caesar (entity situation)
"Internal method for mime-view to display ROT13-47-48 message."
- (let* ((entity (mime-raw-find-entity-from-point start))
- (new-name (format "%s-%s" (buffer-name)
+ (let* ((new-name (format "%s-%s" (buffer-name)
(mime-entity-number entity)))
(mother mime-preview-buffer))
(let ((pwin (or (get-buffer-window mother)
"Raw buffer corresponding with the (MIME-preview) buffer.")
(make-variable-buffer-local 'mime-raw-buffer)
-(defvar mime-preview-original-major-mode nil
- "Major-mode of mime-raw-buffer.")
-(make-variable-buffer-local 'mime-preview-original-major-mode)
-
(defvar mime-preview-original-window-configuration nil
"Window-configuration before mime-view-mode is called.")
(make-variable-buffer-local 'mime-preview-original-window-configuration)
(setq children (cdr children)))
message-info))))
+
(defsubst mime-entity-parent (entity &optional message-info)
"Return mother entity of ENTITY.
If optional argument MESSAGE-INFO is not specified,
(set-buffer (mime-entity-buffer entity))
mime-raw-message-info))))
+(defsubst mime-entity-situation (entity)
+ "Return situation of ENTITY."
+ (append (or (mime-entity-content-type entity)
+ (make-mime-content-type 'text 'plain))
+ (list (cons 'encoding (mime-entity-encoding entity))
+ (cons 'major-mode
+ (save-excursion
+ (set-buffer (mime-entity-buffer entity))
+ major-mode)))
+ ))
+
+
+(defvar mime-view-uuencode-encoding-name-list '("x-uue" "x-uuencode"))
+
+(defun mime-raw-get-uu-filename ()
+ (save-excursion
+ (if (re-search-forward "^begin [0-9]+ " nil t)
+ (if (looking-at ".+$")
+ (buffer-substring (match-beginning 0)(match-end 0))
+ ))))
+
+(defun mime-raw-get-subject (entity)
+ (or (std11-find-field-body '("Content-Description" "Subject"))
+ (let ((ret (mime-entity-content-disposition entity)))
+ (and ret
+ (setq ret (mime-content-disposition-filename ret))
+ (std11-strip-quoted-string ret)
+ ))
+ (let ((ret (mime-entity-content-type entity)))
+ (and ret
+ (setq ret
+ (cdr
+ (let ((param (mime-content-type-parameters ret)))
+ (or (assoc "name" param)
+ (assoc "x-name" param))
+ )))
+ (std11-strip-quoted-string ret)
+ ))
+ (if (member (mime-entity-encoding entity)
+ mime-view-uuencode-encoding-name-list)
+ (mime-raw-get-uu-filename))
+ ""))
+
+
(defsubst mime-raw-point-to-entity-node-id (point &optional message-info)
"Return entity-node-id from POINT in mime-raw-buffer.
If optional argument MESSAGE-INFO is not specified,
(while children
(mime-view-display-entity (car children)
(save-excursion
- (set-buffer mime-raw-buffer)
+ (set-buffer (mime-entity-buffer entity))
mime-raw-message-info)
- mime-raw-buffer (current-buffer)
+ (current-buffer)
default-situation)
(setq children (cdr children))
)))
(let ((situation
(or (ctree-match-calist
mime-preview-condition
- (append
- (or (mime-entity-content-type child)
- (make-mime-content-type 'text 'plain))
- (list* (cons 'encoding
- (mime-entity-encoding child))
- (cons 'major-mode major-mode)
- default-situation)))
+ (append (mime-entity-situation child)
+ default-situation))
default-situation)))
(if (cdr (assq 'body-presentation-method situation))
(let ((score
children)))
(setq i 0)
(while children
- (let ((situation (car situations)))
- (mime-view-display-entity (car children)
+ (let ((child (car children))
+ (situation (car situations)))
+ (mime-view-display-entity child
(save-excursion
- (set-buffer mime-raw-buffer)
+ (set-buffer (mime-entity-buffer child))
mime-raw-message-info)
- mime-raw-buffer (current-buffer)
+ (current-buffer)
default-situation
(if (= i p)
situation
))))
-;;; @ miscellaneous
-;;;
-
-(defvar mime-view-uuencode-encoding-name-list '("x-uue" "x-uuencode"))
-
-
;;; @ buffer setup
;;;
-(defvar mime-view-redisplay nil)
-
-(defun mime-view-setup-buffers (&optional ctl encoding ibuf obuf)
- (if ibuf
- (progn
- (get-buffer ibuf)
- (set-buffer ibuf)
- ))
- (or mime-view-redisplay
- (setq mime-raw-message-info (mime-parse-message ctl encoding))
- )
- (let ((message-info mime-raw-message-info)
- (the-buf (current-buffer))
- (mode major-mode))
- (or obuf
- (setq obuf (concat "*Preview-" (buffer-name the-buf) "*")))
- (set-buffer (get-buffer-create obuf))
- (let ((inhibit-read-only t))
- ;;(setq buffer-read-only nil)
- (widen)
- (erase-buffer)
- (setq mime-raw-buffer the-buf)
- (setq mime-preview-original-major-mode mode)
- (setq major-mode 'mime-view-mode)
- (setq mode-name "MIME-View")
- (mime-view-display-entity message-info message-info
- the-buf obuf
- '((entity-button . invisible)
- (header . visible)
- ))
- (set-buffer-modified-p nil)
- )
- (setq buffer-read-only t)
- (set-buffer the-buf)
- )
- (setq mime-preview-buffer obuf)
- )
-
-(defun mime-view-display-entity (entity message-info ibuf obuf
+(defun mime-view-display-entity (entity message-info obuf
default-situation
&optional situation)
- (let* ((start (mime-entity-point-min entity))
+ (let* ((raw-buffer (mime-entity-buffer entity))
+ (start (mime-entity-point-min entity))
(end (mime-entity-point-max entity))
- (content-type (mime-entity-content-type entity))
- (encoding (mime-entity-encoding entity))
- end-of-header e nb ne subj)
- (set-buffer ibuf)
+ original-major-mode end-of-header e nb ne subj)
+ (set-buffer raw-buffer)
+ (setq original-major-mode major-mode)
(goto-char start)
(setq end-of-header (if (re-search-forward "^$" nil t)
(1+ (match-end 0))
(or situation
(setq situation
(or (ctree-match-calist mime-preview-condition
- (append
- (or content-type
- (make-mime-content-type
- 'text 'plain))
- (list* (cons 'encoding encoding)
- (cons 'major-mode major-mode)
- default-situation)))
+ (append (mime-entity-situation entity)
+ default-situation))
default-situation)))
(let ((button-is-invisible
(eq (cdr (assq 'entity-button situation)) 'invisible))
(if header-is-visible
(save-restriction
(narrow-to-region (point)(point))
- (insert-buffer-substring mime-raw-buffer start end-of-header)
- (let ((f (cdr (assq mime-preview-original-major-mode
+ (insert-buffer-substring raw-buffer start end-of-header)
+ (let ((f (cdr (assq original-major-mode
mime-view-content-header-filter-alist))))
(if (functionp f)
(funcall f)
(let ((body-filter (cdr (assq 'body-filter situation))))
(save-restriction
(narrow-to-region (point-max)(point-max))
- (insert-buffer-substring mime-raw-buffer end-of-header end)
+ (insert-buffer-substring raw-buffer end-of-header end)
(funcall body-filter situation)
)))
(children)
))
(setq ne (point-max))
(widen)
- (put-text-property nb ne 'mime-view-raw-buffer ibuf)
+ (put-text-property nb ne 'mime-view-raw-buffer raw-buffer)
(put-text-property nb ne 'mime-view-entity entity)
(goto-char ne)
(if children
))
)))
-(defun mime-raw-get-uu-filename ()
- (save-excursion
- (if (re-search-forward "^begin [0-9]+ " nil t)
- (if (looking-at ".+$")
- (buffer-substring (match-beginning 0)(match-end 0))
- ))))
-
-(defun mime-raw-get-subject (entity)
- (or (std11-find-field-body '("Content-Description" "Subject"))
- (let ((ret (mime-entity-content-disposition entity)))
- (and ret
- (setq ret (mime-content-disposition-filename ret))
- (std11-strip-quoted-string ret)
- ))
- (let ((ret (mime-entity-content-type entity)))
- (and ret
- (setq ret
- (cdr
- (let ((param (mime-content-type-parameters ret)))
- (or (assoc "name" param)
- (assoc "x-name" param))
- )))
- (std11-strip-quoted-string ret)
- ))
- (if (member (mime-entity-encoding entity)
- mime-view-uuencode-encoding-name-list)
- (mime-raw-get-uu-filename))
- ""))
-
;;; @ MIME viewer mode
;;;
(bury-buffer buf)
))))
-(defun mime-view-mode (&optional mother ctl encoding ibuf obuf
+(defvar mime-view-redisplay nil)
+
+(defun mime-view-display-message (message &optional preview-buffer
+ mother default-keymap-or-function)
+ (mime-maybe-hide-echo-buffer)
+ (let ((win-conf (current-window-configuration))
+ (raw-buffer (mime-entity-buffer message)))
+ (or preview-buffer
+ (setq preview-buffer
+ (concat "*Preview-" (buffer-name raw-buffer) "*")))
+ (set-buffer raw-buffer)
+ (setq mime-raw-message-info (mime-parse-message))
+ (setq mime-preview-buffer preview-buffer)
+ (let ((inhibit-read-only t))
+ (switch-to-buffer preview-buffer)
+ (widen)
+ (erase-buffer)
+ (setq mime-raw-buffer raw-buffer)
+ (if 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")
+ (mime-view-display-entity message message
+ preview-buffer
+ '((entity-button . invisible)
+ (header . visible)
+ ))
+ (mime-view-define-keymap default-keymap-or-function)
+ (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)
+ ))
+ (run-hooks 'mime-view-mode-hook)
+ ))
+ (set-buffer-modified-p nil)
+ (setq buffer-read-only t)
+ )
+
+(defun mime-view-buffer (&optional raw-buffer preview-buffer mother
+ default-keymap-or-function)
+ (interactive)
+ (mime-view-display-message
+ (save-excursion
+ (if raw-buffer (set-buffer raw-buffer))
+ (mime-parse-message)
+ )
+ preview-buffer mother default-keymap-or-function))
+
+(defun mime-view-mode (&optional mother ctl encoding
+ raw-buffer preview-buffer
default-keymap-or-function)
"Major mode for viewing MIME message.
and decode current content as `play mode'
"
(interactive)
- (mime-maybe-hide-echo-buffer)
- (let ((ret (mime-view-setup-buffers ctl encoding ibuf obuf))
- (win-conf (current-window-configuration))
- )
- (prog1
- (switch-to-buffer ret)
- (setq mime-preview-original-window-configuration win-conf)
- (if mother
- (progn
- (setq mime-mother-buffer mother)
- ))
- (mime-view-define-keymap default-keymap-or-function)
- (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)
- ))
- (run-hooks 'mime-view-mode-hook)
- )))
+ (mime-view-display-message
+ (save-excursion
+ (if raw-buffer (set-buffer raw-buffer))
+ (or mime-view-redisplay
+ (mime-parse-message ctl encoding))
+ )
+ preview-buffer mother default-keymap-or-function))
;;; @@ playing
;;; @@ following
;;;
-(defun mime-preview-original-major-mode ()
+(defun mime-preview-original-major-mode (&optional recursive)
"Return major-mode of original buffer.
If a current buffer has mime-mother-buffer, return original major-mode
of the mother-buffer."
- (if mime-mother-buffer
+ (if (and recursive mime-mother-buffer)
(save-excursion
(set-buffer mime-mother-buffer)
- (mime-preview-original-major-mode)
+ (mime-preview-original-major-mode recursive)
)
- mime-preview-original-major-mode))
+ (save-excursion
+ (set-buffer
+ (mime-entity-buffer
+ (get-text-property (point-min) 'mime-view-entity)))
+ major-mode)))
(defun mime-preview-follow-current-entity ()
"Write follow message to current entity.
(setq p-end (point-max))
))
))
- (let* ((mode (mime-preview-original-major-mode))
+ (let* ((mode (mime-preview-original-major-mode 'recursive))
(new-name
(format "%s-%s" (buffer-name) (reverse entity-node-id)))
new-buf
(goto-char (1- point))
(mime-preview-move-to-previous)
)
- (let ((f (assq mime-preview-original-major-mode
+ (let ((f (assq (mime-preview-original-major-mode)
mime-view-over-to-previous-method-alist)))
(if f
(funcall (cdr f))
(if (null (get-text-property point 'mime-view-entity))
(mime-preview-move-to-next)
))
- (let ((f (assq mime-preview-original-major-mode
+ (let ((f (assq (mime-preview-original-major-mode)
mime-view-over-to-next-method-alist)))
(if f
(funcall (cdr f))
(setq h (1- (window-height)))
)
(if (= (point) (point-max))
- (let ((f (assq mime-preview-original-major-mode
+ (let ((f (assq (mime-preview-original-major-mode)
mime-view-over-to-next-method-alist)))
(if f
(funcall (cdr f))
(setq h (1- (window-height)))
)
(if (= (point) (point-min))
- (let ((f (assq mime-preview-original-major-mode
- mime-view-over-to-previous-method-alist)))
+ (let ((f (assq (mime-preview-original-major-mode)
+ mime-view-over-to-previous-method-alist)))
(if f
(funcall (cdr f))
))
- (let (point)
- (save-excursion
- (catch 'tag
- (while (not (bobp))
- (if (setq point
- (previous-single-property-change (point)
- 'mime-view-entity))
- (throw 'tag t)
- )
- (backward-char)
- )
- (setq point (point-min))
- ))
+ (let ((point
+ (or (previous-single-property-change (point) 'mime-view-entity)
+ (point-min))))
(forward-line (- h))
(if (< (point) point)
(goto-char point)
It calls function registered in variable
`mime-preview-quitting-method-alist'."
(interactive)
- (let ((r (assq mime-preview-original-major-mode
+ (let ((r (assq (mime-preview-original-major-mode)
mime-preview-quitting-method-alist)))
(if r
(funcall (cdr r))
It calls function registered in variable
`mime-view-show-summary-method'."
(interactive)
- (let ((r (assq mime-preview-original-major-mode
+ (let ((r (assq (mime-preview-original-major-mode)
mime-view-show-summary-method)))
(if r
(funcall (cdr r))
,keymap)
)
+(defmacro mime-save-background-color (&rest body)
+ (if (featurep 'xemacs)
+ `(let ((color (color-name (face-background 'default))))
+ (prog1
+ (progn ,@body)
+ (font-set-face-background 'default color
+ (get-buffer gnus-article-buffer))
+ ))
+ (cons 'progn body)))
+
(defun mime-preview-text/html (entity situation)
- (save-restriction
- (narrow-to-region (point-max)(point-max))
- (mime-text-insert-decoded-body entity)
- (let ((beg (point-min)))
- (remove-text-properties beg (point-max) '(face nil))
- (w3-region beg (point-max))
- (mime-put-keymap-region beg (point-max) w3-mode-map)
- )))
+ (mime-save-background-color
+ (save-restriction
+ (narrow-to-region (point-max)(point-max))
+ (mime-text-insert-decoded-body entity)
+ (let ((beg (point-min)))
+ (remove-text-properties beg (point-max) '(face nil))
+ (w3-region beg (point-max))
+ (mime-put-keymap-region beg (point-max) w3-mode-map)
+ ))))
;;; @ end
(eval-when-compile (require 'cl))
-(defconst mime-module-version '("SEMI" "Namerikawa" 1 5 5)
+(defconst mime-module-version '("SEMI" "Namerikawa" 1 6 0)
"Implementation name, version name and numbers of MIME-kernel package.")
(autoload 'mule-caesar-region "mule-caesar"