aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2010-08-31 21:47:35 +0200
committerStefan Monnier2010-08-31 21:47:35 +0200
commit2d217ead4c0a5c83612752a3f5ed326be788bbbb (patch)
treefd428c743b9d1130e25dfeccd18c4525d181e61c
parentb819f760b16314638fb374e73eeb0fba3c60b5c6 (diff)
downloademacs-2d217ead4c0a5c83612752a3f5ed326be788bbbb.tar.gz
emacs-2d217ead4c0a5c83612752a3f5ed326be788bbbb.zip
* lisp/gnus/gnus-html.el: Require pkgs that define macros used in this file.
(gnus-article-mouse-face): Declare to silence byte-compiler. (gnus-html-curl-sentinel): Use with-current-buffer, inhibit-read-only, and process-get. (gnus-html-put-image): Use plist-get to avoid getf. (gnus-html-prefetch-images): Use with-current-buffer.
-rw-r--r--lisp/gnus/ChangeLog9
-rw-r--r--lisp/gnus/gnus-html.el22
2 files changed, 21 insertions, 10 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 03d96b6f36f..c5a03a18d55 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,12 @@
12010-08-31 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * gnus-html.el: Require packages that define macros used in this file.
4 (gnus-article-mouse-face): Declare to silence byte-compiler.
5 (gnus-html-curl-sentinel): Use with-current-buffer, inhibit-read-only, and
6 process-get.
7 (gnus-html-put-image): Use plist-get to avoid getf.
8 (gnus-html-prefetch-images): Use with-current-buffer.
9
12010-08-31 Katsumi Yamaoka <yamaoka@jpl.org> 102010-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
2 11
3 * gnus-sum.el (gnus-summary-stop-at-end-of-message) 12 * gnus-sum.el (gnus-summary-stop-at-end-of-message)
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index 542d1401a80..bf26fb7e626 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -28,6 +28,8 @@
28 28
29;;; Code: 29;;; Code:
30 30
31(eval-when-compile (require 'cl))
32(eval-when-compile (require 'mm-decode))
31(require 'mm-url) 33(require 'mm-url)
32 34
33(defcustom gnus-html-cache-directory (nnheader-concat gnus-directory "html-cache/") 35(defcustom gnus-html-cache-directory (nnheader-concat gnus-directory "html-cache/")
@@ -71,6 +73,8 @@
71 "-T" "text/html")))) 73 "-T" "text/html"))))
72 (gnus-html-wash-tags)))) 74 (gnus-html-wash-tags))))
73 75
76(defvar gnus-article-mouse-face)
77
74(defun gnus-html-wash-tags () 78(defun gnus-html-wash-tags ()
75 (let (tag parameters string start end images url) 79 (let (tag parameters string start end images url)
76 (mm-url-decode-entities) 80 (mm-url-decode-entities)
@@ -162,19 +166,18 @@
162 166
163(defun gnus-html-curl-sentinel (process event) 167(defun gnus-html-curl-sentinel (process event)
164 (when (string-match "finished" event) 168 (when (string-match "finished" event)
165 (let* ((images (getf (process-plist process) 'images)) 169 (let* ((images (process-get process 'images))
166 (buffer (getf (process-plist process) 'buffer)) 170 (buffer (process-get process 'buffer))
167 (spec (pop images)) 171 (spec (pop images))
168 (file (gnus-html-image-id (car spec)))) 172 (file (gnus-html-image-id (car spec))))
169 (when (and (buffer-live-p buffer) 173 (when (and (buffer-live-p buffer)
170 ;; If the position of the marker is 1, then that 174 ;; If the position of the marker is 1, then that
171 ;; means that the text is was in has been deleted; 175 ;; means that the text it was in has been deleted;
172 ;; i.e., that the user has selected a different 176 ;; i.e., that the user has selected a different
173 ;; article before the image arrived. 177 ;; article before the image arrived.
174 (not (= (marker-position (cadr spec)) 1))) 178 (not (= (marker-position (cadr spec)) (point-min))))
175 (save-excursion 179 (with-current-buffer buffer
176 (set-buffer buffer) 180 (let ((inhibit-read-only t))
177 (let ((buffer-read-only nil))
178 (when (gnus-html-put-image file (cadr spec)) 181 (when (gnus-html-put-image file (cadr spec))
179 (delete-region (1+ (cadr spec)) (caddr spec)))))) 182 (delete-region (1+ (cadr spec)) (caddr spec))))))
180 (when images 183 (when images
@@ -190,7 +193,7 @@
190 ;; Kludge to avoid displaying 30x30 gif images, which 193 ;; Kludge to avoid displaying 30x30 gif images, which
191 ;; seems to be a signal of a broken image. 194 ;; seems to be a signal of a broken image.
192 (not (and (listp image) 195 (not (and (listp image)
193 (eq (getf (cdr image) :type) 'gif) 196 (eq (plist-get (cdr image) :type) 'gif)
194 (= (car (image-size image t)) 30) 197 (= (car (image-size image t)) 30)
195 (= (cdr (image-size image t)) 30)))) 198 (= (cdr (image-size image t)) 30))))
196 (progn 199 (progn
@@ -223,8 +226,7 @@
223(defun gnus-html-prefetch-images (summary) 226(defun gnus-html-prefetch-images (summary)
224 (let (safe-url-regexp urls) 227 (let (safe-url-regexp urls)
225 (when (buffer-live-p summary) 228 (when (buffer-live-p summary)
226 (save-excursion 229 (with-current-buffer summary
227 (set-buffer summary)
228 (setq safe-url-regexp mm-w3m-safe-url-regexp)) 230 (setq safe-url-regexp mm-w3m-safe-url-regexp))
229 (save-match-data 231 (save-match-data
230 (while (re-search-forward "<img.*src=[\"']\\([^\"']+\\)" nil t) 232 (while (re-search-forward "<img.*src=[\"']\\([^\"']+\\)" nil t)