From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: with-url Date: Thu, 29 Dec 2016 18:05:09 +0200 Message-ID: <8360m2vhze.fsf@gnu.org> References: <87mvffva75.fsf@gnus.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1483027657 15644 195.159.176.226 (29 Dec 2016 16:07:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 29 Dec 2016 16:07:37 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 29 17:07:33 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cMdEj-0002mJ-Dk for ged-emacs-devel@m.gmane.org; Thu, 29 Dec 2016 17:07:25 +0100 Original-Received: from localhost ([::1]:36179 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMdEo-0006Ol-AU for ged-emacs-devel@m.gmane.org; Thu, 29 Dec 2016 11:07:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMdCk-0005Yt-Jq for emacs-devel@gnu.org; Thu, 29 Dec 2016 11:05:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMdCc-0001gI-BQ for emacs-devel@gnu.org; Thu, 29 Dec 2016 11:05:22 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMdCc-0001gA-7h; Thu, 29 Dec 2016 11:05:14 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1268 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cMdCb-0004VG-Bk; Thu, 29 Dec 2016 11:05:13 -0500 In-reply-to: <87mvffva75.fsf@gnus.org> (message from Lars Ingebrigtsen on Thu, 29 Dec 2016 01:41:02 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210954 Archived-At: > From: Lars Ingebrigtsen > 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.