Subject: url-retrieve: allow to fail when no document is associated with the URI

From: Ivan Shmakov <[email-masked]>
Date: Mon, 09 Feb 2015 16:55:35 +0000

Package:  emacs
Severity: wishlist

	The handling of the news: (nntp:), irc:, and (as it seems) ftp:
	(file:) URI schemes is implemented in such a way that a
	/successful/ url-retrieve call is /not/ in fact guaranteed to
	return a “retrieved document” of any kind.  Consider, e. g.:

(let ((url-proxy-services nil))
  (list (url-retrieve "news://news.aioe.org/alt.sources"
                      (lambda (&rest any) (message "news: %S" any)))
        (url-retrieve "irc://irc.freenode.net:6667/x-test-channel"
                      (lambda (&rest any) (message "irc:  %S" any)))))

	Here, the first call starts up Gnus and opens a *Summary* buffer
	for the group; the second starts Rcirc by default; either call
	returns nil.

	I’d expect for these two calls to instead produce the buffers
	/describing/ those respective resources – the newsgroup (say,
	its XOVER data) and the IRC channel (the server responses to a
	few IRC commands issued for the channel.)  That is: I’d expect
	url-retrieve to behave much like wget(1), – /not/ like, say,
	run-mailcap(1).

	Naturally, this is orthogonal to the use of Gnus, Rcirc, etc. to
	do the actual job; and also to the ability to spawn them via
	M-x browse-url.  (Which seems unsupported, anyway.)

	As for the possible implementation, there may be a separate
	dynamic variable (say, url-retrieve-action) to tell the scheme
	handlers whether they should only try to retrieve the URI (and
	signal an error if not supported), or that they /may/ resort to
	the current behavior (i. e., start up some scheme-specific
	interaction facility.)

	Alternatively, url-retrieve may be changed to pass an additional
	non-nil argument to the scheme handler function in the case that
	the call is not intended to result in further user interaction.
	There may be either a separate call (url-run?) to request such
	an interaction, or a new argument to url-retrieve.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A