[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix cc6a8df 140/192: implement instantly async comple
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix cc6a8df 140/192: implement instantly async completion backend with Ivy |
Date: |
Sat, 19 Dec 2020 00:41:48 -0500 (EST) |
branch: externals/kiwix
commit cc6a8df3b956edbad9520a1a981c248354538b60
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
implement instantly async completion backend with Ivy
---
README.org | 146 +++++++++++++++++++++++++++++++++----------------------------
kiwix.el | 16 ++++++-
2 files changed, 92 insertions(+), 70 deletions(-)
diff --git a/README.org b/README.org
index 0f61ad0..29069a3 100644
--- a/README.org
+++ b/README.org
@@ -7,73 +7,6 @@ This =kiwix.el= supports query =kiwix-tools='s =kiwix-serve=
server through URL
The =kiwix-serve= server can be started from command-line if you have
=kiwix-tools=
installed, or from Docker container [fn:1].
-* How does this extension work?
-
-** integrate with Emacs
-
-*** core
-
-I found Kiwix will return a URL like this:
-
-#+BEGIN_EXAMPLE
-http://127.0.0.1:8000/wikinews_en_all_2015-11/A/Big_Linux_Beta_3_released.html
-____________________ _____________________ __ _____________________________
-
-< server address > < library > <one of the returned results>
-#+END_EXAMPLE
-
-*** steps
-
-1. auto start ~kiwix-serve~ HTTP server.
-2. query/search on kiwix server.
- 1. open kiwix server index page to input to search. (But this is slow,
waste time)
- 2. use http language binding library to query on kiwix HTTP server.
- 1. select library in library list page.
- 2. after load a library, simulate type query string in the search input
- box, the submit to search.
- 3. return the result page HTML or page URL.
- 4. view the result with page URL or page HTML with Emacs browser.
-
-*** auto start kiwix HTTP server
-
-Here is a simple script, you can put it in Linux "*auto-start*".
-
-#+begin_src org
-,#+BEGIN_SRC sh :tangle "~/scripts/kiwix-server.sh"
-#!/usr/bin/env sh
-
-/usr/lib/kiwix/bin/kiwix-serve --library --port=8000 --daemon
~/.www.kiwix.org/kiwix/8ip89lik.default/data/library/library.xml
-,#+END_SRC
-#+end_src
-
-*** search
-
-1. kiwix-search command -> return a list of results.
-
- #+begin_src org
- ,#+BEGIN_SRC sh
- /usr/lib/kiwix/bin/kiwix-search
~/.www.kiwix.org/kiwix/8ip89lik.default/data/index/wikinews_en_all_2015-11.zim.idx
linux
- ,#+END_SRC
- #+end_src
-
-2. use one element of list as part of the URL.
-
-
http://127.0.0.1:8000/wikinews_en_all_2015-11/A/Big_Linux_Beta_3_released.html
-
- #+begin_src org
- ,#+BEGIN_SRC emacs-lisp
- (browse-url (concat "http://127.0.0.1:8000/" "LIBRARY" "/A/" "RESULT"))
- ,#+END_SRC
- #+end_src
-
-*** more advanced?
-
-If you want more advanced functions, you can use communicate kiwix HTTP server
-with RESTful API.
-
-- I don't know what Emacs library to use.
-- Or you can use other language to do this, like Ruby or Python etc.
-
* Install
** Install Kiwix
@@ -339,7 +272,7 @@ docker container ls --all | grep "kiwix-serve" | cat
** Use in Emacs
-=[M-x kiwix-at-point-interactive]=
+=[M-x kiwix-at-point]=
** Org-mode integration
@@ -353,6 +286,16 @@ The link format is like this:
The =(library)= can be =wikipedia_en=, =wikipedia_zh=, =wiktionary_en=, or
=en=, =zh= etc.
+* Changelog
+
+** DONE implemented async instantly input suggestion completion in Ivy
+ CLOSED: [2019-10-08 Tue 22:07]
+ :LOGBOOK:
+ - State "DONE" from [2019-10-08 Tue 22:07]
+ :END:
+
+This feature is very subtle :)
+
* Test
- [[wikipedia:Operations%20Research][Operations Research]] :: query contains
space.
@@ -360,6 +303,73 @@ The =(library)= can be =wikipedia_en=, =wikipedia_zh=,
=wiktionary_en=, or =en=,
- [[wikipedia:%E4%B8%AD%E5%9B%BD][中国]] :: non-english query
- [[wikipedia:meta-circular%20interpreter][meta-circular interpreter]] :: only
capitalize the first word.
+* How does this extension work?
+
+** integrate with Emacs
+
+*** core
+
+I found Kiwix will return a URL like this:
+
+#+BEGIN_EXAMPLE
+http://127.0.0.1:8000/wikinews_en_all_2015-11/A/Big_Linux_Beta_3_released.html
+____________________ _____________________ __ _____________________________
+
+< server address > < library > <one of the returned results>
+#+END_EXAMPLE
+
+*** steps
+
+1. auto start ~kiwix-serve~ HTTP server.
+2. query/search on kiwix server.
+ 1. open kiwix server index page to input to search. (But this is slow,
waste time)
+ 2. use http language binding library to query on kiwix HTTP server.
+ 1. select library in library list page.
+ 2. after load a library, simulate type query string in the search input
+ box, the submit to search.
+ 3. return the result page HTML or page URL.
+ 4. view the result with page URL or page HTML with Emacs browser.
+
+*** auto start kiwix HTTP server
+
+Here is a simple script, you can put it in Linux "*auto-start*".
+
+#+begin_src org
+,#+BEGIN_SRC sh :tangle "~/scripts/kiwix-server.sh"
+#!/usr/bin/env sh
+
+/usr/lib/kiwix/bin/kiwix-serve --library --port=8000 --daemon
~/.www.kiwix.org/kiwix/8ip89lik.default/data/library/library.xml
+,#+END_SRC
+#+end_src
+
+*** search
+
+1. kiwix-search command -> return a list of results.
+
+ #+begin_src org
+ ,#+BEGIN_SRC sh
+ /usr/lib/kiwix/bin/kiwix-search
~/.www.kiwix.org/kiwix/8ip89lik.default/data/index/wikinews_en_all_2015-11.zim.idx
linux
+ ,#+END_SRC
+ #+end_src
+
+2. use one element of list as part of the URL.
+
+
http://127.0.0.1:8000/wikinews_en_all_2015-11/A/Big_Linux_Beta_3_released.html
+
+ #+begin_src org
+ ,#+BEGIN_SRC emacs-lisp
+ (browse-url (concat "http://127.0.0.1:8000/" "LIBRARY" "/A/" "RESULT"))
+ ,#+END_SRC
+ #+end_src
+
+*** more advanced?
+
+If you want more advanced functions, you can use communicate kiwix HTTP server
+with RESTful API.
+
+- I don't know what Emacs library to use.
+- Or you can use other language to do this, like Ruby or Python etc.
+
* Footnotes
[fn:1] https://github.com/kiwix/kiwix-tools/issues/257
diff --git a/kiwix.el b/kiwix.el
index 228c507..37ed9cc 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -220,8 +220,20 @@ for query string and library interactively."
(let* ((library (if (or kiwix-search-interactively interactively)
(kiwix-select-library)
(kiwix--get-library-name kiwix-default-library)))
- (query (completing-read "Kiwix Search: "
- (kiwix-ajax-search-hints (read-string
"Input: ")))))
+ (query (ivy-read "Kiwix related entries: "
+ 'kiwix-ajax-search-hints
+ ;; (lambda (ivy-last) (kiwix-ajax-search-hints
ivy-last))
+ :predicate nil
+ :require-match nil
+ :initial-input nil
+ :preselect nil
+ :def nil
+ :history nil
+ :keymap nil
+ :update-fn 'auto
+ :sort t
+ :dynamic-collection t
+ :caller 'ivy-done)))
(message (format "library: %s, query: %s" library query))
(if (or (null library)
(string-empty-p library)
- [elpa] externals/kiwix 5fbf5bc 141/192: use symbol under point or region text as initial input for Ivy, (continued)
- [elpa] externals/kiwix 5fbf5bc 141/192: use symbol under point or region text as initial input for Ivy, Stefan Monnier, 2020/12/19
- [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 <=
- [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, 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