X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mime-edit.el;h=70deaafb9c4d7fe837da23af5f97e2d57d3eb66f;hb=b2be40207f110c3cebbfe9a263774843942b4933;hp=f526fbb33619492b9e0a0e4f5a9c7002b4f08bc8;hpb=41197d6b1260b4fddba54dbd8babdb50044598b2;p=elisp%2Fsemi.git diff --git a/mime-edit.el b/mime-edit.el index f526fbb..70deaaf 100644 --- a/mime-edit.el +++ b/mime-edit.el @@ -7,7 +7,7 @@ ;; Maintainer: MORIOKA Tomohiko ;; Created: 1994/08/21 renamed from mime.el ;; Renamed: 1997/2/21 from tm-edit.el -;; Version: $Revision: 0.85 $ +;; Version: $Revision: 0.92 $ ;; Keywords: MIME, multimedia, multilingual, mail, news ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces). @@ -122,13 +122,13 @@ ;;; (defconst mime-edit-RCS-ID - "$Id: mime-edit.el,v 0.85 1997-07-05 17:18:02 morioka Exp $") + "$Id: mime-edit.el,v 0.92 1997-10-02 07:48:02 morioka Exp $") (defconst mime-edit-version `,(get-version-string mime-edit-RCS-ID)) (defconst mime-edit-version-name `,(concat "SEMI MIME-Edit " mime-edit-version - " \"" semi-version-name "\"")) + " - \"" semi-version-name "\"")) ;;; @ variables @@ -149,7 +149,7 @@ If non-nil, the text tag is not inserted unless something different.") (defvar mime-edit-voice-recorder (function mime-edit-voice-recorder-for-sun) - "*Function to record a voice message and encode it. [mime-edit.el]") + "*Function to record a voice message and encode it.") (defvar mime-edit-mode-hook nil "*Hook called when enter MIME mode.") @@ -424,7 +424,7 @@ If encoding is nil, it is determined from its contents.") "Xref" "X-UIDL" "X-Filter" "X-Gnus-.*" "X-VM-.*") "Delete these fields from original message when it is inserted as message/rfc822 part. -Each elements are regexp of field-name. [mime-edit.el]") +Each elements are regexp of field-name.") (defvar mime-edit-yank-ignored-field-regexp (concat "^" @@ -439,16 +439,16 @@ Each elements are regexp of field-name. [mime-edit.el]") ;;; (defvar mime-edit-split-message t - "*Split large message if it is non-nil. [mime-edit.el]") + "*Split large message if it is non-nil.") (defvar mime-edit-message-default-max-lines 1000 - "*Default maximum lines of a message. [mime-edit.el]") + "*Default maximum lines of a message.") (defvar mime-edit-message-max-lines-alist '((news-reply-mode . 500)) "Alist of major-mode vs maximum lines of a message. If it is not specified for a major-mode, -`mime-edit-message-default-max-lines' is used. [mime-edit.el]") +`mime-edit-message-default-max-lines' is used.") (defconst mime-edit-split-ignored-field-regexp "\\(^Content-\\|^Subject:\\|^Mime-Version:\\)") @@ -465,10 +465,10 @@ If it is not specified for a major-mode, ;;; (defvar mime-edit-signing-type 'pgp-elkins - "*PGP signing type (pgp-elkins, pgp-kazu or nil). [mime-edit.el]") + "*PGP signing type (pgp-elkins, pgp-kazu or nil).") (defvar mime-edit-encrypting-type 'pgp-elkins - "*PGP encrypting type (pgp-elkins, pgp-kazu or nil). [mime-edit.el]") + "*PGP encrypting type (pgp-elkins, pgp-kazu or nil).") ;;; @@ about tag @@ -519,17 +519,22 @@ If it is not specified for a major-mode, "*If non-nil, insert X-Emacs header field.") (defvar mime-edit-x-emacs-value - (if running-xemacs - (concat emacs-version - (if (featurep 'mule) - " with mule" - " without mule")) + (if (featurep 'xemacs) + (concat emacs-version (if (featurep 'mule) + " with mule" + " without mule")) (let ((ver (if (string-match "\\.[0-9]+$" emacs-version) (substring emacs-version 0 (match-beginning 0)) emacs-version))) (if (featurep 'mule) - (concat "Emacs " ver ", MULE " mule-version) - ver)))) + (concat "Emacs " ver ", MULE " mule-version + (if (featurep 'meadow) + (concat ", " (Meadow-version)) + )) + ver))) + "Body of X-Emacs field. +If variable `mime-edit-insert-x-emacs-field' is not nil, it is +inserted into message header.") ;;; @ constants @@ -543,6 +548,10 @@ Tspecials means any character that matches with it in header must be quoted.") (concat "1.0 (generated by " mime-edit-version-name ")") "MIME version number.") +(defconst mime-edit-mime-version-field-for-message/partial + (concat "MIME-Version: 1.0 (split by " mime-edit-version-name ")\n") + "MIME version field for message/partial.") + ;;; @ keymap and menu ;;; @@ -940,7 +949,7 @@ Charset is automatically obtained from the `charsets-mime-charset-alist'." (insert "\n") (forward-char -1) )) - (if (and (member (second ret) '("enriched" "richtext")) + (if (and (member (cadr ret) '("enriched" "richtext")) (fboundp 'enriched-mode) ) (enriched-mode t) @@ -1450,7 +1459,7 @@ Parameter must be '(PROMPT CHOICE1 (CHOISE2 ...))." )) (defun mime-prompt-for-encoding (default) - "Ask for Content-Transfer-Encoding. [mime-edit.el]" + "Ask for Content-Transfer-Encoding." (let (encoding) (while (string= (setq encoding @@ -1809,7 +1818,7 @@ Content-Transfer-Encoding: 7bit (insert mime-edit-x-emacs-value) )) ;; Make primary MIME headers. - (or (mail-position-on-field "Mime-Version") + (or (mail-position-on-field "MIME-Version") (insert mime-edit-mime-version-value)) ;; Remove old Content-Type and other fields. (save-restriction @@ -2044,7 +2053,7 @@ Content-Transfer-Encoding: 7bit (defun mime-edit-voice-recorder-for-sun (encoding) "Record voice in a buffer using Sun audio device, -and insert data encoded as ENCODING. [mime-edit.el]" +and insert data encoded as ENCODING." (message "Start the recording on %s. Type C-g to finish the recording..." (system-name)) (mime-insert-encoded-file "/dev/audio" encoding) @@ -2278,12 +2287,11 @@ Optional TRANSFER-LEVEL is a number of transfer-level, 7 or 8." ;;; @ split ;;; -(defun mime-edit-insert-partial-header - (fields subject id number total separator) +(defun mime-edit-insert-partial-header (fields subject + id number total separator) (insert fields) (insert (format "Subject: %s (%d/%d)\n" subject number total)) - (insert (format "Mime-Version: 1.0 (split by %s)\n" - mime-edit-version-name)) + (insert mime-edit-mime-version-field-for-message/partial) (insert (format "\ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" id number total separator)) @@ -2409,7 +2417,7 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" (defvar mime-edit-buffer nil) ; buffer local variable (defun mime-edit-preview-message () - "preview editing MIME message. [mime-edit.el]" + "preview editing MIME message." (interactive) (let* ((str (buffer-string)) (separator mail-header-separator) @@ -2472,23 +2480,17 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" (defun mime-edit-decode-buffer (not-decode-text) (save-excursion (goto-char (point-min)) - (let ((ctl (mime/Content-Type))) + (let ((ctl (mime-read-Content-Type))) (if ctl - (let ((ctype (car ctl)) - (params (cdr ctl)) - type stype) - (if (string-match "/" ctype) - (progn - (setq type (substring ctype 0 (match-beginning 0))) - (setq stype (substring ctype (match-end 0))) - ) - (setq type ctype) - ) + (let ((type (car ctl)) + (stype (car (cdr ctl))) + (params (cdr (cdr ctl))) + ) (cond - ((string= ctype "application/pgp-signature") + ((and (eq type 'application)(eq stype 'pgp-signature)) (delete-region (point-min)(point-max)) ) - ((string= type "multipart") + ((eq type 'multipart) (let* ((boundary (cdr (assoc "boundary" params))) (boundary-pat (concat "\n--" (regexp-quote boundary) "[ \t]*\n")) @@ -2531,12 +2533,13 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" ))) )) (t - (let* (charset + (let* ((ctype (format "%s/%s" type stype)) + charset (pstr (let ((bytes (+ 14 (length ctype)))) (mapconcat (function (lambda (attr) - (if (string-equal (car attr) "charset") + (if (string= (car attr) "charset") (progn (setq charset (cdr attr)) "") @@ -2566,7 +2569,7 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" (eliminate-top-spaces (std11-unfold-string (buffer-substring hbeg end)))) - (if (or charset (string-equal type "text")) + (if (or charset (eq type 'text)) (progn (delete-region beg (1+ end)) (goto-char (point-min)) @@ -2593,12 +2596,14 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" (insert (concat "\n" (mime-create-tag - (concat type "/" stype pstr) encoding))) + (format "%s/%s%s" type stype pstr) + encoding))) ) (delete-region (point-min) he) (insert (mime-create-tag - (concat type "/" stype pstr) encoding)) + (format "%s/%s%s" type stype pstr) + encoding)) )) )))) (or not-decode-text