emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: with-url


From: Eli Zaretskii
Subject: Re: with-url
Date: Thu, 29 Dec 2016 18:05:09 +0200

> From: Lars Ingebrigtsen <address@hidden>
> Date: Thu, 29 Dec 2016 01:41:02 +0100
> 
> First of all, the basic form looks like this:
> 
>   (with-url (headers "http://fsf.org/";)
>     (message "The size of the FSF front page is %s" (buffer-size)))

I'm probably missing something, but why do you need a macro?  The
description seems to say that BODY is executed with point in a buffer
with the response, so why not just set up that buffer and return with
it as the current buffer?  Or maybe even introduce a function very
similar to url-retrieve, but without the mess with encoding/unibyte
etc.?

As for the syntax, this macro looks unusual to me, certainly wrt other
with-SOMETHING macros, in that it accepts a list of arguments of
variable length and contents.  But that's me.

A few comments to the doc string:

> :headers ALIST
> Add ALIST to the headers sent over to the server.  This should typically
> look like
> 
>   (("User-Agent" "Emacs"))

What about unibyte/multibyte issue in the headers?  Should that be
encoded by the caller?

> Additional elements in this alist are interpreted as the
> charset (defaulting to utf-8) and the encoding method (defaulting
> to url-encode).

Please don't use "charset" when you really mean "coding-system".  In
Emacs parlance, "charset" means something very different (and "utf-8"
is not a charset in that meaning), so this will spread confusion.

Also, why should the default be UTF-8?  Isn't the system locale's
codeset a better default?  The URL doesn't have to be on another
machine, right?

> :method GET/POST/etc
> The method to use for retrieving an HTTP(S) resource.  This defaults
> to GET, and other popular values are POST, UPDATE and PUT.

Does thus mean this macro is only for HTTP/HTTPS?

> :data-charset CHARSET
> What charset this data should be interpreted as.  This defaults
> to UTF-8.

Once again, not "charset".  And this is not about interpretation, this
is about encoding and/or decoding.

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]