- (let* ((data (google-weather-get-data (or location
- org-google-weather-location)
- language
- org-google-weather-cache-time))
- (forecast (google-weather-data->forecast-for-date data date)))
- (when forecast
- (let ((condition (cadr (assoc 'condition forecast)))
- (low (cadr (assoc 'low forecast)))
- (high (cadr (assoc 'high forecast)))
- (city (google-weather-data->city data))
- ;; But *they* told me it's just about calling functions!
- (icon (when (window-system)
- (cdr
- (assoc
- (intern
- (file-name-sans-extension
- (file-name-nondirectory
- (cadr (assoc 'icon forecast)))))
- org-google-weather-icon-alist))))
- (temp-symbol (google-weather-data->temperature-symbol data)))
- (format-spec org-google-weather-format
- `((?i . ,(if (and icon org-google-weather-display-icon-p)
- (propertize "icon"
- 'display
- (create-image
- (concat
- org-google-weather-icon-directory
- "/"
- icon))
- 'rear-nonsticky '(display))
- ""))
- (?c . ,condition)
- (?L . ,location)
- (?C . ,city)
- (?l . ,low)
- (?h . ,high)
- (?s . ,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 'condition forecast)))
+ (low (cadr (assoc 'low forecast)))
+ (high (cadr (assoc 'high forecast)))
+ (city (google-weather-data->city data))
+ ;; But *they* told me it's just about calling functions!
+ (icon (when (and org-google-weather-display-icon-p (display-images-p))
+ (if org-google-weather-use-google-icons
+ (create-image (org-google-weather-get-icon
+ (cadr (assoc 'icon forecast)))
+ nil t)
+ (create-image
+ (concat
+ org-google-weather-icon-directory
+ "/"
+ (cdr
+ (assoc
+ (intern
+ (file-name-sans-extension
+ (file-name-nondirectory
+ (cadr (assoc 'icon forecast)))))
+ org-google-weather-icon-alist)))))))
+ (temp-symbol (google-weather-data->temperature-symbol data)))
+ (format-spec org-google-weather-format
+ `((?i . ,(if icon
+ (propertize "icon"
+ 'display
+ (append
+ icon '(:ascent center))
+ 'rear-nonsticky '(display))
+ ""))
+ (?c . ,condition)
+ (?L . ,location)
+ (?C . ,city)
+ (?l . ,low)
+ (?h . ,high)
+ (?s . ,temp-symbol))))))))