[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: |
Tassilo Horn |
Subject: |
Re: [O] [OT] Icon problem with org-google-weather |
Date: |
Mon, 06 Jun 2011 09:38:32 +0200 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
Nick Dokos <address@hidden> writes:
> 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?
I have a similar problem. In one of my org files, I have
%%(org-google-weather "Montabaur" "de")
and since lately, I get only squares.
That said, while trying your example, `org-google-weather' always
returned nil. The reason is that I don't have
`org-google-weather-location' set explicitly to something different as
the default value. But that default is a form and it is never evaluated
AFAICS. So that seems to be another bug.
Ok, so when I change your testcase to this...
--8<---------------cut here---------------start------------->8---
(defun foobar ()
(interactive)
(let ((date '(6 6 2011)))
(setq bar (org-google-weather "Montabaur" "DE"))
(setq foo (let ((org-google-weather-cache-time 0))
(org-google-weather "Montabaur" "DE")))
(string= foo bar)
(insert foo)
(insert bar)))
--8<---------------cut here---------------end--------------->8---
I get an error at the foo value evaluation. The evaluation of bar seems
to work fine...
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Data not found")
signal(error ("Data not found"))
error("Data not found")
(if (search-forward "\n\n" nil t) nil (error "Data not found"))
(unless (search-forward "\n\n" nil t) (error "Data not found"))
(save-current-buffer (set-buffer (google-weather-retrieve-data-raw url
org-google-weather-cache-time)) (unless (search-forward "\n\n" nil t) (error
"Data not found")) (let ((data (buffer-substring (point) (point-max))))
(kill-buffer (current-buffer)) data))
(with-current-buffer (google-weather-retrieve-data-raw url
org-google-weather-cache-time) (unless (search-forward "\n\n" nil t) (error
"Data not found")) (let ((data (buffer-substring (point) (point-max))))
(kill-buffer (current-buffer)) data))
org-google-weather-get-icon("http://g0.gstatic.com/images/icons/onebox/weather_scatteredthunderstorms-40.gif")
(create-image (org-google-weather-get-icon (cadr (assoc (quote icon)
forecast))) nil t)
(progn (create-image (org-google-weather-get-icon (cadr (assoc (quote icon)
forecast))) nil t))
(if (display-images-p) (progn (create-image (org-google-weather-get-icon
(cadr (assoc (quote icon) forecast))) nil t)))
(when (display-images-p) (create-image (org-google-weather-get-icon (cadr
(assoc (quote icon) forecast))) nil t))
(let ((condition (cadr (assoc (quote condition) forecast))) (low (cadr (assoc
(quote low) forecast))) (high (cadr (assoc (quote high) forecast))) (city
(google-weather-data->city data)) (icon (when (display-images-p) (create-image
(org-google-weather-get-icon (cadr (assoc ... forecast))) nil t))) (temp-symbol
(google-weather-data->temperature-symbol data))) (format-spec
org-google-weather-format (\` ((105 \, (if (and icon
org-google-weather-display-icon-p) (propertize "icon" (quote display) (append
icon ...) (quote rear-nonsticky) (quote ...)) "")) (99 \, condition) (76 \,
location) (67 \, city) (108 \, low) (104 \, high) (115 \, temp-symbol)))))
(progn (let ((condition (cadr (assoc (quote condition) forecast))) (low (cadr
(assoc (quote low) forecast))) (high (cadr (assoc (quote high) forecast)))
(city (google-weather-data->city data)) (icon (when (display-images-p)
(create-image (org-google-weather-get-icon (cadr ...)) nil t))) (temp-symbol
(google-weather-data->temperature-symbol data))) (format-spec
org-google-weather-format (\` ((105 \, (if (and icon
org-google-weather-display-icon-p) (propertize "icon" ... ... ... ...) "")) (99
\, condition) (76 \, location) (67 \, city) (108 \, low) (104 \, high) (115 \,
temp-symbol))))))
(if forecast (progn (let ((condition (cadr (assoc (quote condition)
forecast))) (low (cadr (assoc (quote low) forecast))) (high (cadr (assoc (quote
high) forecast))) (city (google-weather-data->city data)) (icon (when
(display-images-p) (create-image (org-google-weather-get-icon ...) nil t)))
(temp-symbol (google-weather-data->temperature-symbol data))) (format-spec
org-google-weather-format (\` ((105 \, (if ... ... "")) (99 \, condition) (76
\, location) (67 \, city) (108 \, low) (104 \, high) (115 \, temp-symbol)))))))
(when forecast (let ((condition (cadr (assoc (quote condition) forecast)))
(low (cadr (assoc (quote low) forecast))) (high (cadr (assoc (quote high)
forecast))) (city (google-weather-data->city data)) (icon (when
(display-images-p) (create-image (org-google-weather-get-icon (cadr ...)) nil
t))) (temp-symbol (google-weather-data->temperature-symbol data))) (format-spec
org-google-weather-format (\` ((105 \, (if (and icon
org-google-weather-display-icon-p) (propertize "icon" ... ... ... ...) "")) (99
\, condition) (76 \, location) (67 \, city) (108 \, low) (104 \, high) (115 \,
temp-symbol))))))
(if problem-cause (message "%s: %s" location problem-cause) (when forecast
(let ((condition (cadr (assoc (quote condition) forecast))) (low (cadr (assoc
(quote low) forecast))) (high (cadr (assoc (quote high) forecast))) (city
(google-weather-data->city data)) (icon (when (display-images-p) (create-image
(org-google-weather-get-icon ...) nil t))) (temp-symbol
(google-weather-data->temperature-symbol data))) (format-spec
org-google-weather-format (\` ((105 \, (if ... ... "")) (99 \, condition) (76
\, location) (67 \, city) (108 \, low) (104 \, high) (115 \, temp-symbol)))))))
(let* ((location (or location org-google-weather-location)) (data
(ignore-errors (google-weather-get-data location language
org-google-weather-cache-time))) (problem-cause (when data
(google-weather-data->problem-cause data))) (forecast (when (and (null
problem-cause) data) (google-weather-data->forecast-for-date data date)))) (if
problem-cause (message "%s: %s" location problem-cause) (when forecast (let
((condition (cadr (assoc ... forecast))) (low (cadr (assoc ... forecast)))
(high (cadr (assoc ... forecast))) (city (google-weather-data->city data))
(icon (when (display-images-p) (create-image ... nil t))) (temp-symbol
(google-weather-data->temperature-symbol data))) (format-spec
org-google-weather-format (\` ((105 \, ...) (99 \, condition) (76 \, location)
(67 \, city) (108 \, low) (104 \, high) (115 \, temp-symbol))))))))
org-google-weather("Montabaur" "DE")
(let ((org-google-weather-cache-time 0)) (org-google-weather "Montabaur"
"DE"))
(setq foo (let ((org-google-weather-cache-time 0)) (org-google-weather
"Montabaur" "DE")))
(let ((date (quote (6 6 2011)))) (setq foo (let
((org-google-weather-cache-time 0)) (org-google-weather "Montabaur" "DE")))
(setq bar (org-google-weather "Montabaur" "DE")) (string= foo bar) (insert foo)
(insert bar))
eval((let ((date (quote (6 6 2011)))) (setq foo (let
((org-google-weather-cache-time 0)) (org-google-weather "Montabaur" "DE")))
(setq bar (org-google-weather "Montabaur" "DE")) (string= foo bar) (insert foo)
(insert bar)) nil)
eval-last-sexp-1(nil)
eval-last-sexp(nil)
call-interactively(eval-last-sexp nil nil)
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
Re: [O] [OT] Icon problem with org-google-weather, Nick Dokos, 2011/06/07