[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix 4243689 156/192: check whether Docker image "kiwi
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix 4243689 156/192: check whether Docker image "kiwix/kiwix-serve" is available |
Date: |
Sat, 19 Dec 2020 00:41:51 -0500 (EST) |
branch: externals/kiwix
commit 4243689f319dec97e589fb880623a2424a3a02c3
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
check whether Docker image "kiwix/kiwix-serve" is available
---
kiwix.el | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/kiwix.el b/kiwix.el
index a7cce93..399e21c 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -202,20 +202,30 @@ Like in function `kiwix-ajax-search-hints'.")
(browse-url-browser-function kiwix-default-browser-function))
(browse-url url)))
+(defun kiwix-docker-check ()
+ "Make sure Docker image 'kiwix/kiwix-server' is available."
+ (let ((docker-image (replace-regexp-in-string
+ "\n" ""
+ (shell-command-to-string
+ "docker image ls kiwix/kiwix-serve | sed -n '2p' | cut
-d ' ' -f 1"))))
+ (string-equal docker-image "kiwix/kiwix-serve")))
+
(defvar kiwix-server-available? nil
"The kiwix-server current available?")
(defun kiwix-ping-server ()
"Ping Kiwix server to set `kiwix-server-available?' global state variable."
+ (when kiwix-server-use-docker
+ (kiwix-docker-check))
(let ((inhibit-message 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 (function* (lambda (&rest args &key error-thrown
&allow-other-keys)
- (setq kiwix-server-available? nil))))))
+ :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 (function* (lambda (&rest args &key error-thrown
&allow-other-keys)
+ (setq kiwix-server-available? nil))))))
(defun kiwix-ajax-search-hints (input &optional selected-library)
"Instantly AJAX request to get available Kiwix entry keywords
- [elpa] externals/kiwix 878b02b 131/192: remove autoload cookies for Org link commands, (continued)
- [elpa] externals/kiwix 878b02b 131/192: remove autoload cookies for Org link commands, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 1861f27 134/192: replace simple url-retrieve-synchronously with library request.el, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 8d5e53c 138/192: add query string related wikipedia entries through kiwix AJAX instantly search, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 87c1246 139/192: simplify kiwix read input, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix cc6a8df 140/192: implement instantly async completion backend with Ivy, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix b185775 143/192: fix hardcoded `kiwix-ajax-search-hints` API URL, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 32ad2cb 148/192: update Org Mode name, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix d2065a1 152/192: fix default browse-url variable name, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 4082292 155/192: provide a helper function to refresh available kiwix libraries, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 7e18994 158/192: add a custom option for kiwix default libraries path, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 4243689 156/192: check whether Docker image "kiwix/kiwix-serve" is available,
Stefan Monnier <=
- [elpa] externals/kiwix d7c4778 162/192: select library require matched in candidates, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 5b5b117 163/192: improve the kiwix-query URL to use the search API, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix f4a1e2d 164/192: rename function* -> cl-function, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix cf6fc32 165/192: add :status-code handler, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 3fe879f 168/192: refresh libraries before selecting library, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 716c5f6 169/192: Docker container launch command use library.xml index file, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix cd95bc9 171/192: update README: using libraries index file "library.xml", Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 9db0a13 172/192: display screenshots at beginning, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 5f64044 175/192: support detect whether query is chinese, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 6c6c443 176/192: fix Org link open function, Stefan Monnier, 2020/12/19