X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=tiny-mime.el;h=7bc4bb7b8a1d7a66dbc20e26a78b472aa176dc3c;hb=f0a284c80bae5a16a58fe2f6c542c4e4d3002969;hp=434b2c3deae9c0d70539b6a7388f6869031b27d5;hpb=83545c0017fdbc9bf61032c5d5e80a7555483fbe;p=elisp%2Ftm.git diff --git a/tiny-mime.el b/tiny-mime.el index 434b2c3..7bc4bb7 100644 --- a/tiny-mime.el +++ b/tiny-mime.el @@ -14,13 +14,14 @@ (require 'mel) (require 'tl-header) (require 'tl-str) +(require 'tm-def) ;;; @ version ;;; (defconst mime/RCS-ID - "$Id: tiny-mime.el,v 6.2 1995/08/27 19:05:07 morioka Exp $") + "$Id: tiny-mime.el,v 6.7 1995/09/20 12:17:28 morioka Exp $") (defconst mime/tiny-mime-version (get-version-string mime/RCS-ID)) @@ -28,32 +29,7 @@ ;;; @ MIME encoded-word definition ;;; -(defconst mime/tspecials "][\000-\040()<>@,\;:\\\"/?.=") -(defconst mime/token-regexp (concat "[^" mime/tspecials "]+")) -(defconst mime/charset-regexp mime/token-regexp) (defconst mime/encoded-text-regexp "[!->@-~]+") - -(defconst mime/Base64-token-regexp "[A-Za-z0-9+/=]") -(defconst mime/Base64-encoded-text-regexp - (concat "\\(" - mime/Base64-token-regexp - mime/Base64-token-regexp - mime/Base64-token-regexp - mime/Base64-token-regexp - "\\)+")) -(defconst mime/Base64-encoding-and-encoded-text-regexp - (concat "\\(B\\)\\?" mime/Base64-encoded-text-regexp)) - -(defconst mime/Quoted-Printable-hex-char-regexp "[0123456789ABCDEF]") -(defconst mime/Quoted-Printable-octet-regexp - (concat "=" - mime/Quoted-Printable-hex-char-regexp - mime/Quoted-Printable-hex-char-regexp)) -(defconst mime/Quoted-Printable-encoded-text-regexp - (concat "\\([^=?]\\|" mime/Quoted-Printable-octet-regexp "\\)+")) -(defconst mime/Quoted-Printable-encoding-and-encoded-text-regexp - (concat "\\(Q\\)\\?" mime/Quoted-Printable-encoded-text-regexp)) - (defconst mime/encoded-word-regexp (concat (regexp-quote "=?") "\\(" mime/charset-regexp @@ -95,15 +71,6 @@ (defvar mime/use-X-Nsubject nil) -;;; @ compatible module among Mule, NEmacs and NEpoch -;;; - -(cond ((boundp 'MULE) (require 'tm-mule)) - ((boundp 'NEMACS)(require 'tm-nemacs)) - (t (require 'tm-orig)) - ) - - ;;; @ Application Interface ;;; @@ -226,6 +193,11 @@ )) )) +(defun mime/exist-encoded-word-in-subject () + (let ((str (message/get-field-body "Subject"))) + (if (and str (string-match mime/encoded-word-regexp str)) + str))) + (defun mime/encode-message-header () (interactive "*") (save-excursion @@ -251,20 +223,12 @@ ))) )) (if mime/use-X-Nsubject - (progn - (goto-char (point-min)) - (if (re-search-forward "^Subject:.*\\(\n\\s +.*\\)*" nil t) - (let ((str (buffer-substring (match-beginning 0) - (match-end 0)))) - (if (string-match mime/encoded-word-regexp str) - (insert (concat - "\nX-Nsubject: " - (nth 1 (message/divide-field - (mime/decode-string - (message/unfolding-string str)) - )))) - )) - ))) + (let ((str (mime/exist-encoded-word-in-subject))) + (if str + (insert (concat + "\nX-Nsubject: " + (mime/decode-string (message/unfolding-string str)) + ))))) ))) @@ -653,15 +617,7 @@ (let (field beg end) (while (re-search-forward message/field-name-regexp nil t) (setq beg (match-beginning 0)) - (setq end (progn - (if (re-search-forward "\n[!-9;-~]+:" nil t) - (goto-char (match-beginning 0)) - (if (re-search-forward "^$" nil t) - (goto-char (1- (match-beginning 0))) - (end-of-line) - )) - (point) - )) + (setq end (message/field-end)) (setq field (buffer-substring beg end)) (if (string-match mime/encoded-word-regexp field) (save-restriction