From 4750b31c6a8e69a818b7f21c207c42b0ee6a7a81 Mon Sep 17 00:00:00 2001 From: tsuchiya Date: Wed, 9 Jan 2002 06:04:19 +0000 Subject: [PATCH] * lisp/nneething.el (nneething-mime-extensions): New variable. (nneething-request-article): Refer it. * lisp/nnheader.el (mm-detect-coding-region): Alias to `nnheader-detect-coding-region'. (nnheader-detect-coding-region): New function. (mm-detect-mime-charset-region): Alias to `nnheader-detect-mime-charset-region'. (nnheader-detect-mime-charset-region) New function. --- ChangeLog | 12 +++++++ lisp/nneething.el | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++- lisp/nnheader.el | 18 +++++++++- 3 files changed, 129 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36fe2a6..a13ee16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-01-09 TSUCHIYA Masatoshi + + * lisp/nneething.el (nneething-mime-extensions): New variable. + (nneething-request-article): Refer it. + + * lisp/nnheader.el (mm-detect-coding-region): Alias to + `nnheader-detect-coding-region'. + (nnheader-detect-coding-region): New function. + (mm-detect-mime-charset-region): Alias to + `nnheader-detect-mime-charset-region'. + (nnheader-detect-mime-charset-region) New function. + 2002-01-08 TSUCHIYA Masatoshi * texi/gnus-ja.texi (Web Newspaper): Update the document of diff --git a/lisp/nneething.el b/lisp/nneething.el index a5c3c2d..ef8df92 100644 --- a/lisp/nneething.el +++ b/lisp/nneething.el @@ -73,6 +73,103 @@ included.") (defvoo nneething-active nil) (defvoo nneething-address nil) +(defvar nneething-mime-extensions + '(("" . "text/plain") + (".abs" . "audio/x-mpeg") + (".aif" . "audio/aiff") + (".aifc" . "audio/aiff") + (".aiff" . "audio/aiff") + (".ano" . "application/x-annotator") + (".au" . "audio/ulaw") + (".avi" . "video/x-msvideo") + (".bcpio" . "application/x-bcpio") + (".bin" . "application/octet-stream") + (".cdf" . "application/x-netcdr") + (".cpio" . "application/x-cpio") + (".csh" . "application/x-csh") + (".css" . "text/css") + (".dvi" . "application/x-dvi") + (".diff" . "text/x-patch") + (".el" . "application/emacs-lisp") + (".eps" . "application/postscript") + (".etx" . "text/x-setext") + (".exe" . "application/octet-stream") + (".fax" . "image/x-fax") + (".gif" . "image/gif") + (".hdf" . "application/x-hdf") + (".hqx" . "application/mac-binhex40") + (".htm" . "text/html") + (".html" . "text/html") + (".icon" . "image/x-icon") + (".ief" . "image/ief") + (".jpg" . "image/jpeg") + (".macp" . "image/x-macpaint") + (".man" . "application/x-troff-man") + (".me" . "application/x-troff-me") + (".mif" . "application/mif") + (".mov" . "video/quicktime") + (".movie" . "video/x-sgi-movie") + (".mp2" . "audio/x-mpeg") + (".mp3" . "audio/x-mpeg") + (".mp2a" . "audio/x-mpeg2") + (".mpa" . "audio/x-mpeg") + (".mpa2" . "audio/x-mpeg2") + (".mpe" . "video/mpeg") + (".mpeg" . "video/mpeg") + (".mpega" . "audio/x-mpeg") + (".mpegv" . "video/mpeg") + (".mpg" . "video/mpeg") + (".mpv" . "video/mpeg") + (".ms" . "application/x-troff-ms") + (".nc" . "application/x-netcdf") + (".nc" . "application/x-netcdf") + (".oda" . "application/oda") + (".patch" . "text/x-patch") + (".pbm" . "image/x-portable-bitmap") + (".pdf" . "application/pdf") + (".pgm" . "image/portable-graymap") + (".pict" . "image/pict") + (".png" . "image/png") + (".pnm" . "image/x-portable-anymap") + (".ppm" . "image/portable-pixmap") + (".ps" . "application/postscript") + (".qt" . "video/quicktime") + (".ras" . "image/x-raster") + (".rgb" . "image/x-rgb") + (".rtf" . "application/rtf") + (".rtx" . "text/richtext") + (".sh" . "application/x-sh") + (".sit" . "application/x-stuffit") + (".siv" . "application/sieve") + (".snd" . "audio/basic") + (".src" . "application/x-wais-source") + (".tar" . "archive/tar") + (".tcl" . "application/x-tcl") + (".tex" . "application/x-tex") + (".texi" . "application/texinfo") + (".tga" . "image/x-targa") + (".tif" . "image/tiff") + (".tiff" . "image/tiff") + (".tr" . "application/x-troff") + (".troff" . "application/x-troff") + (".tsv" . "text/tab-separated-values") + (".txt" . "text/plain") + (".vbs" . "video/mpeg") + (".vox" . "audio/basic") + (".vrml" . "x-world/x-vrml") + (".wav" . "audio/x-wav") + (".xls" . "application/vnd.ms-excel") + (".wrl" . "x-world/x-vrml") + (".xbm" . "image/xbm") + (".xpm" . "image/xpm") + (".xwd" . "image/windowdump") + (".zip" . "application/zip") + (".ai" . "application/postscript") + (".jpe" . "image/jpeg") + (".jpeg" . "image/jpeg")) + "An alist of file extensions and corresponding MIME content-types. +This variable is used as the alternative of `mailcap-mime-extensions'.") + ;;; Interface functions. @@ -131,7 +228,9 @@ included.") (let ((type (unless (file-directory-p file) (or (cdr (assoc (concat "." (file-name-extension file)) - mailcap-mime-extensions)) + (if (boundp 'mailcap-mime-extensions) + (symbol-value 'mailcap-mime-extensions) + nneething-mime-extensions))) "text/plain"))) (charset (mm-detect-mime-charset-region (point-min) (point-max))) diff --git a/lisp/nnheader.el b/lisp/nnheader.el index 16d5469..0f36e8f 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -1207,7 +1207,23 @@ find-file-hooks, etc. (defalias 'mm-multibyte-string-p (if (fboundp 'multibyte-string-p) 'multibyte-string-p - 'ignore))) + 'ignore)) + + (defun nnheader-detect-coding-region (start end) + "Like 'detect-coding-region' except returning the best one." + (let ((coding-systems + (static-if (boundp 'MULE) + (code-detect-region (point) (point-max)) + (detect-coding-region (point) (point-max))))) + (or (car-safe coding-systems) + coding-systems))) + (defalias 'mm-detect-coding-region 'nnheader-detect-coding-region) + + (defun nnheader-detect-mime-charset-region (start end) + "Detect MIME charset of the text in the region between START and END." + (coding-system-to-mime-charset + (nnheader-detect-coding-region start end))) + (defalias 'mm-detect-mime-charset-region 'nnheader-detect-mime-charset-region)) ;; mail-parse stuff. (unless (featurep 'mail-parse) -- 1.7.10.4