[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
rtf inline?
From: |
Andreas Goesele |
Subject: |
rtf inline? |
Date: |
Sat, 12 Apr 2008 01:31:09 -0500 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Hi!
To show application/msword attachments inline in gnus I use antiword
and the code snippet below in init.el.
I also would like to use unrtf to do the same for text/rtf
attachments. But an adaptation of the snippet to text/rtf with unrtf
doesn't work. (I get the "usage" massage from unrtf.) If the code
would work, I probably would get HTML as output from unrtf, as this is
the default. So I still would have the problem of how to pass the
option "--text" to unrtf.
Any suggestion how to correct the code to make unrtf work and pass the
"--text" option? Or how show rtf attachments inline in some other way?
Thanks a lot in advance!
Andreas Goesele
Code adapted to text/rtf:
(defun mm-inline-rtf (handle)
(let (text)
(with-temp-buffer
(mm-insert-part handle)
(call-process-region (point-min) (point-max) "unrtf" t t nil "-")
(setq text (buffer-string)))
(mm-insert-inline handle text)))
(add-hook 'gnus-startup-hook (function (lambda () (add-to-list
'mm-inlined-types \
"text/rtf"))))
(add-hook 'gnus-startup-hook (function (lambda () (add-to-list
'mm-inline-media-t\
ests '("text/rtf" mm-inline-rtf identity)))))
(add-hook 'gnus-startup-hook (function (lambda () (add-to-list
'mm-inlined-types \
"application/octet-stream"))))
(add-hook 'gnus-startup-hook (function (lambda () (add-to-list
'mm-inline-media-t\
ests
'("application/octet-stream" mm-inline-rtf
(lambda (handle)
(let ((name (mail-content-type-get (mm-handle-disposition
handle\
) 'filename)))
(and name (equal ".rtf" (substring name -4 nil)))
)))))))
Original code for application/msword:
(defun mm-inline-msword (handle)
(let (text)
(with-temp-buffer
(mm-insert-part handle)
(call-process-region (point-min) (point-max) "antiword" t t nil "-")
(setq text (buffer-string)))
(mm-insert-inline handle text)))
(add-hook 'gnus-startup-hook (function (lambda () (add-to-list
'mm-inlined-types \
"application/msword"))))
(add-hook 'gnus-startup-hook (function (lambda () (add-to-list
'mm-inline-media-t\
ests '("application/msword" mm-inline-msword identity)))))
(add-hook 'gnus-startup-hook (function (lambda () (add-to-list
'mm-inlined-types \
"application/octet-stream"))))
(add-hook 'gnus-startup-hook (function (lambda () (add-to-list
'mm-inline-media-t\
ests
'("application/octet-stream" mm-inline-msword
(lambda (handle)
(let ((name (mail-content-type-get (mm-handle-disposition
handle\
) 'filename)))
(and name (equal ".doc" (substring name -4 nil)))
)))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- rtf inline?,
Andreas Goesele <=