[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r99769: 2010-03-30 Katsumi Yamaoka <a
From: |
Katsumi Yamaoka |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r99769: 2010-03-30 Katsumi Yamaoka <address@hidden> |
Date: |
Tue, 30 Mar 2010 04:04:58 +0000 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 99769 [merge]
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Tue 2010-03-30 04:04:58 +0000
message:
2010-03-30 Katsumi Yamaoka <address@hidden>
* gnus-art.el (gnus-article-browse-delete-temp-files): Delete
directories as well.
(gnus-article-browse-html-parts): Work for images that do not specify
file names; delete temp directory when quitting; insert header at the
right place; use file: scheme for image files.
2010-03-30 Eric Schulte <address@hidden>
* gnus-art.el (gnus-article-browse-html-save-cid-image): New function.
(gnus-article-browse-html-parts): Use it to make temporary cid image
files in addition to html file so that browser may display them.
modified:
lisp/gnus/ChangeLog
lisp/gnus/gnus-art.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog 2010-03-29 10:16:37 +0000
+++ b/lisp/gnus/ChangeLog 2010-03-30 04:03:00 +0000
@@ -1,3 +1,17 @@
+2010-03-30 Katsumi Yamaoka <address@hidden>
+
+ * gnus-art.el (gnus-article-browse-delete-temp-files): Delete
+ directories as well.
+ (gnus-article-browse-html-parts): Work for images that do not specify
+ file names; delete temp directory when quitting; insert header at the
+ right place; use file: scheme for image files.
+
+2010-03-30 Eric Schulte <address@hidden>
+
+ * gnus-art.el (gnus-article-browse-html-save-cid-image): New function.
+ (gnus-article-browse-html-parts): Use it to make temporary cid image
+ files in addition to html file so that browser may display them.
+
2010-03-29 Katsumi Yamaoka <address@hidden>
* mm-decode.el (mm-add-meta-html-tag): Fix regexp matching meta tag.
=== modified file 'lisp/gnus/gnus-art.el'
--- a/lisp/gnus/gnus-art.el 2010-03-23 07:37:09 +0000
+++ b/lisp/gnus/gnus-art.el 2010-03-30 04:03:00 +0000
@@ -2819,12 +2819,43 @@
;; `how' is neither `nil', `ask' nor `t' (i.e. `file'):
(gnus-y-or-n-p
(format "Delete temporary HTML file `%s'? " file))))
- (delete-file file)))
+ (if (file-directory-p file)
+ (gnus-delete-directory file)
+ (delete-file file))))
;; Also remove file from the list when not deleted or if file doesn't
;; exist anymore.
(setq gnus-article-browse-html-temp-list nil))
gnus-article-browse-html-temp-list)
+(defun gnus-article-browse-html-save-cid-image (cid dir)
+ "Save CID contents to a file in DIR. Return file name."
+ (save-match-data
+ (gnus-with-article-buffer
+ (let (cid-handle cid-tmp-file cid-type)
+ (mapc
+ (lambda (handle)
+ (when (and (listp handle)
+ (stringp (car (last handle)))
+ (string= (format "<%s>" cid)
+ (car (last handle))))
+ (setq cid-handle handle)
+ (setq cid-tmp-file
+ (expand-file-name
+ (or (mail-content-type-get
+ (mm-handle-disposition handle) 'filename)
+ (mail-content-type-get
+ (setq cid-type (mm-handle-type handle)) 'name)
+ (concat (make-temp-name "cid")
+ (or (car (rassoc (car cid-type)
+ mailcap-mime-extensions))
+ "")))
+ dir))))
+ gnus-article-mime-handles)
+ (when (and cid-handle cid-tmp-file)
+ (mm-save-part-to-file cid-handle
+ cid-tmp-file)
+ (concat "file://" cid-tmp-file))))))
+
(defun gnus-article-browse-html-parts (list &optional header)
"View all \"text/html\" parts from LIST.
Recurse into multiparts. The optional HEADER that should be a decoded
@@ -2862,7 +2893,7 @@
;; Add a meta html tag to specify charset and a header.
(cond
(header
- (let (title eheader body hcharset coding)
+ (let (title eheader body hcharset coding cid-image-dir)
(with-temp-buffer
(mm-enable-multibyte)
(setq case-fold-search t)
@@ -2943,6 +2974,18 @@
(re-search-forward
"</head\\(?:\\s-+[^>]+\\|\\s-*\\)>\\s-*" nil t))
(insert eheader)
+ ;; resolve cid images
+ (while (re-search-forward
+ "<img src=\"\\(cid:\\([^\"]+\\)\\)\""
+ nil t)
+ (unless cid-image-dir
+ (setq cid-image-dir (make-temp-file "cid" t))
+ (add-to-list 'gnus-article-browse-html-temp-list
+ cid-image-dir))
+ (replace-match
+ (gnus-article-browse-html-save-cid-image
+ (match-string 2) cid-image-dir)
+ nil nil nil 1))
(mm-write-region (point-min) (point-max)
tmp-file nil nil nil 'binary t))))
(charset
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r99769: 2010-03-30 Katsumi Yamaoka <address@hidden>,
Katsumi Yamaoka <=