diff options
| author | Katsumi Yamaoka | 2014-08-26 23:28:22 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2014-08-26 23:28:22 +0000 |
| commit | 6539413d0b4abb7b6646fdddda52d6bcaa71a49c (patch) | |
| tree | 04f5c371ea6a0ff9bc7ee70082d26d15dddda002 | |
| parent | aaae978c32495f111398e1a3af3f6d528e12004b (diff) | |
| download | emacs-6539413d0b4abb7b6646fdddda52d6bcaa71a49c.tar.gz emacs-6539413d0b4abb7b6646fdddda52d6bcaa71a49c.zip | |
gnus-art.el (gnus-article-browse-html-save-cid-content, gnus-article-browse-html-parts): Make cid file names relative
| -rw-r--r-- | lisp/gnus/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 43 |
2 files changed, 28 insertions, 20 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 8b3262998d2..dd2530eadbb 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-08-26 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 2 | |||
| 3 | * gnus-art.el (gnus-article-browse-html-save-cid-content) | ||
| 4 | (gnus-article-browse-html-parts): Make cid file names relative. | ||
| 5 | |||
| 1 | 2014-08-21 Katsumi Yamaoka <yamaoka@jpl.org> | 6 | 2014-08-21 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 7 | ||
| 3 | * mm-view.el (mm-display-inline-fontify): Make the working buffer | 8 | * mm-view.el (mm-display-inline-fontify): Make the working buffer |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index bbfe55c5d84..a054a46e2c4 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -2806,16 +2806,15 @@ Return file name." | |||
| 2806 | cid handle directory)) | 2806 | cid handle directory)) |
| 2807 | (throw 'found file))) | 2807 | (throw 'found file))) |
| 2808 | ((equal (concat "<" cid ">") (mm-handle-id handle)) | 2808 | ((equal (concat "<" cid ">") (mm-handle-id handle)) |
| 2809 | (setq file | 2809 | (setq file (or (mm-handle-filename handle) |
| 2810 | (expand-file-name | 2810 | (concat |
| 2811 | (or (mm-handle-filename handle) | 2811 | (make-temp-name "cid") |
| 2812 | (concat | 2812 | (car (rassoc (car (mm-handle-type handle)) |
| 2813 | (make-temp-name "cid") | 2813 | mailcap-mime-extensions))))) |
| 2814 | (car (rassoc (car (mm-handle-type handle)) | 2814 | (mm-save-part-to-file handle (expand-file-name file directory)) |
| 2815 | mailcap-mime-extensions)))) | 2815 | (throw 'found (concat (file-name-nondirectory |
| 2816 | directory)) | 2816 | (directory-file-name directory)) |
| 2817 | (mm-save-part-to-file handle file) | 2817 | "/" file))))))))) |
| 2818 | (throw 'found file)))))))) | ||
| 2819 | 2818 | ||
| 2820 | (defun gnus-article-browse-html-parts (list &optional header) | 2819 | (defun gnus-article-browse-html-parts (list &optional header) |
| 2821 | "View all \"text/html\" parts from LIST. | 2820 | "View all \"text/html\" parts from LIST. |
| @@ -2849,6 +2848,19 @@ message header will be added to the bodies of the \"text/html\" parts." | |||
| 2849 | (mm-enable-multibyte) | 2848 | (mm-enable-multibyte) |
| 2850 | (mm-disable-multibyte)) | 2849 | (mm-disable-multibyte)) |
| 2851 | (insert content) | 2850 | (insert content) |
| 2851 | ;; remove <base> | ||
| 2852 | (let ((case-fold-search t)) | ||
| 2853 | (goto-char (point-min)) | ||
| 2854 | (when (and (search-forward "<head>" nil t) | ||
| 2855 | (progn | ||
| 2856 | (save-restriction | ||
| 2857 | (narrow-to-region | ||
| 2858 | (point) | ||
| 2859 | (or (search-forward "</head>" nil t) (point))) | ||
| 2860 | (goto-char (point-min))) | ||
| 2861 | (re-search-forward | ||
| 2862 | "[\t\n ]*<base[\t\n ]+[^>]+>[\t\n ]*" nil t))) | ||
| 2863 | (replace-match "\n"))) | ||
| 2852 | ;; resolve cid contents | 2864 | ;; resolve cid contents |
| 2853 | (let ((case-fold-search t) | 2865 | (let ((case-fold-search t) |
| 2854 | cid-file) | 2866 | cid-file) |
| @@ -2867,16 +2879,7 @@ message header will be added to the bodies of the \"text/html\" parts." | |||
| 2867 | (with-current-buffer gnus-article-buffer | 2879 | (with-current-buffer gnus-article-buffer |
| 2868 | gnus-article-mime-handles) | 2880 | gnus-article-mime-handles) |
| 2869 | cid-dir)) | 2881 | cid-dir)) |
| 2870 | (when (eq system-type 'cygwin) | 2882 | (replace-match cid-file nil nil nil 1)))) |
| 2871 | (setq cid-file | ||
| 2872 | (concat "/" (substring | ||
| 2873 | (with-output-to-string | ||
| 2874 | (call-process "cygpath" nil | ||
| 2875 | standard-output | ||
| 2876 | nil "-m" cid-file)) | ||
| 2877 | 0 -1)))) | ||
| 2878 | (replace-match (concat "file://" cid-file) | ||
| 2879 | nil nil nil 1)))) | ||
| 2880 | (unless content (setq content (buffer-string)))) | 2883 | (unless content (setq content (buffer-string)))) |
| 2881 | (when (or charset header (not file)) | 2884 | (when (or charset header (not file)) |
| 2882 | (setq tmp-file (mm-make-temp-file | 2885 | (setq tmp-file (mm-make-temp-file |