summaryrefslogtreecommitdiff
path: root/lisp/gnus/shr.el
diff options
context:
space:
mode:
authorGnus developers <ding@gnus.org>2011-05-31 22:08:51 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2011-05-31 22:08:51 +0000
commit2da9c605f8b27d3d23c303e8d02dbe1623efee01 (patch)
treeec210ec6663686962f617e202119125a0e825f74 /lisp/gnus/shr.el
parent30a235016ebe8326593b16ed42daeeaa4dead526 (diff)
downloademacs-2da9c605f8b27d3d23c303e8d02dbe1623efee01.tar.gz
Merge changes made in Gnus trunk.
gnus.texi (Store custom flags and keywords): Refer to `gnus-registry-article-marks-to-{chars,names}' instead of `gnus-registry-user-format-function-{M,M2}'. shr.el (shr-rescale-image): Add an :ascent of 100 to images so that the underline comes at the bottom. gnus-registry.el (gnus-registry-article-marks-to-chars): Rename from `gnus-registry-user-format-function-M' and declare the latter obsolete. (gnus-registry-article-marks-to-names): Rename from `gnus-registry-user-format-function-M2'. shr.el (shr-browse-image): Copy the URL if called interactively.
Diffstat (limited to 'lisp/gnus/shr.el')
-rw-r--r--lisp/gnus/shr.el32
1 files changed, 22 insertions, 10 deletions
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index ebd854930df..67effc07ee2 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -183,14 +183,23 @@ redirects somewhere else."
(message "No image under point")
(message "%s" text))))
-(defun shr-browse-image ()
- "Browse the image under point."
- (interactive)
+(defun shr-browse-image (&optional copy-url)
+ "Browse the image under point.
+If COPY-URL (the prefix if called interactively) is non-nil, copy
+the URL of the image to the kill buffer instead."
+ (interactive "P")
(let ((url (get-text-property (point) 'image-url)))
- (if (not url)
- (message "No image under point")
+ (cond
+ ((not url)
+ (message "No image under point"))
+ (copy-url
+ (with-temp-buffer
+ (insert url)
+ (copy-region-as-kill (point-min) (point-max))
+ (message "Copied %s" url)))
+ (t
(message "Browsing %s..." url)
- (browse-url url))))
+ (browse-url url)))))
(defun shr-insert-image ()
"Insert the image under point into the buffer."
@@ -524,8 +533,9 @@ redirects somewhere else."
(defun shr-rescale-image (data)
(if (or (not (fboundp 'imagemagick-types))
(not (get-buffer-window (current-buffer))))
- (create-image data nil t)
- (let* ((image (create-image data nil t))
+ (create-image data nil t
+ :ascent 100)
+ (let* ((image (create-image data nil t :ascent 100))
(size (image-size image t))
(width (car size))
(height (cdr size))
@@ -544,11 +554,13 @@ redirects somewhere else."
(when (> (car size) window-width)
(setq image (or
(create-image data 'imagemagick t
- :width window-width)
+ :width window-width
+ :ascent 100)
image)))
(when (and (fboundp 'create-animated-image)
(eq (image-type data nil t) 'gif))
- (setq image (create-animated-image data 'gif t)))
+ (setq image (create-animated-image data 'gif t
+ :ascent 100)))
image)))
;; url-cache-extract autoloads url-cache.