From: Nick Dokos <nicholas.dokos@hp.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: [OT] Icon problem with org-google-weather
Date: Tue, 07 Jun 2011 00:53:21 -0400 [thread overview]
Message-ID: <5902.1307422401@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Nick Dokos <nicholas.dokos@hp.com> of "Sun, 05 Jun 2011 20:27:21 EDT." <24071.1307320041@alphaville.dokosmarshall.org>
Nick Dokos <nicholas.dokos@hp.com> 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.
prev parent reply other threads:[~2011-06-07 4:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 0:27 [OT] Icon problem with org-google-weather Nick Dokos
2011-06-06 7:38 ` Tassilo Horn
2011-06-06 13:51 ` Nick Dokos
2011-06-06 15:27 ` Tassilo Horn
2011-06-06 15:40 ` Nick Dokos
2011-06-06 16:35 ` Nick Dokos
2011-06-07 4:53 ` Nick Dokos [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5902.1307422401@alphaville.dokosmarshall.org \
--to=nicholas.dokos@hp.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).