[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: more url-utils?
From: |
joakim |
Subject: |
Re: more url-utils? |
Date: |
Mon, 16 May 2011 19:04:25 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Tom Tromey <address@hidden> writes:
>>>>>> "Stefan" == Stefan Monnier <address@hidden> writes:
>
> Stefan> While Emacs uses them a lot, dynamically-scoped variables used as
> Stefan> implicit extra parameters are bad. In many cases, it's difficult to
> Stefan> avoid using them, but in this case, calling a function after the
> Stefan> url-retrieve call works just as well, so there's no excuse.
>
> IIRC, in package.el I had to special-case some URL types, because
> headers are inconsistently used. E.g., I think the 'ftp' method won't
> leave headers in the buffer. It would be nice if this bit were handled
> by the url package rather than all the callers.
Changing
(url-retrieve-synchronously URL)
To
(url-retrieve-synchronously URL &optional remove-headers)
ought to sattisfy all participants in this thread?
and it could be done somewhat like this:
(defun url-retrieve-synchronously (url &optional remove-headers)
(let ((buffer (url-retrieve-synchronously-old-implementation url))
(if remove-headers
(url-remove-headers buffer
))))
(defun url-remove-headers (buffer)
(with-current-buffer buffer
(widen)
(goto-char (point-min))
(search-forward "\n\n")
(delete-region (point-min) (point))
buffer)
)
but we would also need to look out for the special cases Tom mentioned.
Good enough?
url-remove-headers is separate so it can be re-used in a url-retrieve
callback for instance.
>
> Tom
--
Joakim Verona
Re: more url-utils?, Ted Zlatanov, 2011/05/14
- Re: more url-utils?, Stefan Monnier, 2011/05/16
- Re: more url-utils?, Tom Tromey, 2011/05/16
- Re: more url-utils?, Stefan Monnier, 2011/05/16
- Re: more url-utils?,
joakim <=
- Re: more url-utils?, Lennart Borgman, 2011/05/16
- Re: more url-utils?, Stefan Monnier, 2011/05/16
- Re: more url-utils?, Julien Danjou, 2011/05/16
Re: more url-utils?, Chong Yidong, 2011/05/16
- Re: more url-utils?, Ted Zlatanov, 2011/05/17
- Re: more url-utils?, Stefan Monnier, 2011/05/17
- Re: more url-utils?, Ted Zlatanov, 2011/05/17
- Re: more url-utils?, Stefan Monnier, 2011/05/18
- Re: more url-utils?, Ted Zlatanov, 2011/05/18
- Re: more url-utils?, Stefan Monnier, 2011/05/18