* Garbled up html output
@ 2020-11-21 22:47 Partha Pratim Ghosh
2020-11-22 11:30 ` Pankaj Jangid
0 siblings, 1 reply; 4+ messages in thread
From: Partha Pratim Ghosh @ 2020-11-21 22:47 UTC (permalink / raw)
To: Help Gnu Emacs
Dear All,
I used _curl wttr.in_ on a terminal; it produced a nice formatted
message.
However _M-x wttrin_ inside emacs produces a buffer with html text; the
table appears way down, but the output is not formatted.
Please can some one help in this...
With my regards and all the very best wishes,
partha
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Garbled up html output
2020-11-21 22:47 Garbled up html output Partha Pratim Ghosh
@ 2020-11-22 11:30 ` Pankaj Jangid
2020-11-22 21:07 ` Partha Pratim Ghosh
0 siblings, 1 reply; 4+ messages in thread
From: Pankaj Jangid @ 2020-11-22 11:30 UTC (permalink / raw)
To: Partha Pratim Ghosh; +Cc: Help Gnu Emacs, Carl X. Su
Partha Pratim Ghosh <ghosh.parthapratim.unisa@gmail.com> writes:
> I used _curl wttr.in_ on a terminal; it produced a nice formatted
> message.
>
> However _M-x wttrin_ inside emacs produces a buffer with html text; the
> table appears way down, but the output is not formatted.
The package is not updated. Following two fragments need update. I have
also created a pull request on github and cc'ing the maintainer here.
#+begin_src emacs-lisp
(defcustom wttrin-default-accept-language "en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4"
"Specify default HTTP request Header for Accept-Language."
:group 'wttrin
:type '(list)
)
(defun wttrin-fetch-raw-string (query)
"Get the weather information based on your QUERY."
(let ((url-user-agent "curl")
(url-mime-language-string wttrin-default-accept-language))
(with-current-buffer
(url-retrieve-synchronously
(concat "http://wttr.in/" query)
(lambda (status) (switch-to-buffer (current-buffer))))
(decode-coding-string (buffer-string) 'utf-8))))
#+end_src
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Garbled up html output
2020-11-22 11:30 ` Pankaj Jangid
@ 2020-11-22 21:07 ` Partha Pratim Ghosh
2020-11-23 2:44 ` Pankaj Jangid
0 siblings, 1 reply; 4+ messages in thread
From: Partha Pratim Ghosh @ 2020-11-22 21:07 UTC (permalink / raw)
To: Pankaj Jangid; +Cc: Help Gnu Emacs
Dear Pankaj,
Please accept my thanks for replying to the query.
I tried to run your script from .emacs file.
After this I tried _M-x wttrin_ and it returned the error: wrong
argument type listp: "en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4"
Please can you suugest further changes and/help...
With my regards and all the very best wishes,
partha
Pankaj Jangid <pankaj@codeisgreat.org> writes:
> Partha Pratim Ghosh <ghosh.parthapratim.unisa@gmail.com> writes:
>
>> I used _curl wttr.in_ on a terminal; it produced a nice formatted
>> message.
>>
>> However _M-x wttrin_ inside emacs produces a buffer with html text; the
>> table appears way down, but the output is not formatted.
>
> The package is not updated. Following two fragments need update. I have
> also created a pull request on github and cc'ing the maintainer here.
>
> #+begin_src emacs-lisp
> (defcustom wttrin-default-accept-language "en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4"
> "Specify default HTTP request Header for Accept-Language."
> :group 'wttrin
> :type '(list)
> )
>
> (defun wttrin-fetch-raw-string (query)
> "Get the weather information based on your QUERY."
> (let ((url-user-agent "curl")
> (url-mime-language-string wttrin-default-accept-language))
> (with-current-buffer
> (url-retrieve-synchronously
> (concat "http://wttr.in/" query)
> (lambda (status) (switch-to-buffer (current-buffer))))
> (decode-coding-string (buffer-string) 'utf-8))))
> #+end_src
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Garbled up html output
2020-11-22 21:07 ` Partha Pratim Ghosh
@ 2020-11-23 2:44 ` Pankaj Jangid
0 siblings, 0 replies; 4+ messages in thread
From: Pankaj Jangid @ 2020-11-23 2:44 UTC (permalink / raw)
To: Partha Pratim Ghosh; +Cc: Help Gnu Emacs
Partha Pratim Ghosh <ghosh.parthapratim.unisa@gmail.com> writes:
> I tried to run your script from .emacs file.
>
> After this I tried _M-x wttrin_ and it returned the error: wrong
> argument type listp: "en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4"
My changes were not for .emacs file. You will have to replace functions
in the package. Somewhere in your **/elpa/wttrin.el. And remove the
compiled version (.elc). This is just a workaround till you get update
from MELPA.
> Please can you suugest further changes and/help...
The below var and func are already defined in wttrin.el. You just have to
replace them with the code below.
>> #+begin_src emacs-lisp
>> (defcustom wttrin-default-accept-language "en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4"
>> "Specify default HTTP request Header for Accept-Language."
>> :group 'wttrin
>> :type '(list)
>> )
>>
>> (defun wttrin-fetch-raw-string (query)
>> "Get the weather information based on your QUERY."
>> (let ((url-user-agent "curl")
>> (url-mime-language-string wttrin-default-accept-language))
>> (with-current-buffer
>> (url-retrieve-synchronously
>> (concat "http://wttr.in/" query)
>> (lambda (status) (switch-to-buffer (current-buffer))))
>> (decode-coding-string (buffer-string) 'utf-8))))
>> #+end_src
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-23 2:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-21 22:47 Garbled up html output Partha Pratim Ghosh
2020-11-22 11:30 ` Pankaj Jangid
2020-11-22 21:07 ` Partha Pratim Ghosh
2020-11-23 2:44 ` Pankaj Jangid
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).