[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix b185775 143/192: fix hardcoded `kiwix-ajax-search
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix b185775 143/192: fix hardcoded `kiwix-ajax-search-hints` API URL |
Date: |
Sat, 19 Dec 2020 00:41:49 -0500 (EST) |
branch: externals/kiwix
commit b1857758310dde7812701db14b9f81c6c7830c41
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
fix hardcoded `kiwix-ajax-search-hints` API URL
---
kiwix.el | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/kiwix.el b/kiwix.el
index 84ce8c6..5bf1731 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -59,7 +59,7 @@
:safe #'numberp
:group 'kiwix-mode)
-(defcustom kiwix-server-url (format "http://127.0.0.1:%s/" kiwix-server-port)
+(defcustom kiwix-server-url (format "http://127.0.0.1:%s" kiwix-server-port)
"Specify Kiwix server URL."
:type 'string
:group 'kiwix-mode)
@@ -162,11 +162,11 @@
"Only capitalize the first word of STRING."
(concat (string (upcase (aref string 0))) (substring string 1)))
-(defun kiwix-query (query &optional library)
+(defun kiwix-query (query &optional selected-library)
"Search `QUERY' in `LIBRARY' with Kiwix."
- (let* ((kiwix-library (if library library (kiwix--get-library-name
kiwix-default-library)))
+ (let* ((library (or selected-library (kiwix--get-library-name
kiwix-default-library)))
(url (concat
- kiwix-server-url kiwix-library "/A/"
+ kiwix-server-url library "/A/"
;; query need to be convert to URL encoding: "禅宗"
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
(url-encode-url
;; convert space to underline: "Beta distribution"
"Beta_distribution"
@@ -195,7 +195,11 @@
(defun kiwix-ajax-search-hints (input)
"Instantly AJAX request to get available Kiwix entry keywords
list and return a list result."
- (let* ((ajax-api
"http://127.0.0.1:8089/suggest?content=wikipedia_zh_all_2015-11&term=")
+ (let* ((library (or kiwix-default-library
+ (kiwix--get-library-name kiwix-default-library)))
+ (ajax-api (format "%s/suggest?content=%s&term="
+ kiwix-server-url
+ library))
(ajax-url (concat ajax-api input))
(data (request-response-data
(request ajax-url
- [elpa] externals/kiwix d4d5ee0 149/192: Add an option for user to specify default browse-url function., (continued)
- [elpa] externals/kiwix d4d5ee0 149/192: Add an option for user to specify default browse-url function., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix ca3f70b 150/192: fix URL construct part missing slash., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 885a6c5 166/192: set kiwix-serve not started no response error handling, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 33e8cbb 106/192: fix functions docstring., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix aea0901 125/192: simplify Org kiwix link select library logic, Stefan Monnier, 2020/12/19
- [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 <=
- [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, 2020/12/19
- [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