annotate lisp/gnus/gnus-html.el @ 112440:b5017c649dfb

Check return values of some library calls.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 22 Jan 2011 23:30:19 -0800
parents b1eac6d41a93
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
110166
514c8efbfdbb gnus-html: Comment fix.; gnus-art.el: Provide an `u' command on urls and the like that copies the string over to the kill ring; Also have the `u' command work for HTML links.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110159
diff changeset
1 ;;; gnus-html.el --- Render HTML in a buffer.
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
2
112235
b1eac6d41a93 [Gnus] Update copyright years.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111986
diff changeset
3 ;; Copyright (C) 2010, 2011 Free Software Foundation, Inc.
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
4
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
6 ;; Keywords: html, web
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
7
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
9
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
13 ;; (at your option) any later version.
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
14
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
19
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
22
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
23 ;;; Commentary:
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
24
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
25 ;; The idea is to provide a simple, fast and pretty minimal way to
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
26 ;; render HTML (including links and images) in a buffer, based on an
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
27 ;; external HTML renderer (i.e., w3m).
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
28
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
29 ;;; Code:
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
30
110072
1a236d9dcc23 * lisp/gnus/gnus-html.el: Require pkgs that define macros used in this file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 110068
diff changeset
31 (eval-when-compile (require 'cl))
111320
02f27f970003 * lisp/gnus/gnus-html.el: Reorder requirements to quieten compiler.
Glenn Morris <rgm@gnu.org>
parents: 111138
diff changeset
32
02f27f970003 * lisp/gnus/gnus-html.el: Reorder requirements to quieten compiler.
Glenn Morris <rgm@gnu.org>
parents: 111138
diff changeset
33 (require 'gnus-art)
110072
1a236d9dcc23 * lisp/gnus/gnus-html.el: Require pkgs that define macros used in this file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 110068
diff changeset
34 (eval-when-compile (require 'mm-decode))
110386
93e14258e6bc gnus-html.el: Require gnus-art for `gnus-with-article-buffer'.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110369
diff changeset
35
110055
140a469a3964 gnus-html.el: require mm-url; by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110054
diff changeset
36 (require 'mm-url)
110422
93e093c035a0 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110387
diff changeset
37 (require 'url)
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
38 (require 'url-cache)
110477
f97b4d2abce9 gnus-html.el (gnus-html-wash-images): Use xml-substitute-special on images alt-text.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110461
diff changeset
39 (require 'xml)
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
40 (require 'browse-url)
110768
c389bae37f05 gnus-html.el (gnus-html-schedule-image-fetching): Work for XEmacs.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110755
diff changeset
41 (eval-and-compile (unless (featurep 'xemacs) (require 'help-fns)))
110055
140a469a3964 gnus-html.el: require mm-url; by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110054
diff changeset
42
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
43 (defcustom gnus-html-image-cache-ttl (days-to-time 7)
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
44 "Time used to determine if we should use images from the cache."
110084
320a820be8d8 gnus-html.el, message.el: Add custom version to new variables; gnus-sum.el: Bump custom version of gnus-auto-expirable-marks.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110083
diff changeset
45 :version "24.1"
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
46 :group 'gnus-art
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
47 :type 'integer)
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
48
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
49 (defcustom gnus-html-image-automatic-caching t
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
50 "Whether automatically cache retrieve images."
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
51 :version "24.1"
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
52 :group 'gnus-art
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
53 :type 'boolean)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
54
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
55 (defcustom gnus-html-frame-width 70
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
56 "What width to use when rendering HTML."
110084
320a820be8d8 gnus-html.el, message.el: Add custom version to new variables; gnus-sum.el: Bump custom version of gnus-auto-expirable-marks.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110083
diff changeset
57 :version "24.1"
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
58 :group 'gnus-art
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
59 :type 'integer)
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
60
110487
d3b676998c45 gnus-html.el: Embiggen pictures slightly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110486
diff changeset
61 (defcustom gnus-max-image-proportion 0.9
110094
b9d6d7f1d89f gnus-html.el: Rescale images in article buffers for Emacs versions that support this. This is currently only Emacs 24 compiled with imagemagick support.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110093
diff changeset
62 "How big pictures displayed are in relation to the window they're in.
b9d6d7f1d89f gnus-html.el: Rescale images in article buffers for Emacs versions that support this. This is currently only Emacs 24 compiled with imagemagick support.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110093
diff changeset
63 A value of 0.7 means that they are allowed to take up 70% of the
b9d6d7f1d89f gnus-html.el: Rescale images in article buffers for Emacs versions that support this. This is currently only Emacs 24 compiled with imagemagick support.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110093
diff changeset
64 width and height of the window. If they are larger than this,
b9d6d7f1d89f gnus-html.el: Rescale images in article buffers for Emacs versions that support this. This is currently only Emacs 24 compiled with imagemagick support.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110093
diff changeset
65 and Emacs supports it, then the images will be rescaled down to
b9d6d7f1d89f gnus-html.el: Rescale images in article buffers for Emacs versions that support this. This is currently only Emacs 24 compiled with imagemagick support.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110093
diff changeset
66 fit these criteria."
b9d6d7f1d89f gnus-html.el: Rescale images in article buffers for Emacs versions that support this. This is currently only Emacs 24 compiled with imagemagick support.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110093
diff changeset
67 :version "24.1"
b9d6d7f1d89f gnus-html.el: Rescale images in article buffers for Emacs versions that support this. This is currently only Emacs 24 compiled with imagemagick support.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110093
diff changeset
68 :group 'gnus-art
b9d6d7f1d89f gnus-html.el: Rescale images in article buffers for Emacs versions that support this. This is currently only Emacs 24 compiled with imagemagick support.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110093
diff changeset
69 :type 'float)
b9d6d7f1d89f gnus-html.el: Rescale images in article buffers for Emacs versions that support this. This is currently only Emacs 24 compiled with imagemagick support.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110093
diff changeset
70
110167
b8559a372ac8 gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110166
diff changeset
71 (defvar gnus-html-image-map
b8559a372ac8 gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110166
diff changeset
72 (let ((map (make-sparse-keymap)))
b8559a372ac8 gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110166
diff changeset
73 (define-key map "u" 'gnus-article-copy-string)
b8559a372ac8 gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110166
diff changeset
74 (define-key map "i" 'gnus-html-insert-image)
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
75 (define-key map "v" 'gnus-html-browse-url)
110167
b8559a372ac8 gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110166
diff changeset
76 map))
b8559a372ac8 gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110166
diff changeset
77
110277
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
78 (defvar gnus-html-displayed-image-map
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
79 (let ((map (make-sparse-keymap)))
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
80 (define-key map "a" 'gnus-html-show-alt-text)
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
81 (define-key map "i" 'gnus-html-browse-image)
110278
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
82 (define-key map "\r" 'gnus-html-browse-url)
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
83 (define-key map "u" 'gnus-article-copy-string)
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
84 (define-key map [tab] 'widget-forward)
110277
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
85 map))
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
86
110517
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
87 (eval-and-compile
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
88 (defalias 'gnus-html-encode-url-chars
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
89 (if (fboundp 'browse-url-url-encode-chars)
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
90 'browse-url-url-encode-chars
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
91 (lambda (text chars)
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
92 "URL-encode the chars in TEXT that match CHARS.
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
93 CHARS is a regexp-like character alternative (e.g., \"[)$]\")."
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
94 (let ((encoded-text (copy-sequence text))
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
95 (s 0))
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
96 (while (setq s (string-match chars encoded-text s))
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
97 (setq encoded-text
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
98 (replace-match (format "%%%x"
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
99 (string-to-char
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
100 (match-string 0 encoded-text)))
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
101 t t encoded-text)
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
102 s (1+ s)))
110747
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110740
diff changeset
103 encoded-text)))))
110517
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
104
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
105 (defun gnus-html-encode-url (url)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
106 "Encode URL."
110517
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
107 (gnus-html-encode-url-chars url "[)$ ]"))
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
108
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
109 (defun gnus-html-cache-expired (url ttl)
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
110 "Check if URL is cached for more than TTL."
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
111 (cond (url-standalone-mode
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
112 (not (file-exists-p (url-cache-create-filename url))))
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
113 (t (let ((cache-time (url-is-cached url)))
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
114 (if cache-time
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
115 (time-less-p
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
116 (time-add
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
117 cache-time
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
118 ttl)
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
119 (current-time))
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
120 t)))))
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
121
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
122 ;;;###autoload
110221
f0d95837f863 gnus-html.el (gnus-article-html): Allow calling without specifying the handle. In that case, dissect the buffer first.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110179
diff changeset
123 (defun gnus-article-html (&optional handle)
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
124 (let ((article-buffer (current-buffer)))
110221
f0d95837f863 gnus-html.el (gnus-article-html): Allow calling without specifying the handle. In that case, dissect the buffer first.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110179
diff changeset
125 (unless handle
f0d95837f863 gnus-html.el (gnus-article-html): Allow calling without specifying the handle. In that case, dissect the buffer first.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110179
diff changeset
126 (setq handle (mm-dissect-buffer t)))
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
127 (save-restriction
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
128 (narrow-to-region (point) (point))
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
129 (save-excursion
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
130 (mm-with-part handle
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
131 (let* ((coding-system-for-read 'utf-8)
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
132 (coding-system-for-write 'utf-8)
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
133 (default-process-coding-system
110086
f661002e9a6d gnus-article-html: Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110084
diff changeset
134 (cons coding-system-for-read coding-system-for-write))
f661002e9a6d gnus-article-html: Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110084
diff changeset
135 (charset (mail-content-type-get (mm-handle-type handle)
f661002e9a6d gnus-article-html: Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110084
diff changeset
136 'charset)))
f661002e9a6d gnus-article-html: Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110084
diff changeset
137 (when (and charset
f661002e9a6d gnus-article-html: Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110084
diff changeset
138 (setq charset (mm-charset-to-coding-system charset))
f661002e9a6d gnus-article-html: Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110084
diff changeset
139 (not (eq charset 'ascii)))
110143
19ce95f8bbbb gnus-article-html: Make work buffer multibyte for decoded contents.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110112
diff changeset
140 (insert (prog1
19ce95f8bbbb gnus-article-html: Make work buffer multibyte for decoded contents.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110112
diff changeset
141 (mm-decode-coding-string (buffer-string) charset)
19ce95f8bbbb gnus-article-html: Make work buffer multibyte for decoded contents.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110112
diff changeset
142 (erase-buffer)
19ce95f8bbbb gnus-article-html: Make work buffer multibyte for decoded contents.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110112
diff changeset
143 (mm-enable-multibyte))))
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
144 (call-process-region (point-min) (point-max)
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110110
diff changeset
145 "w3m"
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
146 nil article-buffer nil
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
147 "-halfdump"
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
148 "-no-cookie"
110049
00d3a187d587 Tell w3m that the input is UTF-8; This seems to fix problems with some German web feeds; by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110045
diff changeset
149 "-I" "UTF-8"
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
150 "-O" "UTF-8"
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
151 "-o" "ext_halfdump=1"
110433
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
152 "-o" "display_ins_del=2"
110049
00d3a187d587 Tell w3m that the input is UTF-8; This seems to fix problems with some German web feeds; by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110045
diff changeset
153 "-o" "pre_conv=1"
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
154 "-t" (format "%s" tab-width)
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
155 "-cols" (format "%s" gnus-html-frame-width)
110109
8c2040cb14d7 gnus-html.el (gnus-html-wash-tags): Don't show images that are really small. They're probably tracking images; nntp.el (nntp-request-set-mark): Refuse to do marks if nntp-marks-file-name is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110108
diff changeset
156 "-o" "display_image=on"
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
157 "-T" "text/html"))))
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
158 (gnus-html-wash-tags))))
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
159
110072
1a236d9dcc23 * lisp/gnus/gnus-html.el: Require pkgs that define macros used in this file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 110068
diff changeset
160 (defvar gnus-article-mouse-face)
1a236d9dcc23 * lisp/gnus/gnus-html.el: Require pkgs that define macros used in this file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 110068
diff changeset
161
110278
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
162 (defun gnus-html-pre-wash ()
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
163 (goto-char (point-min))
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
164 (while (re-search-forward " *<pre_int> *</pre_int> *\n" nil t)
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
165 (replace-match "" t t))
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
166 (goto-char (point-min))
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
167 (while (re-search-forward "<a name[^\n>]+>" nil t)
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
168 (replace-match "" t t)))
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
169
110295
f70d39f7b8fd gnus-html.el (gnus-html-wash-tags): Refactor out the image bit, and don't restrict end-tag searches to the end of the line.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110278
diff changeset
170 (defun gnus-html-wash-images ()
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
171 "Run through current buffer and replace img tags by images."
111634
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
172 (let (tag parameters string start end images url alt-text
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
173 inhibit-images blocked-images)
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
174 (if (buffer-live-p gnus-summary-buffer)
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
175 (with-current-buffer gnus-summary-buffer
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
176 (setq inhibit-images gnus-inhibit-images
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
177 blocked-images (gnus-blocked-images)))
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
178 (setq inhibit-images gnus-inhibit-images
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
179 blocked-images (gnus-blocked-images)))
110110
91cc7bab2ca4 gnus-html.el (gnus-html-wash-tags): Remove all <pre_int> place holders.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110109
diff changeset
180 (goto-char (point-min))
110278
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
181 ;; Search for all the images first.
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
182 (while (re-search-forward "<img_alt \\([^>]*\\)>" nil t)
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
183 (setq parameters (match-string 1)
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
184 start (match-beginning 0))
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
185 (delete-region start (point))
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
186 (when (search-forward "</img_alt>" (line-end-position) t)
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
187 (delete-region (match-beginning 0) (match-end 0)))
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
188 (setq end (point))
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
189 (when (string-match "src=\"\\([^\"]+\\)" parameters)
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
190 (gnus-message 8 "gnus-html-wash-tags: fetching image URL %s" url)
111585
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
191 (setq url (gnus-html-encode-url (match-string 1 parameters))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
192 alt-text (when (string-match "\\(alt\\|title\\)=\"\\([^\"]+\\)"
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
193 parameters)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
194 (xml-substitute-special (match-string 2 parameters))))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
195 (gnus-add-text-properties
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
196 start end
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
197 (list 'image-url url
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
198 'image-displayer `(lambda (url start end)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
199 (gnus-html-display-image url start end
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
200 ,alt-text))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
201 'gnus-image (list url start end alt-text)))
111830
79219ca01c7b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111635
diff changeset
202 (widget-convert-button
79219ca01c7b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111635
diff changeset
203 'url-link start (point)
79219ca01c7b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111635
diff changeset
204 :help-echo alt-text
79219ca01c7b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111635
diff changeset
205 :keymap gnus-html-image-map
79219ca01c7b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111635
diff changeset
206 url)
111585
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
207 (if (string-match "\\`cid:" url)
110278
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
208 ;; URLs with cid: have their content stashed in other
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
209 ;; parts of the MIME structure, so just insert them
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
210 ;; immediately.
111585
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
211 (let* ((handle (mm-get-content-id (substring url (match-end 0))))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
212 (image (when (and handle
111634
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
213 (not inhibit-images))
111585
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
214 (gnus-create-image
111557
8bb6a226933b Allow gnus-html to register image displayer callbacks.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111556
diff changeset
215 (mm-with-part handle (buffer-string))
8bb6a226933b Allow gnus-html to register image displayer callbacks.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111556
diff changeset
216 nil t))))
111585
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
217 (if image
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
218 (progn
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
219 (gnus-put-image
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
220 (gnus-rescale-image
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
221 image (gnus-html-maximum-image-size))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
222 (gnus-string-or (prog1
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
223 (buffer-substring start end)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
224 (delete-region start end))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
225 "*")
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
226 'cid)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
227 (gnus-add-image 'cid image))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
228 (widget-convert-button
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
229 'link start end
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
230 :action 'gnus-html-insert-image
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
231 :help-echo url
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
232 :keymap gnus-html-image-map
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
233 :button-keymap gnus-html-image-map)))
110278
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
234 ;; Normal, external URL.
111634
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
235 (if (or inhibit-images
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
236 (gnus-html-image-url-blocked-p url blocked-images))
111585
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
237 (widget-convert-button
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
238 'link start end
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
239 :action 'gnus-html-insert-image
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
240 :help-echo url
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
241 :keymap gnus-html-image-map
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
242 :button-keymap gnus-html-image-map)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
243 ;; Non-blocked url
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
244 (let ((width
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
245 (when (string-match "width=\"?\\([0-9]+\\)" parameters)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
246 (string-to-number (match-string 1 parameters))))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
247 (height
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
248 (when (string-match "height=\"?\\([0-9]+\\)" parameters)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
249 (string-to-number (match-string 1 parameters)))))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
250 ;; Don't fetch images that are really small. They're
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
251 ;; probably tracking pictures.
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
252 (when (and (or (null height)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
253 (> height 4))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
254 (or (null width)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
255 (> width 4)))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
256 (gnus-html-display-image url start end alt-text)))))))))
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
257
111556
ee13ba492319 Rework how Gnus is supposed to be able to display all the images in HTML.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111401
diff changeset
258 (defun gnus-html-display-image (url start end &optional alt-text)
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
259 "Display image at URL on text from START to END.
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
260 Use ALT-TEXT for the image string."
111585
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
261 (or alt-text (setq alt-text "*"))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
262 (if (string-match "\\`cid:" url)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
263 (let ((handle (mm-get-content-id (substring url (match-end 0)))))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
264 (when handle
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
265 (gnus-html-put-image (mm-with-part handle (buffer-string))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
266 url alt-text)))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
267 (if (gnus-html-cache-expired url gnus-html-image-cache-ttl)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
268 ;; We don't have it, so schedule it for fetching
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
269 ;; asynchronously.
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
270 (gnus-html-schedule-image-fetching
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
271 (current-buffer)
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
272 (list url alt-text))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
273 ;; It's already cached, so just insert it.
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
274 (gnus-html-put-image (gnus-html-get-image-data url) url alt-text))))
110295
f70d39f7b8fd gnus-html.el (gnus-html-wash-tags): Refactor out the image bit, and don't restrict end-tag searches to the end of the line.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110278
diff changeset
275
f70d39f7b8fd gnus-html.el (gnus-html-wash-tags): Refactor out the image bit, and don't restrict end-tag searches to the end of the line.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110278
diff changeset
276 (defun gnus-html-wash-tags ()
f70d39f7b8fd gnus-html.el (gnus-html-wash-tags): Refactor out the image bit, and don't restrict end-tag searches to the end of the line.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110278
diff changeset
277 (let (tag parameters string start end images url)
f70d39f7b8fd gnus-html.el (gnus-html-wash-tags): Refactor out the image bit, and don't restrict end-tag searches to the end of the line.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110278
diff changeset
278 (gnus-html-pre-wash)
f70d39f7b8fd gnus-html.el (gnus-html-wash-tags): Refactor out the image bit, and don't restrict end-tag searches to the end of the line.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110278
diff changeset
279 (gnus-html-wash-images)
110278
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
280
110255
91bdd0141c6e gnus-html.el (gnus-html-wash-tags): Remove <a name...> tags, which confuses the rest of the function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110221
diff changeset
281 (goto-char (point-min))
110278
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
282 ;; Then do the other tags.
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
283 (while (re-search-forward "<\\([^ />]+\\)\\([^>]*\\)>" nil t)
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
284 (setq tag (match-string 1)
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
285 parameters (match-string 2)
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
286 start (match-beginning 0))
110740
ed9ff0bf7851 Avoid using plusp; cl may not be loaded.
Chong Yidong <cyd@stupidchicken.com>
parents: 110708
diff changeset
287 (when (> (length parameters) 0)
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
288 (set-text-properties 0 (1- (length parameters)) nil parameters))
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
289 (delete-region start (point))
110295
f70d39f7b8fd gnus-html.el (gnus-html-wash-tags): Refactor out the image bit, and don't restrict end-tag searches to the end of the line.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110278
diff changeset
290 (when (search-forward (concat "</" tag ">") nil t)
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
291 (delete-region (match-beginning 0) (match-end 0)))
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
292 (setq end (point))
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
293 (cond
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
294 ;; Fetch and insert a picture.
110278
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
295 ((equal tag "img_alt"))
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
296 ;; Add a link.
110103
7181bb530921 gnus-html.el (gnus-html-wash-tags): "A" is also used for links, just like "a", it seems like; (gnus-html-image-url-blocked-p): Take a parameter for blocked-images since it needs to be picked from the correct buffer.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110099
diff changeset
297 ((or (equal tag "a")
7181bb530921 gnus-html.el (gnus-html-wash-tags): "A" is also used for links, just like "a", it seems like; (gnus-html-image-url-blocked-p): Take a parameter for blocked-images since it needs to be picked from the correct buffer.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110099
diff changeset
298 (equal tag "A"))
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
299 (when (string-match "href=\"\\([^\"]+\\)" parameters)
110068
2af503eb57ef Clarify the code a bit by renaming the variable with the url to `url'; Support cid: URLs/images; by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110055
diff changeset
300 (setq url (match-string 1 parameters))
110107
ffa0ce354f9d gnus-html.el: prefix log messages with function name
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110106
diff changeset
301 (gnus-message 8 "gnus-html-wash-tags: fetching link URL %s" url)
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
302 (gnus-article-add-button start end
110774
276ecc27ad6b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110768
diff changeset
303 'browse-url (mm-url-decode-entities-string url)
110068
2af503eb57ef Clarify the code a bit by renaming the variable with the url to `url'; Support cid: URLs/images; by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110055
diff changeset
304 url)
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
305 (let ((overlay (gnus-make-overlay start end)))
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
306 (gnus-overlay-put overlay 'evaporate t)
110068
2af503eb57ef Clarify the code a bit by renaming the variable with the url to `url'; Support cid: URLs/images; by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110055
diff changeset
307 (gnus-overlay-put overlay 'gnus-button-url url)
110167
b8559a372ac8 gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110166
diff changeset
308 (gnus-put-text-property start end 'gnus-string url)
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
309 (when gnus-article-mouse-face
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
310 (gnus-overlay-put overlay 'mouse-face gnus-article-mouse-face)))))
110092
1e526716f8fc gnus-html.el: Delete the IMG_ALT region.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110086
diff changeset
311 ;; The upper-case IMG_ALT is apparently just an artifact that
1e526716f8fc gnus-html.el: Delete the IMG_ALT region.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110086
diff changeset
312 ;; should be deleted.
1e526716f8fc gnus-html.el: Delete the IMG_ALT region.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110086
diff changeset
313 ((equal tag "IMG_ALT")
1e526716f8fc gnus-html.el: Delete the IMG_ALT region.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110086
diff changeset
314 (delete-region start end))
110433
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
315 ;; w3m does not normalize the case
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
316 ((or (equal tag "b")
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
317 (equal tag "B"))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
318 (gnus-overlay-put (gnus-make-overlay start end) 'face 'gnus-emphasis-bold))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
319 ((or (equal tag "u")
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
320 (equal tag "U"))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
321 (gnus-overlay-put (gnus-make-overlay start end) 'face 'gnus-emphasis-underline))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
322 ((or (equal tag "i")
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
323 (equal tag "I"))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
324 (gnus-overlay-put (gnus-make-overlay start end) 'face 'gnus-emphasis-italic))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
325 ((or (equal tag "s")
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
326 (equal tag "S"))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
327 (gnus-overlay-put (gnus-make-overlay start end) 'face 'gnus-emphasis-strikethru))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
328 ((or (equal tag "ins")
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
329 (equal tag "INS"))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
330 (gnus-overlay-put (gnus-make-overlay start end) 'face 'gnus-emphasis-underline))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
331 ;; Handle different UL types
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
332 ((equal tag "_SYMBOL")
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
333 (when (string-match "TYPE=\\(.+\\)" parameters)
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
334 (let ((type (string-to-number (match-string 1 parameters))))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
335 (delete-region start end)
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
336 (cond ((= type 33) (insert " "))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
337 ((= type 34) (insert " "))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
338 ((= type 35) (insert " "))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
339 ((= type 36) (insert " "))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
340 ((= type 37) (insert " "))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
341 ((= type 38) (insert " "))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
342 ((= type 39) (insert " "))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
343 ((= type 40) (insert " "))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
344 ((= type 42) (insert " "))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
345 ((= type 43) (insert " "))
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
346 (t (insert " "))))))
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
347 ;; Whatever. Just ignore the tag.
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
348 (t
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
349 ))
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
350 (goto-char start))
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
351 (goto-char (point-min))
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
352 ;; The output from -halfdump isn't totally regular, so strip
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
353 ;; off any </pre_int>s that were left over.
110259
b350cc580a0f gnus-html.el (gnus-html-wash-tags): Limit end-tag matching to the current line to work around bugs in the output from w3m.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110255
diff changeset
354 (while (re-search-forward "</pre_int>\\|</internal>" nil t)
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
355 (replace-match "" t t))
110172
f400055a098b Fix previous merge from Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110170
diff changeset
356 (mm-url-decode-entities)))
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
357
111585
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
358 (defun gnus-html-insert-image (&rest args)
110167
b8559a372ac8 gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110166
diff changeset
359 "Fetch and insert the image under point."
b8559a372ac8 gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110166
diff changeset
360 (interactive)
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
361 (apply 'gnus-html-display-image (get-text-property (point) 'gnus-image)))
110167
b8559a372ac8 gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110166
diff changeset
362
110277
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
363 (defun gnus-html-show-alt-text ()
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
364 "Show the ALT text of the image under point."
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
365 (interactive)
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
366 (message "%s" (get-text-property (point) 'gnus-alt-text)))
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
367
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
368 (defun gnus-html-browse-image ()
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
369 "Browse the image under point."
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
370 (interactive)
111556
ee13ba492319 Rework how Gnus is supposed to be able to display all the images in HTML.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111401
diff changeset
371 (browse-url (get-text-property (point) 'image-url)))
110277
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
372
110278
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
373 (defun gnus-html-browse-url ()
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
374 "Browse the image under point."
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
375 (interactive)
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
376 (let ((url (get-text-property (point) 'gnus-string)))
111401
733acab855e4 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111320
diff changeset
377 (cond
733acab855e4 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111320
diff changeset
378 ((not url)
733acab855e4 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111320
diff changeset
379 (message "No link under point"))
733acab855e4 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111320
diff changeset
380 ((string-match "^mailto:" url)
733acab855e4 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111320
diff changeset
381 (gnus-url-mailto url))
733acab855e4 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111320
diff changeset
382 (t
733acab855e4 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111320
diff changeset
383 (browse-url url)))))
110278
8c1028027f1b gnus-html (gnus-html-wash-tags): Search for images first, so that <a><img> works better; (gnus-html-displayed-image-map): Bind RET and TAB on images for better UX.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110277
diff changeset
384
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
385 (defun gnus-html-schedule-image-fetching (buffer image)
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
386 "Retrieve IMAGE, and place it into BUFFER on arrival."
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
387 (gnus-message 8 "gnus-html-schedule-image-fetching: buffer %s, image %s"
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
388 buffer image)
110698
74bad2d7bddd Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110682
diff changeset
389 (let ((args (list (car image)
74bad2d7bddd Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110682
diff changeset
390 'gnus-html-image-fetched
74bad2d7bddd Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110682
diff changeset
391 (list buffer image))))
110768
c389bae37f05 gnus-html.el (gnus-html-schedule-image-fetching): Work for XEmacs.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110755
diff changeset
392 (when (> (length (if (featurep 'xemacs)
110800
751b2ae689b5 [Gnus] Enable XEmacs to display images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110777
diff changeset
393 (cdr (split-string (function-arglist 'url-retrieve)))
110768
c389bae37f05 gnus-html.el (gnus-html-schedule-image-fetching): Work for XEmacs.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110755
diff changeset
394 (help-function-arglist 'url-retrieve)))
c389bae37f05 gnus-html.el (gnus-html-schedule-image-fetching): Work for XEmacs.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110755
diff changeset
395 4)
110698
74bad2d7bddd Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110682
diff changeset
396 (setq args (nconc args (list t))))
110777
895607aec71e Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110775
diff changeset
397 (ignore-errors
111986
faa4a1c986c6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111830
diff changeset
398 (push (apply #'url-retrieve args) gnus-buffers))))
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
399
110422
93e093c035a0 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110387
diff changeset
400 (defun gnus-html-image-fetched (status buffer image)
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
401 "Callback function called when image has been fetched."
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
402 (unless (plist-get status :error)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
403 (when gnus-html-image-automatic-caching
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
404 (url-store-in-cache (current-buffer)))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
405 (when (and (or (search-forward "\n\n" nil t)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
406 (search-forward "\r\n\r\n" nil t))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
407 (buffer-live-p buffer))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
408 (let ((data (buffer-substring (point) (point-max))))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
409 (with-current-buffer buffer
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
410 (let ((inhibit-read-only t))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
411 (gnus-html-put-image data (car image) (cadr image)))))))
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
412 (kill-buffer (current-buffer)))
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
413
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
414 (defun gnus-html-get-image-data (url)
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
415 "Get image data for URL.
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
416 Return a string with image data."
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
417 (with-temp-buffer
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
418 (mm-disable-multibyte)
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
419 (url-cache-extract (url-cache-create-filename url))
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
420 (when (or (search-forward "\n\n" nil t)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
421 (search-forward "\r\n\r\n" nil t))
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
422 (buffer-substring (point) (point-max)))))
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
423
110775
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
424 (defun gnus-html-maximum-image-size ()
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
425 "Return the maximum size of an image according to `gnus-max-image-proportion'."
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
426 (let ((edges (gnus-window-inside-pixel-edges
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
427 (get-buffer-window (current-buffer)))))
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
428 ;; (width . height)
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
429 (cons
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
430 ;; Aimed width
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
431 (truncate
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
432 (* gnus-max-image-proportion
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
433 (- (nth 2 edges) (nth 0 edges))))
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
434 ;; Aimed height
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
435 (truncate (* gnus-max-image-proportion
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
436 (- (nth 3 edges) (nth 1 edges)))))))
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
437
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
438 (defun gnus-html-put-image (data url &optional alt-text)
110775
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
439 "Put an image with DATA from URL and optional ALT-TEXT."
110158
64b3982570b5 Make gnus-html work for XEmacs.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110156
diff changeset
440 (when (gnus-graphic-display-p)
110708
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110698
diff changeset
441 (let* ((start (text-property-any (point-min) (point-max)
111556
ee13ba492319 Rework how Gnus is supposed to be able to display all the images in HTML.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111401
diff changeset
442 'image-url url))
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
443 (end (when start
111556
ee13ba492319 Rework how Gnus is supposed to be able to display all the images in HTML.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111401
diff changeset
444 (next-single-property-change start 'image-url))))
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
445 ;; Image found?
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
446 (when start
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
447 (let* ((image
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
448 (ignore-errors
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
449 (gnus-create-image data nil t)))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
450 (size (and image
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
451 (if (featurep 'xemacs)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
452 (cons (glyph-width image) (glyph-height image))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
453 (image-size image t)))))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
454 (save-excursion
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
455 (goto-char start)
110708
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110698
diff changeset
456 (let ((alt-text (or alt-text
111585
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
457 (buffer-substring-no-properties start end)))
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
458 (inhibit-read-only t))
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
459 (if (and image
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
460 ;; Kludge to avoid displaying 30x30 gif images, which
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
461 ;; seems to be a signal of a broken image.
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
462 (not (and (if (featurep 'xemacs)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
463 (glyphp image)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
464 (listp image))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
465 (eq (if (featurep 'xemacs)
110708
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110698
diff changeset
466 (let ((d (cdadar
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110698
diff changeset
467 (specifier-spec-list
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110698
diff changeset
468 (glyph-image image)))))
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
469 (and (vectorp d)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
470 (aref d 0)))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
471 (plist-get (cdr image) :type))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
472 'gif)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
473 (= (car size) 30)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
474 (= (cdr size) 30))))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
475 ;; Good image, add it!
110775
6ae391b53988 sieve-manage.el (sieve-manage-capability): Do not bug out when the server-value of the capability is nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110774
diff changeset
476 (let ((image (gnus-rescale-image image (gnus-html-maximum-image-size))))
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
477 (delete-region start end)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
478 (gnus-put-image image alt-text 'external)
111830
79219ca01c7b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111635
diff changeset
479 (widget-convert-button
79219ca01c7b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111635
diff changeset
480 'url-link start (point)
79219ca01c7b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111635
diff changeset
481 :help-echo alt-text
79219ca01c7b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111635
diff changeset
482 :keymap gnus-html-displayed-image-map
79219ca01c7b Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111635
diff changeset
483 url)
110708
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110698
diff changeset
484 (gnus-put-text-property start (point)
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110698
diff changeset
485 'gnus-alt-text alt-text)
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
486 (when url
110708
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110698
diff changeset
487 (gnus-put-text-property start (point)
111556
ee13ba492319 Rework how Gnus is supposed to be able to display all the images in HTML.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111401
diff changeset
488 'image-url url))
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
489 (gnus-add-image 'external image)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
490 t)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
491 ;; Bad image, try to show something else
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
492 (when (fboundp 'find-image)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
493 (delete-region start end)
110708
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110698
diff changeset
494 (setq image (find-image
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110698
diff changeset
495 '((:type xpm :file "lock-broken.xpm"))))
110486
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
496 (gnus-put-image image alt-text 'internal)
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
497 (gnus-add-image 'internal image))
1ad1adb298a3 Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110477
diff changeset
498 nil))))))))
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
499
110103
7181bb530921 gnus-html.el (gnus-html-wash-tags): "A" is also used for links, just like "a", it seems like; (gnus-html-image-url-blocked-p): Take a parameter for blocked-images since it needs to be picked from the correct buffer.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110099
diff changeset
500 (defun gnus-html-image-url-blocked-p (url blocked-images)
110277
a46aad43ce5a gnus-html.el: Allow showing the ALT text of images and to browse the images themselves.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110276
diff changeset
501 "Find out if URL is blocked by BLOCKED-IMAGES."
110103
7181bb530921 gnus-html.el (gnus-html-wash-tags): "A" is also used for links, just like "a", it seems like; (gnus-html-image-url-blocked-p): Take a parameter for blocked-images since it needs to be picked from the correct buffer.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110099
diff changeset
502 (let ((ret (and blocked-images
7181bb530921 gnus-html.el (gnus-html-wash-tags): "A" is also used for links, just like "a", it seems like; (gnus-html-image-url-blocked-p): Take a parameter for blocked-images since it needs to be picked from the correct buffer.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110099
diff changeset
503 (string-match blocked-images url))))
110107
ffa0ce354f9d gnus-html.el: prefix log messages with function name
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110106
diff changeset
504 (if ret
ffa0ce354f9d gnus-html.el: prefix log messages with function name
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110106
diff changeset
505 (gnus-message 8 "gnus-html-image-url-blocked-p: %s blocked by regex %s"
ffa0ce354f9d gnus-html.el: prefix log messages with function name
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110106
diff changeset
506 url blocked-images)
ffa0ce354f9d gnus-html.el: prefix log messages with function name
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110106
diff changeset
507 (gnus-message 9 "gnus-html-image-url-blocked-p: %s passes regex %s"
ffa0ce354f9d gnus-html.el: prefix log messages with function name
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110106
diff changeset
508 url blocked-images))
110099
7a6012e13748 gnus-html.el: add and use gnus-html-image-url-blocked-p
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110098
diff changeset
509 ret))
7a6012e13748 gnus-html.el: add and use gnus-html-image-url-blocked-p
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110098
diff changeset
510
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
511 ;;;###autoload
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
512 (defun gnus-html-prefetch-images (summary)
110433
33cf78a271ef Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110428
diff changeset
513 (when (buffer-live-p summary)
111634
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
514 (let (inhibit-images blocked-images)
111635
b8f48ecba2e7 gnus-html.el (gnus-html-prefetch-images): Fix last change.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111634
diff changeset
515 (with-current-buffer summary
111634
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
516 (setq inhibit-images gnus-inhibit-images
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
517 blocked-images (gnus-blocked-images)))
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
518 (save-match-data
111077
b4556938af92 gnus-html.el (gnus-html-prefetch-images): Only prefetch http images to avoid trying to snarf invalid stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111067
diff changeset
519 (while (re-search-forward "<img[^>]+src=[\"']\\(http[^\"']+\\)" nil t)
111138
11259a64bfc0 gnus-sum.el (gnus-summary-select-article): Make sure we have the original article buffer live.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111077
diff changeset
520 (let ((url (gnus-html-encode-url
11259a64bfc0 gnus-sum.el (gnus-summary-select-article): Make sure we have the original article buffer live.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111077
diff changeset
521 (mm-url-decode-entities-string (match-string 1)))))
111634
3334777d733d Assume that gnus-inhibit-images may be a group parameter.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111585
diff changeset
522 (unless (or inhibit-images
111585
c17f914efec2 gnus-html.el: Don't display images if gnus-inhibit-images is non-nil.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111557
diff changeset
523 (gnus-html-image-url-blocked-p url blocked-images))
110461
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
524 (when (gnus-html-cache-expired url gnus-html-image-cache-ttl)
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
525 (gnus-html-schedule-image-fetching nil
9992c4871bd4 gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110436
diff changeset
526 (list url))))))))))
110025
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
527
5f352fd4346a Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110024
diff changeset
528 (provide 'gnus-html)
110024
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
529
5428546bbb98 Add a new super-simple HTML renderer based on w3m -halfdump by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
diff changeset
530 ;;; gnus-html.el ends here