diff options
| author | Craig Jennings <craigmartinjennings@gmail.com> | 2021-08-25 12:21:38 -0500 |
|---|---|---|
| committer | Craig Jennings <craigmartinjennings@gmail.com> | 2021-08-25 12:21:38 -0500 |
| commit | 58104cc393ea3f945b669e1c5f7b4d9861c8681f (patch) | |
| tree | 5004c915ddbf0c3775049400a751cdab89c1fe47 /wttrin.el | |
| parent | 121c59ea5c474a24f4364c8b82b5d9795a752553 (diff) | |
applying outstanding patches
This fork has the following patches applied (still outstanding in bcbcarl/emacs-wttrin):
- patch for selecting the unit system: https://github.com/bcbcarl/emacs-wttrin/pull/10
- patch for url request to return ascii rather than html https://github.com/bcbcarl/emacs-wttrin/pull/18
- patch to use https instead of http: https://github.com/bcbcarl/emacs-wttrin/pull/15
Diffstat (limited to 'wttrin.el')
| -rw-r--r-- | wttrin.el | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -33,13 +33,26 @@ :type '(list) ) +(defcustom wttrin-unit-system nil + "Specify the units. use 'm' for 'metric', 'u' for 'USCS, or +nil for location based units (the default)" + :group 'wttrin + :type 'string + ) + +(defun wttrin-additional-url-params () + "Concatenate any extra stuff into the URL here." + (concat "?" wttrin-unit-system) + ) + + (defun wttrin-fetch-raw-string (query) "Get the weather information based on your QUERY." (let ((url-user-agent "curl")) (add-to-list 'url-request-extra-headers wttrin-default-accept-language) (with-current-buffer (url-retrieve-synchronously - (concat "https://wttr.in/" query "?A") + (concat "http://wttr.in/" query (wttrin-additional-url-params)) (lambda (status) (switch-to-buffer (current-buffer)))) (decode-coding-string (buffer-string) 'utf-8)))) |
