diff options
| -rw-r--r-- | lisp/gnus/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/gnus/shr.el | 21 |
2 files changed, 26 insertions, 1 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index a2371a51b48..95486cbca3f 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-10-05 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 2 | |||
| 3 | * shr.el (shr-encode-url-chars): New function, that's an alias to | ||
| 4 | browse-url-url-encode-chars or a copy of it. | ||
| 5 | (shr-tag-img): Use it. | ||
| 6 | |||
| 1 | 2010-10-04 Lars Magne Ingebrigtsen <larsi@gnus.org> | 7 | 2010-10-04 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 8 | ||
| 3 | * shr.el (shr-tag-blockquote): Ensure paragraph after quote, too. | 9 | * shr.el (shr-tag-blockquote): Ensure paragraph after quote, too. |
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el index 59d7b784a1f..e97ca1da47a 100644 --- a/lisp/gnus/shr.el +++ b/lisp/gnus/shr.el | |||
| @@ -191,6 +191,25 @@ redirects somewhere else." | |||
| 191 | (copy-region-as-kill (point-min) (point-max)) | 191 | (copy-region-as-kill (point-min) (point-max)) |
| 192 | (message "Copied %s" url)))))) | 192 | (message "Copied %s" url)))))) |
| 193 | 193 | ||
| 194 | (eval-and-compile | ||
| 195 | (defalias 'shr-encode-url-chars | ||
| 196 | ;; Neither Emacs 22 nor XEmacs provides this function. | ||
| 197 | (if (fboundp 'browse-url-url-encode-chars) | ||
| 198 | 'browse-url-url-encode-chars | ||
| 199 | (lambda (text chars) | ||
| 200 | "URL-encode the chars in TEXT that match CHARS. | ||
| 201 | CHARS is a regexp-like character alternative (e.g., \"[)$]\")." | ||
| 202 | (let ((encoded-text (copy-sequence text)) | ||
| 203 | (s 0)) | ||
| 204 | (while (setq s (string-match chars encoded-text s)) | ||
| 205 | (setq encoded-text | ||
| 206 | (replace-match (format "%%%x" | ||
| 207 | (string-to-char | ||
| 208 | (match-string 0 encoded-text))) | ||
| 209 | t t encoded-text) | ||
| 210 | s (1+ s))) | ||
| 211 | encoded-text))))) | ||
| 212 | |||
| 194 | (defun shr-tag-img (cont) | 213 | (defun shr-tag-img (cont) |
| 195 | (when (and (> (current-column) 0) | 214 | (when (and (> (current-column) 0) |
| 196 | (not (eq shr-state 'image))) | 215 | (not (eq shr-state 'image))) |
| @@ -204,7 +223,7 @@ redirects somewhere else." | |||
| 204 | ((and shr-blocked-images | 223 | ((and shr-blocked-images |
| 205 | (string-match shr-blocked-images url)) | 224 | (string-match shr-blocked-images url)) |
| 206 | (insert alt)) | 225 | (insert alt)) |
| 207 | ((url-is-cached (browse-url-url-encode-chars url "[&)$ ]")) | 226 | ((url-is-cached (shr-encode-url-chars url "[&)$ ]")) |
| 208 | (shr-put-image (shr-get-image-data url) (point) alt)) | 227 | (shr-put-image (shr-get-image-data url) (point) alt)) |
| 209 | (t | 228 | (t |
| 210 | (insert alt) | 229 | (insert alt) |