unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tomas Hlavaty <tom@logand.com>
To: Eduardo Ochs <eduardoochs@gmail.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Workshop to save M$ Windows users - help needed
Date: Mon, 04 Oct 2021 20:29:50 +0200	[thread overview]
Message-ID: <87ee90y76p.fsf@logand.com> (raw)
In-Reply-To: <87h7dwy9qh.fsf@logand.com>

url-retrieve-synchronously2 had a bug

this works and should dispose the nework buffer properly:

(defun url-retrieve-synchronously7 (url filename)
  (let (z (again t))
    (url-retrieve url
                  (lambda (status)
                    (setq again nil)
                    (when status
                      (setq z status)
                      (let ((coding-system-for-write 'raw-text-unix))
                        (write-region (point-min) (point-max) filename)))
                    (kill-buffer)))
    (while again
      (sleep-for 1))
    z))

(url-retrieve-synchronously7 "https://logand.com" "/tmp/e7")
(url-retrieve-synchronously7 "https://logand.com1" "/tmp/e7")
/tmp/e7

There is a comment in url-retrieve-synchronously about sleep-for and
similar suggesting that that might not always work but it works for me.
Not sure about windows.

I think url-retrieve-synchronously should not ignore the status but
return it instead.

What other issue did you have with url-retrieve-synchronously apart from
not being able to detect errors?  Your link to the thread discussed only
preference for libcurl.  I did not find what is wrong with
url-retrieve-synchronously there.  Another thing wrong with that is
probably that the network buffer is returned but iirc buffers are not
garbage collected, or something like that.  That's why I put kill-buffer
there.



  reply	other threads:[~2021-10-04 18:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-03  4:26 Workshop to save M$ Windows users - help needed Eduardo Ochs
2021-10-03  5:45 ` Jean Louis
2021-10-03  7:59   ` Eduardo Ochs
2021-10-03  9:35 ` Eli Zaretskii
2021-10-03 10:19   ` Eduardo Ochs
2021-10-03 10:40     ` Eli Zaretskii
2021-10-03 19:15       ` Eduardo Ochs
2021-10-03 19:44         ` Tomas Hlavaty
2021-10-04  3:06           ` Eduardo Ochs
2021-10-04 17:34             ` Tomas Hlavaty
2021-10-04 18:29               ` Tomas Hlavaty [this message]
2021-10-06  4:50                 ` Eduardo Ochs
2021-10-06  5:10                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-06 12:41                   ` Eli Zaretskii
2021-10-07 16:32                 ` Eduardo Ochs
2021-10-07 17:52                   ` Tomas Hlavaty
2021-10-04 18:50         ` Eli Zaretskii
2021-10-06  4:19           ` Eduardo Ochs
2021-10-03  9:36 ` Tomas Hlavaty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ee90y76p.fsf@logand.com \
    --to=tom@logand.com \
    --cc=eduardoochs@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).