Mercurial > emacs
annotate lisp/gnus/gnus-html.el @ 110855:bec49af30c2f
Merge changes from emacs-23 branch.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Fri, 08 Oct 2010 12:14:47 +0200 |
parents | 751b2ae689b5 |
children | e36c65ac23bf |
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 |
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
|
3 ;; Copyright (C) 2010 Free Software Foundation, Inc. |
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)) |
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
|
32 (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
|
33 |
93e14258e6bc
gnus-html.el: Require gnus-art for `gnus-with-article-buffer'.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110369
diff
changeset
|
34 (require 'gnus-art) |
110055
140a469a3964
gnus-html.el: require mm-url; by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110054
diff
changeset
|
35 (require 'mm-url) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110387
diff
changeset
|
36 (require 'url) |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
37 (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
|
38 (require 'xml) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
39 (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
|
40 (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
|
41 |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
42 (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
|
43 "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
|
44 :version "24.1" |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
45 :group 'gnus-art |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
46 :type 'integer) |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
47 |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
48 (defcustom gnus-html-image-automatic-caching t |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
49 "Whether automatically cache retrieve images." |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
50 :version "24.1" |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
51 :group 'gnus-art |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
52 :type 'boolean) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
53 |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
54 (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
|
55 "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
|
56 :version "24.1" |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
57 :group 'gnus-art |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
58 :type 'integer) |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
59 |
110487
d3b676998c45
gnus-html.el: Embiggen pictures slightly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110486
diff
changeset
|
60 (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
|
61 "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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 :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
|
67 :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
|
68 :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
|
69 |
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
|
70 (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
|
71 (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
|
72 (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
|
73 (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
|
74 (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
|
75 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
|
76 |
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
|
77 (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
|
78 (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
|
79 (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
|
80 (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
|
81 (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
|
82 (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
|
83 (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
|
84 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
|
85 |
110517
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
86 (eval-and-compile |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
87 (defalias 'gnus-html-encode-url-chars |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
88 (if (fboundp 'browse-url-url-encode-chars) |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
89 'browse-url-url-encode-chars |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
90 (lambda (text chars) |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
91 "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
|
92 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
|
93 (let ((encoded-text (copy-sequence text)) |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
94 (s 0)) |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
95 (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
|
96 (setq encoded-text |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
97 (replace-match (format "%%%x" |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
98 (string-to-char |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
99 (match-string 0 encoded-text))) |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
100 t t encoded-text) |
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
101 s (1+ s))) |
110747
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110740
diff
changeset
|
102 encoded-text))))) |
110517
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
103 |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
104 (defun gnus-html-encode-url (url) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
105 "Encode URL." |
110517
64945cefe6a6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
106 (gnus-html-encode-url-chars url "[)$ ]")) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
107 |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
108 (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
|
109 "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
|
110 (cond (url-standalone-mode |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
111 (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
|
112 (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
|
113 (if cache-time |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
114 (time-less-p |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
115 (time-add |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
116 cache-time |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
117 ttl) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
118 (current-time)) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
119 t))))) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
120 |
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
|
121 ;;;###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
|
122 (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
|
123 (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
|
124 (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
|
125 (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
|
126 (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
|
127 (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
|
128 (save-excursion |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
129 (mm-with-part handle |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
130 (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
|
131 (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
|
132 (default-process-coding-system |
110086
f661002e9a6d
gnus-article-html: Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110084
diff
changeset
|
133 (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
|
134 (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
|
135 'charset))) |
f661002e9a6d
gnus-article-html: Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110084
diff
changeset
|
136 (when (and charset |
f661002e9a6d
gnus-article-html: Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110084
diff
changeset
|
137 (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
|
138 (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
|
139 (insert (prog1 |
19ce95f8bbbb
gnus-article-html: Make work buffer multibyte for decoded contents.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110112
diff
changeset
|
140 (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
|
141 (erase-buffer) |
19ce95f8bbbb
gnus-article-html: Make work buffer multibyte for decoded contents.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110112
diff
changeset
|
142 (mm-enable-multibyte)))) |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
143 (call-process-region (point-min) (point-max) |
110111
5b9f64b04a04
Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110110
diff
changeset
|
144 "w3m" |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
145 nil article-buffer nil |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
146 "-halfdump" |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
147 "-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
|
148 "-I" "UTF-8" |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
149 "-O" "UTF-8" |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
150 "-o" "ext_halfdump=1" |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
151 "-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
|
152 "-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
|
153 "-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
|
154 "-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
|
155 "-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
|
156 "-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
|
157 (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
|
158 |
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
|
159 (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
|
160 |
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
|
161 (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
|
162 (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
|
163 (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
|
164 (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
|
165 (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
|
166 (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
|
167 (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
|
168 |
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
|
169 (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
|
170 "Run through current buffer and replace img tags by images." |
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
|
171 (let (tag parameters string start end images url) |
110110
91cc7bab2ca4
gnus-html.el (gnus-html-wash-tags): Remove all <pre_int> place holders.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110109
diff
changeset
|
172 (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
|
173 ;; 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
|
174 (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
|
175 (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
|
176 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
|
177 (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
|
178 (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
|
179 (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
|
180 (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
|
181 (when (string-match "src=\"\\([^\"]+\\)" parameters) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
182 (setq url (gnus-html-encode-url (match-string 1 parameters))) |
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
|
183 (gnus-message 8 "gnus-html-wash-tags: fetching image URL %s" 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
|
184 (if (string-match "^cid:\\(.*\\)" 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
|
185 ;; 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
|
186 ;; 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
|
187 ;; immediately. |
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
|
188 (let* ((handle (mm-get-content-id |
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
|
189 (setq url (match-string 1 url)))) |
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
|
190 (image (when handle |
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
|
191 (gnus-create-image (mm-with-part handle (buffer-string)) |
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
|
192 nil t)))) |
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
|
193 (when image |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
194 (let ((string (buffer-substring start end))) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
195 (delete-region start end) |
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
|
196 (gnus-put-image (gnus-rescale-image image (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
|
197 (gnus-string-or string "*") 'cid) |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
198 (gnus-add-image 'cid 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
|
199 ;; Normal, external URL. |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
200 (let ((alt-text (when (string-match "\\(alt\\|title\\)=\"\\([^\"]+\\)" |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
201 parameters) |
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
|
202 (xml-substitute-special (match-string 2 parameters))))) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
203 (gnus-put-text-property start end 'gnus-image-url url) |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
204 (if (gnus-html-image-url-blocked-p |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
205 url |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
206 (if (buffer-live-p gnus-summary-buffer) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
207 (with-current-buffer gnus-summary-buffer |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
208 gnus-blocked-images) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
209 gnus-blocked-images)) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
210 (progn |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
211 (widget-convert-button |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
212 'link start end |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
213 :action 'gnus-html-insert-image |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
214 :help-echo url |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
215 :keymap gnus-html-image-map |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
216 :button-keymap gnus-html-image-map) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
217 (let ((overlay (gnus-make-overlay start end)) |
110596
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110583
diff
changeset
|
218 (spec (list 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
|
219 (gnus-overlay-put overlay 'local-map gnus-html-image-map) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
220 (gnus-overlay-put overlay 'gnus-image spec) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
221 (gnus-put-text-property |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
222 start end |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
223 'gnus-image spec))) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
224 ;; Non-blocked url |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
225 (let ((width |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
226 (when (string-match "width=\"?\\([0-9]+\\)" parameters) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
227 (string-to-number (match-string 1 parameters)))) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
228 (height |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
229 (when (string-match "height=\"?\\([0-9]+\\)" parameters) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
230 (string-to-number (match-string 1 parameters))))) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
231 ;; Don't fetch images that are really small. They're |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
232 ;; probably tracking pictures. |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
233 (when (and (or (null height) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
234 (> height 4)) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
235 (or (null width) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
236 (> width 4))) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
237 (gnus-html-display-image url start end alt-text)))))))))) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
238 |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
239 (defun gnus-html-display-image (url start end alt-text) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
240 "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
|
241 Use ALT-TEXT for the image string." |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
242 (if (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
|
243 ;; We don't have it, so schedule it for fetching |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
244 ;; asynchronously. |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
245 (gnus-html-schedule-image-fetching |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
246 (current-buffer) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
247 (list url alt-text)) |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
248 ;; It's already cached, so just insert it. |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
249 (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
|
250 |
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
|
251 (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
|
252 (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
|
253 (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
|
254 (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
|
255 |
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
|
256 (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
|
257 ;; 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
|
258 (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
|
259 (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
|
260 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
|
261 start (match-beginning 0)) |
110740
ed9ff0bf7851
Avoid using plusp; cl may not be loaded.
Chong Yidong <cyd@stupidchicken.com>
parents:
110708
diff
changeset
|
262 (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
|
263 (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
|
264 (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
|
265 (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
|
266 (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
|
267 (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
|
268 (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
|
269 ;; 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
|
270 ((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
|
271 ;; 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
|
272 ((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
|
273 (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
|
274 (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
|
275 (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
|
276 (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
|
277 (gnus-article-add-button start end |
110774
276ecc27ad6b
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110768
diff
changeset
|
278 '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
|
279 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
|
280 (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
|
281 (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
|
282 (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
|
283 (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
|
284 (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
|
285 (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
|
286 ;; 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
|
287 ;; should be deleted. |
1e526716f8fc
gnus-html.el: Delete the IMG_ALT region.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110086
diff
changeset
|
288 ((equal tag "IMG_ALT") |
1e526716f8fc
gnus-html.el: Delete the IMG_ALT region.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110086
diff
changeset
|
289 (delete-region start end)) |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
290 ;; w3m does not normalize the case |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
291 ((or (equal tag "b") |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
292 (equal tag "B")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
293 (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
|
294 ((or (equal tag "u") |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
295 (equal tag "U")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
296 (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
|
297 ((or (equal tag "i") |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
298 (equal tag "I")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
299 (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
|
300 ((or (equal tag "s") |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
301 (equal tag "S")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
302 (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
|
303 ((or (equal tag "ins") |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
304 (equal tag "INS")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
305 (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
|
306 ;; Handle different UL types |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
307 ((equal tag "_SYMBOL") |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
308 (when (string-match "TYPE=\\(.+\\)" parameters) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
309 (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
|
310 (delete-region start end) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
311 (cond ((= type 33) (insert " ")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
312 ((= type 34) (insert " ")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
313 ((= type 35) (insert " ")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
314 ((= type 36) (insert " ")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
315 ((= type 37) (insert " ")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
316 ((= type 38) (insert " ")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
317 ((= type 39) (insert " ")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
318 ((= type 40) (insert " ")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
319 ((= type 42) (insert " ")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
320 ((= type 43) (insert " ")) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
321 (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
|
322 ;; 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
|
323 (t |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
324 )) |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
325 (goto-char start)) |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
326 (goto-char (point-min)) |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
327 ;; 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
|
328 ;; 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
|
329 (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
|
330 (replace-match "" t t)) |
110172
f400055a098b
Fix previous merge from Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110170
diff
changeset
|
331 (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
|
332 |
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
|
333 (defun gnus-html-insert-image () |
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
|
334 "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
|
335 (interactive) |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
336 (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
|
337 |
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
|
338 (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
|
339 "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
|
340 (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
|
341 (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
|
342 |
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
|
343 (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
|
344 "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
|
345 (interactive) |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
346 (browse-url (get-text-property (point) 'gnus-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
|
347 |
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
|
348 (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
|
349 "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
|
350 (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
|
351 (let ((url (get-text-property (point) 'gnus-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
|
352 (if (not 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
|
353 (message "No URL at 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
|
354 (browse-url 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
|
355 |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
356 (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
|
357 "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
|
358 (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
|
359 buffer image) |
110698
74bad2d7bddd
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110682
diff
changeset
|
360 (let ((args (list (car image) |
74bad2d7bddd
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110682
diff
changeset
|
361 'gnus-html-image-fetched |
74bad2d7bddd
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110682
diff
changeset
|
362 (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
|
363 (when (> (length (if (featurep 'xemacs) |
110800
751b2ae689b5
[Gnus] Enable XEmacs to display images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110777
diff
changeset
|
364 (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
|
365 (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
|
366 4) |
110698
74bad2d7bddd
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110682
diff
changeset
|
367 (setq args (nconc args (list t)))) |
110777
895607aec71e
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110775
diff
changeset
|
368 (ignore-errors |
895607aec71e
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110775
diff
changeset
|
369 (apply #'url-retrieve args)))) |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
370 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110387
diff
changeset
|
371 (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
|
372 "Callback function called when image has been fetched." |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
373 (unless (plist-get status :error) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
374 (when gnus-html-image-automatic-caching |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
375 (url-store-in-cache (current-buffer))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
376 (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
|
377 (search-forward "\r\n\r\n" nil t)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
378 (buffer-live-p buffer)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
379 (let ((data (buffer-substring (point) (point-max)))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
380 (with-current-buffer buffer |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
381 (let ((inhibit-read-only t)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
382 (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
|
383 (kill-buffer (current-buffer))) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
384 |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
385 (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
|
386 "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
|
387 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
|
388 (with-temp-buffer |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
389 (mm-disable-multibyte) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
390 (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
|
391 (when (or (search-forward "\n\n" nil t) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
392 (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
|
393 (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
|
394 |
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
|
395 (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
|
396 "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
|
397 (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
|
398 (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
|
399 ;; (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
|
400 (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
|
401 ;; 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
|
402 (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
|
403 (* 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
|
404 (- (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
|
405 ;; 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
|
406 (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
|
407 (- (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
|
408 |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
409 (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
|
410 "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
|
411 (when (gnus-graphic-display-p) |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
412 (let* ((start (text-property-any (point-min) (point-max) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
413 'gnus-image-url url)) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
414 (end (when start |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
415 (next-single-property-change start 'gnus-image-url)))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
416 ;; Image found? |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
417 (when start |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
418 (let* ((image |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
419 (ignore-errors |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
420 (gnus-create-image data nil t))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
421 (size (and image |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
422 (if (featurep 'xemacs) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
423 (cons (glyph-width image) (glyph-height image)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
424 (image-size image t))))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
425 (save-excursion |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
426 (goto-char start) |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
427 (let ((alt-text (or alt-text |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
428 (buffer-substring-no-properties start end)))) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
429 (if (and image |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
430 ;; Kludge to avoid displaying 30x30 gif images, which |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
431 ;; 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
|
432 (not (and (if (featurep 'xemacs) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
433 (glyphp image) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
434 (listp image)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
435 (eq (if (featurep 'xemacs) |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
436 (let ((d (cdadar |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
437 (specifier-spec-list |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
438 (glyph-image image))))) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
439 (and (vectorp d) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
440 (aref d 0))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
441 (plist-get (cdr image) :type)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
442 'gif) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
443 (= (car size) 30) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
444 (= (cdr size) 30)))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
445 ;; 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
|
446 (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
|
447 (delete-region start end) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
448 (gnus-put-image image alt-text 'external) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
449 (gnus-put-text-property start (point) 'help-echo alt-text) |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
450 (gnus-overlay-put |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
451 (gnus-make-overlay start (point)) 'local-map |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
452 gnus-html-displayed-image-map) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
453 (gnus-put-text-property start (point) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
454 'gnus-alt-text alt-text) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
455 (when url |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
456 (gnus-put-text-property start (point) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
457 'gnus-image-url url)) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
458 (gnus-add-image 'external image) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
459 t) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
460 ;; Bad image, try to show something else |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
461 (when (fboundp 'find-image) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
462 (delete-region start end) |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
463 (setq image (find-image |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110698
diff
changeset
|
464 '((:type xpm :file "lock-broken.xpm")))) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
465 (gnus-put-image image alt-text 'internal) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
466 (gnus-add-image 'internal image)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
467 nil)))))))) |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
468 |
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
|
469 (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
|
470 "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
|
471 (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
|
472 (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
|
473 (if ret |
ffa0ce354f9d
gnus-html.el: prefix log messages with function name
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110106
diff
changeset
|
474 (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
|
475 url blocked-images) |
ffa0ce354f9d
gnus-html.el: prefix log messages with function name
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110106
diff
changeset
|
476 (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
|
477 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
|
478 ret)) |
7a6012e13748
gnus-html.el: add and use gnus-html-image-url-blocked-p
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110098
diff
changeset
|
479 |
110169
49b2e6d8b396
gnus-html.el: Add the new command gnus-html-show-images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110168
diff
changeset
|
480 (defun gnus-html-show-images () |
49b2e6d8b396
gnus-html.el: Add the new command gnus-html-show-images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110168
diff
changeset
|
481 "Show any images that are in the HTML-rendered article buffer. |
49b2e6d8b396
gnus-html.el: Add the new command gnus-html-show-images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110168
diff
changeset
|
482 This only works if the article in question is HTML." |
49b2e6d8b396
gnus-html.el: Add the new command gnus-html-show-images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110168
diff
changeset
|
483 (interactive) |
49b2e6d8b396
gnus-html.el: Add the new command gnus-html-show-images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110168
diff
changeset
|
484 (gnus-with-article-buffer |
110461
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
485 (dolist (overlay (overlays-in (point-min) (point-max))) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
486 (let ((o (overlay-get overlay 'gnus-image))) |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
487 (when o |
9992c4871bd4
gnus-html.el: Make gnus-html use url-cache system.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110436
diff
changeset
|
488 (apply 'gnus-html-display-image o)))))) |
110169
49b2e6d8b396
gnus-html.el: Add the new command gnus-html-show-images.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110168
diff
changeset
|
489 |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
490 ;;;###autoload |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
491 (defun gnus-html-prefetch-images (summary) |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
492 (when (buffer-live-p summary) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
493 (let ((blocked-images (with-current-buffer summary |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
494 gnus-blocked-images))) |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
495 (save-match-data |
110682
ba6a1c230532
gnus-html.el (gnus-html-prefetch-images): Adjust regexp to avoid regexp backtrace overflows.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
496 (while (re-search-forward "<img[^>]+src=[\"']\\([^\"']+\\)" nil t) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110477
diff
changeset
|
497 (let ((url (gnus-html-encode-url (match-string 1)))) |
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
|
498 (unless (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
|
499 (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
|
500 (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
|
501 (list url)))))))))) |
110025
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
502 |
5f352fd4346a
Misc Gnus fixes by Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110024
diff
changeset
|
503 (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
|
504 |
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
|
505 ;;; gnus-html.el ends here |