emacs-devel
[Top][All Lists]
Advanced

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

Re: more url-utils?


From: Ted Zlatanov
Subject: Re: more url-utils?
Date: Mon, 16 May 2011 14:55:02 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

On Mon, 16 May 2011 21:33:55 +0200 Lennart Borgman <address@hidden> wrote: 

LB> 2011/5/16 Ted Zlatanov <address@hidden>:
>> On Mon, 16 May 2011 21:22:02 +0200 Lennart Borgman <address@hidden> wrote:
LB> I would go for Julien's suggestion with a function
LB> `url-remove-headers' which also parsed the headers and returned a
LB> alist of the headers.
>> 
>> I'm trying to avoid that approach: we just established the headers are
>> almost never necessary in the buffer.  So we should not ask the API
>> users to do anything extra to remove them.

LB> It can be combined with your approach with an extra argument.

The existence of `url-remove-headers' is a symptom of a bad API and
should be unnecessary, together with extra arguments.

The usage would be (remember, `url-retrieve-synchronously' is obsoleted
in my proposal in favor or `url-retrieve2-synchronously'):

(if (setq buf (url-retrieve2-synchronously url))
     (with-current-buffer buf
       (message "Header x is %s" (assq 'x url-headers-alist))
       (message "Header y is %s" (assoc "y" url-headers-alist))
       (message "The headers as a string are %s" url-headers-as-string)
       (message "data is %s" (buffer-string))
       ...)
  (...handle errors here...))

which is, I think, how everyone wants to use this function based on
browsing a whole bunch of code.  So inserting the headers would be just
(insert url-headers-as-string) and too trivial to provide as a function.

Ted




reply via email to

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