Tassilo Horn <[email protected]> writes:
> Vagn Johansen <[email protected]> writes:
>
> Hi Vagn,
>
>> Does anyone know if it is possible to use doc-view(*) mode with gnus?
>
> I know that! ;-)
>
> It's not possible to inline the PDF images, but as a workaround you
> could write your own command that saves the pdf part in a temp file and
> opens that with emacs.
>
> This is not tested, but might work:
>
>
> (defun th-gnus-mime-view-internally ()
> (interactive)
> (gnus-article-check-buffer)
> (let ((data (get-text-property (point) 'gnus-data)))
> (when data
> (let ((f (make-temp-file "mime-part" nil ".pdf")))
> (mm-save-part-to-file data f)
> (find-file f)))))
Cool. It works!
>
> Bind it to some nice key in `gnus-article-mode-map' and have fun.
>
I prefer "doing stuff" to attachments via the K prefix in
gnus-summary-mode.
Here are my improvements and generalisations to your code (with some
inspiration from gnus-sum.el and gnus-art.el).
Usage:
(define-key gnus-summary-mode-map [?K ?f]
'gnus-article-view-part-via-find-file)
Code:
(defun gnus-mime-view-part-via-find-file (&optional handle)
(interactive)
(gnus-article-check-buffer)
(let ((handle (or handle (get-text-property (point) 'gnus-data))))
(when handle
(let* ((gnus-data (mm-handle-type (get-text-property (point)
'gnus-data)))
(ext (file-name-extension
(or (mail-content-type-get gnus-data 'name)
"dummy.txt")))
(suffix (concat "." ext ))
(f (make-temp-file "mime-part" nil suffix)))
(mm-save-part-to-file handle f)
(find-file f)))))
(defun gnus-article-view-part-via-find-file (n)
"View MIME part N via find-file, which is the numerical prefix."
(interactive "P")
(gnus-article-part-wrapper n 'gnus-mime-view-part-via-find-file))
--
Vagn Johansen
Evalesco A/S
_______________________________________________
info-gnus-english mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/info-gnus-english