help-gnu-emacs
[Top][All Lists]
Advanced

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

kill buffer created by url-retrieve-synchronously


From: Peter Münster
Subject: kill buffer created by url-retrieve-synchronously
Date: Fri, 26 Feb 2016 12:25:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Hi,

A timer calls periodically this function:

--8<---------------cut here---------------start------------->8---
(defun pm/get-json (url)
  "Copied from
http://frozenlock.org/2012/07/07/url-retrieve-and-json-api/.";
  (let* ((url-mime-encoding-string "identity")
         (buffer (with-timeout (3 nil) (url-retrieve-synchronously url)))
         (result 
          (with-current-buffer buffer
            (goto-char (point-min))
            (re-search-forward "^$")
            (json-read))))
    (kill-buffer buffer)
    result))
--8<---------------cut here---------------end--------------->8---

Sometimes, the buffers created by url-retrieve-synchronously are not
killed, because I see them in (buffer-list).

What should I do to ensure, that these buffers are always killed at the
end of the function please?

TIA for any help,
-- 
           Peter




reply via email to

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