[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix c273429 06/18: refactor and remove the variable `
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix c273429 06/18: refactor and remove the variable `kiwix--selected-library' |
Date: |
Wed, 4 Aug 2021 18:28:09 -0400 (EDT) |
branch: externals/kiwix
commit c27342992ea68f958a327bd5355deabd8062f260
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
refactor and remove the variable `kiwix--selected-library'
---
kiwix.el | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/kiwix.el b/kiwix.el
index dc111d4..5c0dffe 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -149,19 +149,10 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
"A helper function to refresh available Kiwx libraries."
(setq kiwix-libraries (kiwix-get-libraries)))
-(defvar kiwix--selected-library nil
- "Global variable of currently select library used in anonymous function.
-Like in function `kiwix-ajax-search-hints'.")
-
(defun kiwix-select-library (&optional filter)
"Select Kiwix library name."
(completing-read "Kiwix library: " kiwix-libraries nil t filter))
-(defcustom kiwix-default-library "wikipedia_en_all.zim"
- "The default kiwix library when library fragment in link not specified."
- :type 'string
- :safe #'stringp)
-
(defcustom kiwix-mode-prefix nil
"Specify kiwix-mode keybinding prefix before loading."
:type 'kbd)
@@ -200,7 +191,7 @@ Like in function `kiwix-ajax-search-hints'.")
(defun kiwix-query (query &optional selected-library)
"Search `QUERY' in `LIBRARY' with Kiwix."
- (let* ((library (or selected-library (kiwix--get-library-name
kiwix-default-library)))
+ (let* ((library (or selected-library (kiwix--get-library-name
selected-library)))
(url (concat (format "%s:%s" kiwix-server-url (number-to-string
kiwix-server-port))
"/search?content=" library "&pattern="
(url-hexify-string query)))
(browse-url-browser-function kiwix-default-browser-function))
@@ -223,7 +214,7 @@ Like in function `kiwix-ajax-search-hints'.")
(or (kiwix-docker-check)
(async-shell-command "docker pull kiwix/kiwix-serve")))
(let ((inhibit-message t))
- (request (format "%s:%s" kiwix-server-url (number-to-string
kiwix-server-port))
+ (request (format "%s:%s" kiwix-server-url kiwix-server-port)
:type "GET"
:sync t
:parser (lambda () (libxml-parse-html-region (point-min) (point-max)))
@@ -238,14 +229,13 @@ Like in function `kiwix-ajax-search-hints'.")
:status-code '((404 . (lambda (&rest _) (message (format "Endpoint %s
does not exist." url))))
(500 . (lambda (&rest _) (message (format "Error from
%s." url))))))))
-(defun kiwix-ajax-search-hints (input &optional selected-library)
+(defun kiwix--ajax-search-hints (input &optional selected-library)
"Instantly AJAX request to get available Kiwix entry keywords
list and return a list result."
(kiwix-ping-server)
(when (and input kiwix-server-available?)
(let* ((library (or selected-library
- (kiwix--get-library-name (or kiwix--selected-library
- kiwix-default-library))))
+ (kiwix--get-library-name selected-library)))
(ajax-api (format "%s:%s/suggest?content=%s&term="
kiwix-server-url (number-to-string
kiwix-server-port)
library))
- [elpa] externals/kiwix updated (0c5e161 -> 71e770c), Stefan Monnier, 2021/08/04
- [elpa] externals/kiwix c273429 06/18: refactor and remove the variable `kiwix--selected-library',
Stefan Monnier <=
- [elpa] externals/kiwix ca03a65 01/18: use Docker server by default, Stefan Monnier, 2021/08/04
- [elpa] externals/kiwix c871bef 07/18: refactor function kiwix-at-point to separate into smaller functional functions, Stefan Monnier, 2021/08/04
- [elpa] externals/kiwix 7e0b82c 04/18: refresh ZIM libraries list once-time per package loading, Stefan Monnier, 2021/08/04
- [elpa] externals/kiwix 12e13c8 02/18: support remote Docker service, Stefan Monnier, 2021/08/04
- [elpa] externals/kiwix 423f607 05/18: Concentrate all kiwix library dir variables into only one, Stefan Monnier, 2021/08/04
- [elpa] externals/kiwix 716f3c4 12/18: Add condition to detect kiwix library path exist to fix GitHub Actions, Stefan Monnier, 2021/08/04
- [elpa] externals/kiwix e191c31 09/18: improve function kiwix-get-libraries to support remote Docker server, Stefan Monnier, 2021/08/04
- [elpa] externals/kiwix 0ec84f3 03/18: use dynamic ZIM library path, Stefan Monnier, 2021/08/04
- [elpa] externals/kiwix 3330d7e 08/18: Add extra library "elquery" for parsing HTTP query HTML result, Stefan Monnier, 2021/08/04
- [elpa] externals/kiwix a33c4a2 16/18: Fix kiwix-libraries variable not initialized by function kiwix-get-libraries, Stefan Monnier, 2021/08/04