From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [OT] Icon problem with org-google-weather Date: Tue, 07 Jun 2011 00:53:21 -0400 Message-ID: <5902.1307422401@alphaville.dokosmarshall.org> References: <24071.1307320041@alphaville.dokosmarshall.org> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:55904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QToIY-0003PR-CZ for emacs-orgmode@gnu.org; Tue, 07 Jun 2011 00:53:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QToIW-0005Bx-Bd for emacs-orgmode@gnu.org; Tue, 07 Jun 2011 00:53:49 -0400 Received: from vms173001pub.verizon.net ([206.46.173.1]:62915) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QToIW-0005Aw-8F for emacs-orgmode@gnu.org; Tue, 07 Jun 2011 00:53:48 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173001.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LME00LBKLKYMH80@vms173001.mailsrvcs.net> for emacs-orgmode@gnu.org; Mon, 06 Jun 2011 23:53:34 -0500 (CDT) In-reply-to: Message from Nick Dokos of "Sun, 05 Jun 2011 20:27:21 EDT." <24071.1307320041@alphaville.dokosmarshall.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Nick Dokos wrote: > This is off-topic but it is driving me bananas. I do > > (setq date '(6 5 2011)) > (6 5 2011) > (setq foo (let ((org-google-weather-cache-time 0)) > (org-google-weather))) > (setq bar (org-google-weather)) > (equal foo bar) > (insert foo) > (insert bar) > > in the *scratch* buffer. The idea is that foo is freshly obtained from > google every time: it never goes to cached data since the cache time is > set to 0. bar, otoh, is obtained from cache. I've traced the code and > that's indeed what happens. The two strings compare equal: (equal foo bar) > returns t - just in case, I also displayed them in separate windows and > did a compare-windows: they are the same that way too. > > Nevertheless, when I insert foo, the icon is shown, but when I insert > bar, the icon is an empty box. What am I missing? > It turns out that they *are* different after all: you can't see it in text form, but when the cached file is read, I think some of the bytes get combined into multibyte characters. It finally became visible when I did string-to-list on the image data. Here is the patch to url-cache.el that I'm running with currently - it seems to resolve the problem: --8<---------------cut here---------------start------------->8--- diff -u ~/src/emacs/emacs.repo/emacs/lisp/url/url-cache.el url-cache.el --- /home/nick/src/emacs/emacs.repo/emacs/lisp/url/url-cache.el 2011-03-14 10:54:14.596645931 -0400 +++ url-cache.el 2011-06-07 00:30:35.082826000 -0400 @@ -191,6 +191,7 @@ ;;;###autoload (defun url-cache-extract (fnam) "Extract FNAM from the local disk cache." + (set-buffer-multibyte nil) (erase-buffer) (insert-file-contents-literally fnam)) --8<---------------cut here---------------end--------------->8--- Can somebody who knows about these things give a thumbs-up or -down on this change? If thumbs-down, how should it be fixed? Thanks, Nick PS I must say this was no fun at all. PPS I posted the original question and this result to the emacs list as well.