emacs-devel
[Top][All Lists]
Advanced

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

Re: more url-utils?


From: Lars Magne Ingebrigtsen
Subject: Re: more url-utils?
Date: Tue, 17 May 2011 13:40:06 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> There are 3 parts.
> - removal of header text.
> - backward compatibility.
> - providing header info in a non-textual format.

Adding a new optional parameter `no-headers' (or something) to
`url-retrieve' (and -synchronous) could do the trick, but the caller
(who wants no headers) have to do some pretty deep inspection to find
out whether this version of `url-retrieve' has that parameter or not.

So how about a new function, with a signature something like this:

(defun url-fetch (url &keywords callback cbargs silent))

The `callback' is optional, and if not provided, makes `url-fetch' be
synchronous.

(Too bad Emacs doesn't really have a culture for closures, because
then we could get rid of cbargs, too.  Being able to say stuff like

(defun save-url (file)
  (url-fetch url :callback (lambda (status)
                             (write-region (point-min) (point-max) file))))

would be kinda elegant, I think, instead of

(defun save-url (file)
  (url-fetch url :callback (lambda (status file)
                             (write-region (point-min) (point-max) file))
                 :cbargs (list file)))

But that's a different discussion, perhaps.  :-)
                             
-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




reply via email to

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