[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [OT] Icon problem with org-google-weather
From: |
Nick Dokos |
Subject: |
Re: [O] [OT] Icon problem with org-google-weather |
Date: |
Tue, 07 Jun 2011 00:53:21 -0400 |
Nick Dokos <address@hidden> 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.
Re: [O] [OT] Icon problem with org-google-weather,
Nick Dokos <=