Subject: Re: bug#34763: 27.0.50; url-retrieve-synchronously misbehaves inside eldoc-documentation-function

From: Dmitry Gutov <[email-masked]>
Date: Fri, 5 Apr 2019 03:29:55 +0300

On 04.04.2019 17:36, Eli Zaretskii wrote:

>> Because accept-process-output doesn't abort on user input?
> 
> It doesn't?  Are you sure?  Or are you talking about calling
> accept-process-output with inhibit-quit non-nil?

Sorry, you're right. That's the only thing that's necessary.

>> And url-retrieve-synchronously calls it with 1 second timeout (which
>> is a fairly long wait).
> 
> That could be dealt with by making the timeout shorter.

No need.

So, I tried the patch below (did you have that change in mind exactly?), 
and I see no adverse effects so far.

Unfortunately, I don't see all the improvement I was hoping for either.

Good (probably): No "interrupted" messages now, or weird 1-second 
pauses. Or full freezes (so far).

Bad:

The requests still get slower after I've been typing a while, and the 
original speed is never recovered. Even after I wait 10 minutes or so.

And this scenario still spawns lots of processes for the same host and port.

>> 2. I wonder if there are cases where some part of the asynchronous code
>> takes too long, where it should be allowed to be aborted by the user
>> right away. Meaning when url-retrieve is used, not
>> url-retrieve-synchronously.
> 
> I always thought that C-g aborts accept-process-output.

url-retrieve doesn't use accept-process-output.

diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index cf1952066a..d76ad63eef 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -158,7 +158,8 @@ url-http-debug
  	    (progn
  	      (set-process-sentinel proc nil)
  	      (set-process-filter proc nil)))
-	(error "Transfer interrupted!")))
+	;; (error "Transfer interrupted!")
+        ))
    (apply 'url-debug 'http args))

  (defun url-http-mark-connection-as-busy (host port proc)
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index 72ff4f171c..5b8350642f 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -61,8 +61,6 @@ url-debug

  ;;;###autoload
  (defun url-debug (tag &rest args)
-  (if (eq quit-flag t)
-      (error "Interrupted!"))
    (if (or (eq url-debug t)
  	  (numberp url-debug)
  	  (and (listp url-debug) (memq tag url-debug)))