emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/kiwix 1861f27 134/192: replace simple url-retrieve-sync


From: Stefan Monnier
Subject: [elpa] externals/kiwix 1861f27 134/192: replace simple url-retrieve-synchronously with library request.el
Date: Sat, 19 Dec 2020 00:41:47 -0500 (EST)

branch: externals/kiwix
commit 1861f27674eb376cc0e2b84c1b5545e0fec28d79
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>

    replace simple url-retrieve-synchronously with library request.el
---
 kiwix.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index 896bd98..8e4c80d 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -7,7 +7,7 @@
 ;; URL: https://github.com/stardiviner/kiwix.el
 ;; Created: 23th July 2016
 ;; Version: 1.0.0
-;; Package-Requires: ((emacs "24.4") (cl-lib "0.5"))
+;; Package-Requires: ((emacs "24.4") (cl-lib "0.5") (request "0.3.0"))
 
 ;;; Commentary:
 
@@ -37,6 +37,7 @@
 
 
 (require 'cl-lib)
+(require 'request)
 
 (autoload 'org-link-set-parameters "org")
 (autoload 'org-store-link-props "org")
@@ -187,13 +188,14 @@ Or When prefix argument `INTERACTIVELY' specified, then 
prompt
 for query string and library interactively."
   (interactive "P")
   ;; ping kiwix-serve generally to make sure server available.
-  (if (> (length
-          (with-temp-buffer
-            (url-retrieve-synchronously kiwix-server-url)
-            (buffer-string)))
-         1)
-      (setq kiwix-server-available? nil)
-    (setq kiwix-server-available? t))
+  (request kiwix-server-url
+           :type "GET"
+           :sync t
+           :parser (lambda () (libxml-parse-html-region (point-min) 
(point-max)))
+           :success (function* (lambda (&key data &allow-other-keys)
+                                 (setq kiwix-server-available? t)))
+           :error (lambda (&rest args &key error-thrown &allow-other-keys)
+                    (setq kiwix-server-available? nil)))
   (if kiwix-server-available?
       (let* ((library (if (or kiwix-search-interactively interactively)
                           (kiwix-select-library)



reply via email to

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