From 72d6d83d7ae48b27ed0358d2982cdea872816b4e Mon Sep 17 00:00:00 2001 From: Yuto Hayamizu Date: Fri, 8 Jan 2010 19:17:49 +0900 Subject: [PATCH] some bug fix on image retrieval (twittering-image-type): bug fix in the case of bitmap (twittering-retrieve-image): handle error of determining image type. (twittering-image-type): let case-fold-search is t. --- ChangeLog | 4 ++++ twittering-mode.el | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2320d45..2738db1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -74,6 +74,10 @@ (twittering-retrieve-image-with-wget): delete (twittering-retrieve-image): changed default image type from png to xpm + (twittering-image-type): bug fix in the case of bitmap + (twittering-retrieve-image): handle error of determining image + type. + (twittering-image-type): let case-fold-search is t. * url-emacs21/*: add url library for emacs21 diff --git a/twittering-mode.el b/twittering-mode.el index 5bae191f..4471b958 100644 --- a/twittering-mode.el +++ b/twittering-mode.el @@ -317,7 +317,8 @@ invoking \"convert\". Otherwise, cropped images are displayed.") (defun twittering-image-type (image-url buffer) "Return the type of a given image based on the URL(IMAGE-URL) and its contents(BUFFER)" - (let ((type-cache (assoc image-url twittering-image-type-cache))) + (let ((type-cache (assoc image-url twittering-image-type-cache)) + (case-fold-search t)) (if type-cache (cdr type-cache) (let ((image-type @@ -332,11 +333,11 @@ and its contents(BUFFER)" nil res-buf nil "-b" "-"))) (let ((file-output (buffer-string))) (cond - ((string-match "JPEG" file-output) 'jpeg) - ((string-match "PNG" file-output) 'png) - ((string-match "GIF" file-output) 'gif) - ((string-match "bitmap" 'bitmap)) - (t nil))))) + ((string-match "JPEG" file-output) 'jpeg) + ((string-match "PNG" file-output) 'png) + ((string-match "GIF" file-output) 'gif) + ((string-match "bitmap" file-output) 'bitmap) + (t nil))))) ((string-match "\\.jpe?g\\(\\?[^/]+\\)?$" image-url) 'jpeg) ((string-match "\\.png\\(\\?[^/]+\\)?$" image-url) 'png) ((string-match "\\.gif\\(\\?[^/]+\\)?$" image-url) 'gif) @@ -1977,7 +1978,8 @@ following symbols; (point-min) (point-max) twittering-convert-program t t nil - (format "%s:-" image-type) "-resize" + (if image-type (format "%s:-" image-type) "-") + "-resize" (format "%dx%d" twittering-convert-fix-size twittering-convert-fix-size) "xpm:-")