X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mime-def.el;h=8b21591caaca78da3a484b710cb1fd5e64481fdc;hb=dc057a908a10a53dd190af93208142a7319aa9a3;hp=85c98dd96450989fa6a2f97d17c3acbf394a6662;hpb=f0bba8bd6b19da245749c711ba6bfff6ed61b06a;p=elisp%2Fflim.git diff --git a/mime-def.el b/mime-def.el index 85c98dd..8b21591 100644 --- a/mime-def.el +++ b/mime-def.el @@ -25,7 +25,11 @@ ;;; Code: (defconst mime-spadework-module-version-string - "FLIM 1.1.1 - \"Kamitoba-guchi\"") + "Chao 1.3.0 - \"Kuinabashi\"") + + +;;; @ variables +;;; (require 'custom) @@ -37,6 +41,20 @@ (custom-handle-keyword 'default-mime-charset :group 'mime 'custom-variable) +(defcustom mime-temp-directory (or (getenv "MIME_TMP_DIR") + (getenv "TM_TMP_DIR") + (getenv "TMPDIR") + (getenv "TMP") + (getenv "TEMP") + "/tmp/") + "*Directory for temporary files." + :group 'mime + :type 'directory) + + +;;; @ required functions +;;; + (unless (fboundp 'butlast) (defun butlast (x &optional n) "Returns a copy of LIST with the last N elements removed." @@ -59,8 +77,29 @@ (substring string (match-end 0)) string)) +(defsubst regexp-* (regexp) + (concat regexp "*")) + +(defsubst regexp-or (&rest args) + (concat "\\(" (mapconcat (function identity) args "\\|") "\\)")) + -;;; @ definitions about MIME +;;; @ about STD 11 +;;; + +(defconst std11-quoted-pair-regexp "\\\\.") +(defconst std11-non-qtext-char-list '(?\" ?\\ ?\r ?\n)) +(defconst std11-qtext-regexp + (concat "[^" (char-list-to-string std11-non-qtext-char-list) "]")) +(defconst std11-quoted-string-regexp + (concat "\"" + (regexp-* + (regexp-or std11-qtext-regexp std11-quoted-pair-regexp) + ) + "\"")) + + +;;; @ about MIME ;;; (defconst mime-tspecials "][()<>@,\;:\\\"/?=") @@ -81,6 +120,17 @@ "][" quoted-printable-hex-chars "]")) +;;; @ utility +;;; + +(defsubst mime-type/subtype-string (type &optional subtype) + "Return type/subtype string from TYPE and SUBTYPE." + (if type + (if subtype + (format "%s/%s" type subtype) + (format "%s" type)))) + + ;;; @ end ;;;