2002-02-18 ShengHuo ZHU <zsh@cs.rochester.edu>
+
+ * mm-decode.el (mm-application-msword-renderer): New variable.
+ (mm-inline-media-tests): Use it.
+ (mm-inlined-types): Add application/msword.
+
+ * mm-view.el (mm-inline-render-with-file): With unibyte buffer.
+ (mm-inline-render-with-stdin): Ditto.
+ (mm-inline-render-with-function): Ditto.
+ (mm-application-msword-renderer-alist): New variable.
+ (mm-inline-application-msword): New function.
+ (mm-inline-wash-with-file): Bind coding-system-for-write.
+ (mm-inline-wash-with-stdin): Ditto.
+
+2002-02-18 ShengHuo ZHU <zsh@cs.rochester.edu>
+
Suggested by Felix Natter <fnatter@gmx.net>
* gnus-art.el (gnus-mime-view-part-externally): Rename from
:version "21.3"
:group 'mime-display)
+(defcustom mm-application-msword-renderer
+ (cond ((executable-find "catdoc") 'catdoc))
+ "Render of application/msword contents.
+It is one of defined renderer types, or a rendering function.
+The defined renderer types are:
+`catdoc' : using catdoc."
+ :type '(choice (symbol catdoc)
+ (function))
+ :version "21.3"
+ :group 'mime-display)
+
(defvar mm-inline-text-html-renderer nil
"Function used for rendering inline HTML contents.
It is suggested to customize `mm-text-html-renderer' instead.")
(lambda (handle)
(or (featurep 'vcard)
(locate-library "vcard"))))
+ ("application/msword"
+ mm-inline-application-msword
+ (lambda (handle)
+ mm-application-msword-renderer))
("message/delivery-status" mm-inline-text identity)
("message/rfc822" mm-inline-message identity)
("message/partial" mm-inline-partial identity)
"message/partial" "message/external-body" "application/emacs-lisp"
"application/pgp-signature" "application/x-pkcs7-signature"
"application/pkcs7-signature" "application/x-pkcs7-mime"
- "application/pkcs7-mime")
+ "application/pkcs7-mime" "application/msword")
"List of media types that are to be displayed inline.
See also `mm-inline-media-tests', which says how to display a media
type inline."
"links" "-dump" file)
(lynx mm-inline-render-with-stdin nil
"lynx" "-dump" "-force_html" "-stdin"))
- "The attributes of renderer types.")
+ "The attributes of renderer types for text/html.")
(defvar mm-text-html-washer-alist
'((w3 . gnus-article-wash-html-with-w3)
"links" "-dump" file)
(lynx mm-inline-wash-with-stdin nil
"lynx" "-dump" "-force_html" "-stdin"))
- "The attributes of washer types.")
+ "The attributes of washer types for text/html.")
+
+(defvar mm-application-msword-renderer-alist
+ '((catdoc mm-inline-render-with-stdin nil "catdoc"))
+ "The attributes of renderer types.")
;;; Internal variables.
(defun mm-inline-wash-with-file (post-func cmd &rest args)
(let ((file (make-temp-name
(expand-file-name "mm" mm-tmp-directory))))
- (write-region (point-min) (point-max) file nil 'silent)
+ (let ((coding-system-for-write 'binary))
+ (write-region (point-min) (point-max) file nil 'silent))
(delete-region (point-min) (point-max))
(unwind-protect
(apply 'call-process cmd nil t nil (mapcar 'eval args))
(and post-func (funcall post-func))))
(defun mm-inline-wash-with-stdin (post-func cmd &rest args)
- (apply 'call-process-region (point-min) (point-max)
- cmd t t nil args)
+ (let ((coding-system-for-write 'binary))
+ (apply 'call-process-region (point-min) (point-max)
+ cmd t t nil args))
(and post-func (funcall post-func)))
(defun mm-inline-render-with-file (handle post-func cmd &rest args)
(let ((source (mm-get-part handle)))
(mm-insert-inline
handle
- (with-temp-buffer
+ (mm-with-unibyte-buffer
(insert source)
(apply 'mm-inline-wash-with-file post-func cmd args)
(buffer-string)))))
(let ((source (mm-get-part handle)))
(mm-insert-inline
handle
- (with-temp-buffer
+ (mm-with-unibyte-buffer
(insert source)
(apply 'mm-inline-wash-with-stdin post-func cmd args)
(buffer-string)))))
(let ((source (mm-get-part handle)))
(mm-insert-inline
handle
- (with-temp-buffer
+ (mm-with-unibyte-buffer
(insert source)
(apply func args)
(buffer-string)))))
(and (listp (car-safe smime-keys))
(caar smime-keys)))))))
+(defun mm-inline-application-msword (handle)
+ (let* ((func mm-application-msword-renderer)
+ (entry (assq func mm-application-msword-renderer-alist))
+ buffer-read-only)
+ (if entry
+ (setq func (cdr entry)))
+ (cond
+ ((gnus-functionp func)
+ (funcall func handle))
+ (t
+ (apply (car func) handle (cdr func))))))
+
(provide 'mm-view)
;;; mm-view.el ends here